Bug markers now have their info properly set when first created.
This commit is contained in:
parent
58bc591405
commit
27b5d593f6
@ -386,13 +386,14 @@ func __bug_report_form_data_prepared(tag_lists:Array) -> void:
|
|||||||
__bug_report_form.fill_tags(tag_lists)
|
__bug_report_form.fill_tags(tag_lists)
|
||||||
__bug_report_form.submitted.connect(__form_submitted)
|
__bug_report_form.submitted.connect(__form_submitted)
|
||||||
__bug_report_form.cancelled.connect(__form_cancelled)
|
__bug_report_form.cancelled.connect(__form_cancelled)
|
||||||
func __form_submitted(map_name:String, bug_position:Vector3, bug_normal:Vector3) -> void:
|
func __form_submitted(bug:BugbotBugData) -> void:
|
||||||
__get_bug_marker_root(get_tree().current_scene)
|
__get_bug_marker_root(get_tree().current_scene)
|
||||||
var marker : BugMarker = (load(bug_marker) as PackedScene).instantiate() as BugMarker
|
var marker : BugMarker = (load(bug_marker) as PackedScene).instantiate() as BugMarker
|
||||||
__bug_marker_root.add_child(marker)
|
__bug_marker_root.add_child(marker)
|
||||||
marker.global_position = bug_position
|
marker.global_position = bug.marker_position
|
||||||
marker.set_rotation_to_normal(bug_normal)
|
marker.set_rotation_to_normal(bug.marker_normal)
|
||||||
marker.marker_status = BugMarker.BugStatus.UNRESOLVED
|
marker.marker_status = BugMarker.BugStatus.UNRESOLVED
|
||||||
|
marker.bug_info = bug
|
||||||
__form_cancelled()
|
__form_cancelled()
|
||||||
func __form_cancelled() -> void:
|
func __form_cancelled() -> void:
|
||||||
__bug_report_form.queue_free()
|
__bug_report_form.queue_free()
|
||||||
|
|||||||
@ -42,75 +42,18 @@ func __return_list_of_bugs_thread(map_name:String, callback:Callable) -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
var bug_array : Array
|
var bug_array : Array
|
||||||
var resolved_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses", Array())
|
var label_dict : Dictionary = {
|
||||||
var in_progress_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/in_progress_statuses", Array())
|
"show_unresolved": ProjectSettings.get_setting("bugbot/markers/unresolved/show_unresolved_bugs", true),
|
||||||
var unresolved_labels : Array = ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/unresolved_statuses", Array())
|
"show_in_progress": ProjectSettings.get_setting("bugbot/markers/in_progress/show_in_progress_bugs", true),
|
||||||
|
"show_resolved": ProjectSettings.get_setting("bugbot/markers/resolved/show_resolved_bugs", false),
|
||||||
var show_resolved : bool = ProjectSettings.get_setting("bugbot/markers/resolved/show_resolved_bugs", false)
|
|
||||||
var show_in_progress : bool = ProjectSettings.get_setting("bugbot/markers/in_progress/show_in_progress_bugs", true)
|
|
||||||
var show_unresolved : bool = ProjectSettings.get_setting("bugbot/markers/unresolved/show_unresolved_bugs", true)
|
|
||||||
|
|
||||||
|
"unresolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/unresolved_statuses", Array()),
|
||||||
|
"in_progress_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/in_progress_statuses", Array()),
|
||||||
|
"resolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses", Array()),
|
||||||
|
}
|
||||||
for bug_in:Dictionary in response_data:
|
for bug_in:Dictionary in response_data:
|
||||||
var bugbot_marker_string : String = bug_in["body"].split("\n")[-1]
|
var bug : BugbotBugData = __create_bug_data_from_server_response(bug_in, map_name, label_dict, true)
|
||||||
if not bugbot_marker_string.begins_with("{") and not bugbot_marker_string.ends_with("}"):
|
if bug:
|
||||||
continue
|
|
||||||
|
|
||||||
var bug : BugbotBugData = BugbotBugData.new()
|
|
||||||
|
|
||||||
# Check if the map name is valid for the scene we're in.
|
|
||||||
var bugbot_marker_data : Dictionary = JSON.parse_string(bugbot_marker_string)
|
|
||||||
bug.map_name = bugbot_marker_data["map_name"]
|
|
||||||
if bug.map_name != map_name:
|
|
||||||
continue
|
|
||||||
|
|
||||||
var marker_location : Array = bugbot_marker_data["bug_position"]
|
|
||||||
var marker_normal : Array = bugbot_marker_data["bug_normal"]
|
|
||||||
bug.marker_position = Vector3(marker_location[0], marker_location[1], marker_location[2])
|
|
||||||
bug.marker_normal = Vector3(marker_normal[0], marker_normal[1], marker_normal[2])
|
|
||||||
|
|
||||||
var bug_labels : Array = []
|
|
||||||
var resolved_tag_found : bool = false
|
|
||||||
var in_progress_tag_found : bool = false
|
|
||||||
var unresolved_tag_found : bool = false
|
|
||||||
|
|
||||||
# Find which resolution statuses apply to this bug.
|
|
||||||
bug.is_open = (bug_in["state"] == "open")
|
|
||||||
if not bug.is_open:
|
|
||||||
resolved_tag_found = true
|
|
||||||
else:
|
|
||||||
for labels:Dictionary in bug_in["labels"]:
|
|
||||||
bug_labels.append(labels["name"] as String)
|
|
||||||
for label:String in resolved_labels:
|
|
||||||
if bug_labels.has(label): resolved_tag_found = true
|
|
||||||
for label:String in in_progress_labels:
|
|
||||||
if bug_labels.has(label): in_progress_tag_found = true
|
|
||||||
for label:String in unresolved_labels:
|
|
||||||
if bug_labels.has(label): unresolved_tag_found = true
|
|
||||||
|
|
||||||
# Figure out which resolution tag to prioritise, and whether we should show the marker.
|
|
||||||
var show_marker : bool
|
|
||||||
if resolved_tag_found:
|
|
||||||
bug.resolution = RESOLVED_TAG
|
|
||||||
show_marker = show_resolved
|
|
||||||
elif in_progress_tag_found:
|
|
||||||
bug.resolution = IN_PROGRESS_TAG
|
|
||||||
show_marker = show_in_progress
|
|
||||||
elif unresolved_tag_found or unresolved_labels.is_empty():
|
|
||||||
bug.resolution = UNRESOLVED_TAG
|
|
||||||
show_marker = show_unresolved
|
|
||||||
if not show_marker:
|
|
||||||
continue
|
|
||||||
|
|
||||||
bug.id = bug_in["id"]
|
|
||||||
bug.title = bug_in["title"]
|
|
||||||
bug.body = bug_in["body"]
|
|
||||||
bug.component = &"Unused"
|
|
||||||
bug.platform = &"Unused"
|
|
||||||
bug.operating_system = &"Unused"
|
|
||||||
bug.severity = "Severity will go here."
|
|
||||||
bug.status = bug_in["state"]
|
|
||||||
bug.duplicate_of = -1
|
|
||||||
|
|
||||||
bug_array.append(bug)
|
bug_array.append(bug)
|
||||||
|
|
||||||
callback.call_deferred(bug_array)
|
callback.call_deferred(bug_array)
|
||||||
@ -220,7 +163,18 @@ func __send_form_data_thread(data:Dictionary, map_name:String, bug_position:Vect
|
|||||||
if __validate_server_response(post_response_data) != Error.OK:
|
if __validate_server_response(post_response_data) != Error.OK:
|
||||||
return
|
return
|
||||||
|
|
||||||
callback.call_deferred(post_response_data)
|
var label_dict : Dictionary = {
|
||||||
|
"show_unresolved": ProjectSettings.get_setting("bugbot/markers/unresolved/show_unresolved_bugs", true),
|
||||||
|
"show_in_progress": ProjectSettings.get_setting("bugbot/markers/in_progress/show_in_progress_bugs", true),
|
||||||
|
"show_resolved": ProjectSettings.get_setting("bugbot/markers/resolved/show_resolved_bugs", false),
|
||||||
|
|
||||||
|
"unresolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/unresolved_statuses", Array()),
|
||||||
|
"in_progress_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/in_progress_statuses", Array()),
|
||||||
|
"resolved_labels": ProjectSettings.get_setting("bugbot/reporting/gitea/status_labels/resolved_statuses", Array()),
|
||||||
|
}
|
||||||
|
var bug_data : BugbotBugData = __create_bug_data_from_server_response(post_response_data, map_name, label_dict, false)
|
||||||
|
|
||||||
|
callback.call_deferred(bug_data)
|
||||||
__bugbot_server_thread.call_deferred("wait_to_finish")
|
__bugbot_server_thread.call_deferred("wait_to_finish")
|
||||||
|
|
||||||
|
|
||||||
@ -259,3 +213,66 @@ func __validate_server_response(_response:Variant) -> int:
|
|||||||
__bugbot_server_thread.call_deferred("wait_to_finish")
|
__bugbot_server_thread.call_deferred("wait_to_finish")
|
||||||
return Error.FAILED
|
return Error.FAILED
|
||||||
return Error.OK
|
return Error.OK
|
||||||
|
|
||||||
|
func __create_bug_data_from_server_response(bug_in:Dictionary, map_name:String, label_dict:Dictionary, validate_labels:bool) -> BugbotBugData:
|
||||||
|
var bugbot_marker_string : String = bug_in["body"].split("\n")[-1]
|
||||||
|
if not bugbot_marker_string.begins_with("{") and not bugbot_marker_string.ends_with("}"):
|
||||||
|
return null
|
||||||
|
|
||||||
|
var bug : BugbotBugData = BugbotBugData.new()
|
||||||
|
|
||||||
|
# Check if the map name is valid for the scene we're in.
|
||||||
|
var bugbot_marker_data : Dictionary = JSON.parse_string(bugbot_marker_string)
|
||||||
|
bug.map_name = bugbot_marker_data["map_name"]
|
||||||
|
if bug.map_name != map_name:
|
||||||
|
return null
|
||||||
|
|
||||||
|
var marker_location : Array = bugbot_marker_data["bug_position"]
|
||||||
|
var marker_normal : Array = bugbot_marker_data["bug_normal"]
|
||||||
|
bug.marker_position = Vector3(marker_location[0], marker_location[1], marker_location[2])
|
||||||
|
bug.marker_normal = Vector3(marker_normal[0], marker_normal[1], marker_normal[2])
|
||||||
|
|
||||||
|
var bug_labels : Array = []
|
||||||
|
var resolved_tag_found : bool = false
|
||||||
|
var in_progress_tag_found : bool = false
|
||||||
|
var unresolved_tag_found : bool = false
|
||||||
|
|
||||||
|
# Find which resolution statuses apply to this bug.
|
||||||
|
bug.is_open = (bug_in["state"] == "open")
|
||||||
|
if not bug.is_open:
|
||||||
|
resolved_tag_found = true
|
||||||
|
else:
|
||||||
|
for labels:Dictionary in bug_in["labels"]:
|
||||||
|
bug_labels.append(labels["name"] as String)
|
||||||
|
for label:String in label_dict["resolved_labels"] as Array:
|
||||||
|
if bug_labels.has(label): resolved_tag_found = true
|
||||||
|
for label:String in label_dict["in_progress_labels"] as Array:
|
||||||
|
if bug_labels.has(label): in_progress_tag_found = true
|
||||||
|
for label:String in label_dict["unresolved_labels"] as Array:
|
||||||
|
if bug_labels.has(label): unresolved_tag_found = true
|
||||||
|
|
||||||
|
# Figure out which resolution tag to prioritise, and whether we should show the marker.
|
||||||
|
var show_marker : bool
|
||||||
|
if resolved_tag_found:
|
||||||
|
bug.resolution = RESOLVED_TAG
|
||||||
|
show_marker = label_dict["show_resolved"] as bool
|
||||||
|
elif in_progress_tag_found:
|
||||||
|
bug.resolution = IN_PROGRESS_TAG
|
||||||
|
show_marker = label_dict["show_in_progress"] as bool
|
||||||
|
elif unresolved_tag_found or (label_dict["unresolved_labels"] as Array).is_empty():
|
||||||
|
bug.resolution = UNRESOLVED_TAG
|
||||||
|
show_marker = label_dict["show_unresolved"] as bool
|
||||||
|
if validate_labels and not show_marker:
|
||||||
|
return null
|
||||||
|
|
||||||
|
bug.id = bug_in["id"]
|
||||||
|
bug.title = bug_in["title"]
|
||||||
|
bug.body = bug_in["body"]
|
||||||
|
bug.component = &"Unused"
|
||||||
|
bug.platform = &"Unused"
|
||||||
|
bug.operating_system = &"Unused"
|
||||||
|
bug.severity = "Severity will go here."
|
||||||
|
bug.status = bug_in["state"]
|
||||||
|
bug.duplicate_of = -1
|
||||||
|
|
||||||
|
return bug
|
||||||
|
|||||||
@ -131,8 +131,8 @@ func __get_label_ids_for_submission_data(label_array:Array, label_group_id:int,
|
|||||||
button.remove_theme_color_override("font_color")
|
button.remove_theme_color_override("font_color")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func __submission_response(response:Variant) -> void:
|
func __submission_response(bug:BugbotBugData) -> void:
|
||||||
submitted.emit(map_name, bug_location, bug_rotation)
|
submitted.emit(bug)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
func _on_cancel_button_pressed() -> void:
|
func _on_cancel_button_pressed() -> void:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user