Bug markers show a dialogue when selected, giving basic info and offering a link to the bug's webpage.

This commit is contained in:
Jamie Greunbaum 2024-06-05 19:26:56 -04:00
parent 695945b783
commit fb66765bce
6 changed files with 37 additions and 2 deletions

View File

@ -2,6 +2,7 @@ class_name BugbotBugData
extends Resource extends Resource
var id : int = -1 var id : int = -1
var key : StringName
var title : String var title : String
var body : String var body : String
var component : StringName var component : StringName

View File

@ -79,6 +79,9 @@ func _current_server_api() -> String:
func _get_project_name() -> String: func _get_project_name() -> String:
return "" return ""
func _get_bug_url(bug_data:BugbotBugData) -> String:
return "https://google.com"
func __build_url_string(_api_suffix:String) -> String: func __build_url_string(_api_suffix:String) -> String:
return "" return ""

View File

@ -218,6 +218,10 @@ func _current_server_api() -> String:
func _get_project_name() -> String: func _get_project_name() -> String:
return ProjectSettings.get_setting("bugbot/reporting/bugzilla/product_name", DEFAULT_PRODUCT_NAME) return ProjectSettings.get_setting("bugbot/reporting/bugzilla/product_name", DEFAULT_PRODUCT_NAME)
func _get_bug_url(bug_data:BugbotBugData) -> String:
var bugzilla_server : String = ProjectSettings.get_setting("bugbot/reporting/bugzilla/server", DEFAULT_SERVER)
return "%s/show_bug.cgi?id=%d" % [bugzilla_server, bug_data.id]
func __build_url_string(_api_suffix:String) -> String: func __build_url_string(_api_suffix:String) -> String:
return "/" + \ return "/" + \
ProjectSettings.get_setting("bugbot/reporting/bugzilla/REST_URI", DEFAULT_REST_URI) + \ ProjectSettings.get_setting("bugbot/reporting/bugzilla/REST_URI", DEFAULT_REST_URI) + \
@ -296,6 +300,7 @@ func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String,
return null return null
bug.id = bug_in["id"] bug.id = bug_in["id"]
bug.key = String.num_int64(bug.id)
bug.title = bug_in["summary"] bug.title = bug_in["summary"]
bug.component = bug_in["component"] bug.component = bug_in["component"]
bug.platform = bug_in["platform"] bug.platform = bug_in["platform"]

View File

@ -193,6 +193,12 @@ func _current_server_api() -> String:
func _get_project_name() -> String: func _get_project_name() -> String:
return ProjectSettings.get_setting("bugbot/reporting/gitea/repo_name", DEFAULT_REPO_NAME) return ProjectSettings.get_setting("bugbot/reporting/gitea/repo_name", DEFAULT_REPO_NAME)
func _get_bug_url(bug_data:BugbotBugData) -> String:
var gitea_server : String = ProjectSettings.get_setting("bugbot/reporting/gitea/server", DEFAULT_SERVER)
var owner_name : String = ProjectSettings.get_setting("bugbot/reporting/gitea/owner_name", DEFAULT_OWNER_NAME)
var repo_name : String = ProjectSettings.get_setting("bugbot/reporting/gitea/repo_name", DEFAULT_REPO_NAME)
return "%s/%s/%s/issues/%d" % [gitea_server, owner_name, repo_name, bug_data.id]
func __build_url_string(_api_suffix:String) -> String: func __build_url_string(_api_suffix:String) -> String:
return "/" + \ return "/" + \
ProjectSettings.get_setting("bugbot/reporting/gitea/base_URL", DEFAULT_BASE_URL) + \ ProjectSettings.get_setting("bugbot/reporting/gitea/base_URL", DEFAULT_BASE_URL) + \
@ -279,7 +285,8 @@ func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String,
if validate_labels and not show_marker: if validate_labels and not show_marker:
return null return null
bug.id = bug_in["id"] bug.id = bug_in["number"]
bug.key = String.num_int64(bug.id)
bug.title = bug_in["title"] bug.title = bug_in["title"]
bug.body = bug_in["body"] bug.body = bug_in["body"]
bug.component = &"Unused" bug.component = &"Unused"

View File

@ -231,6 +231,10 @@ func _current_server_api() -> String:
func _get_project_name() -> String: func _get_project_name() -> String:
return ProjectSettings.get_setting("bugbot/reporting/jira/project_name", DEFAULT_PROJECT_NAME) return ProjectSettings.get_setting("bugbot/reporting/jira/project_name", DEFAULT_PROJECT_NAME)
func _get_bug_url(bug_data:BugbotBugData) -> String:
var jira_server : String = ProjectSettings.get_setting("bugbot/reporting/jira/server", DEFAULT_SERVER)
return "%s/browse/%s" % [jira_server, bug_data.key]
func __build_url_string(_api_suffix:String) -> String: func __build_url_string(_api_suffix:String) -> String:
return "/" + \ return "/" + \
ProjectSettings.get_setting("bugbot/reporting/jira/REST_URI", DEFAULT_REST_URI) + \ ProjectSettings.get_setting("bugbot/reporting/jira/REST_URI", DEFAULT_REST_URI) + \
@ -318,17 +322,21 @@ func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String,
var show_marker : bool var show_marker : bool
if resolved_tag_found: if resolved_tag_found:
bug.resolution = BugbotServerAPI.RESOLVED_TAG bug.resolution = BugbotServerAPI.RESOLVED_TAG
bug.is_open = false
show_marker = label_dict["show_resolved"] as bool show_marker = label_dict["show_resolved"] as bool
elif in_progress_tag_found: elif in_progress_tag_found:
bug.resolution = BugbotServerAPI.IN_PROGRESS_TAG bug.resolution = BugbotServerAPI.IN_PROGRESS_TAG
bug.is_open = true
show_marker = label_dict["show_in_progress"] as bool show_marker = label_dict["show_in_progress"] as bool
elif unresolved_tag_found or (label_dict["unresolved_labels"] as Array).is_empty(): elif unresolved_tag_found or (label_dict["unresolved_labels"] as Array).is_empty():
bug.resolution = BugbotServerAPI.UNRESOLVED_TAG bug.resolution = BugbotServerAPI.UNRESOLVED_TAG
bug.is_open = true
show_marker = label_dict["show_unresolved"] as bool show_marker = label_dict["show_unresolved"] as bool
if validate_labels and not show_marker: if validate_labels and not show_marker:
return null return null
bug.id = bug_in["id"] bug.id = bug_in["id"]
bug.key = bug_in["key"]
bug.title = fields["summary"] bug.title = fields["summary"]
if fields["description"]: bug.body = fields["description"] if fields["description"]: bug.body = fields["description"]
bug.component = &"Unused" bug.component = &"Unused"

View File

@ -145,7 +145,18 @@ func __on_marker_selection_changed() -> void:
if selected.size() == 1: if selected.size() == 1:
var selected_marker : Node = selected[0] var selected_marker : Node = selected[0]
if selected_marker is BugMarker: if selected_marker is BugMarker:
print(selected_marker.bug_info.title) var bug_popup : ConfirmationDialog = ConfirmationDialog.new()
var bug_info : BugbotBugData = selected_marker.bug_info
bug_popup.dialog_text = &"%s\n%s\n%s" % [bug_info.title, bug_info.severity, "Open" if bug_info.is_open else "Closed"]
bug_popup.ok_button_text = &"Open In Browser"
bug_popup.get_ok_button().pressed.connect(__marker_selection_open_bug_page.bind(bug_info))
bug_popup.cancel_button_text = &"Cancel"
bug_popup.get_cancel_button().pressed.connect(__marker_selection_cancelled)
bug_popup.popup_exclusive_centered(selected_marker)
func __marker_selection_open_bug_page(bug_data:BugbotBugData):
OS.shell_open(__editor_server_api._get_bug_url(bug_data))
func __marker_selection_cancelled():
pass
func __on_editor_tab_switched(new_scene:Node) -> void: func __on_editor_tab_switched(new_scene:Node) -> void: