From 0545df868b5b12d88a0ed2872261b6b4d3b81e0c Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Fri, 3 Nov 2023 10:31:41 +0100 Subject: [PATCH] Refs #19743: Fix topic filtering visual bugs Signed-off-by: JesusPoderoso --- qml/DomainGraphLayout.qml | 103 +++++++++++++++++++++++++------------- qml/TabLayout.qml | 29 +++++++---- 2 files changed, 85 insertions(+), 47 deletions(-) diff --git a/qml/DomainGraphLayout.qml b/qml/DomainGraphLayout.qml index bbb27a41..41907187 100644 --- a/qml/DomainGraphLayout.qml +++ b/qml/DomainGraphLayout.qml @@ -32,7 +32,7 @@ Item required property string component_id // mandatory to be included when object created // Public signals - signal update_tab_name(string new_name) // Update tab name based on selected domain id + signal update_tab_name(string new_name, string stack_id) // Update tab name based on selected domain id signal openEntitiesMenu(string domainEntityId, string entityId, string currentAlias, string entityKind) signal openTopicMenu(string domainEntityId, string domainId, string entityId, string currentAlias, string entityKind) @@ -1260,7 +1260,7 @@ Item Timer { id: safety_timer interval: 200; running: false - onTriggered: { if (interval < 500) interval = 500; load_model() } + onTriggered: { interval += 200; load_model() } } function stop_timer() { safety_timer.stop() } // Obtain given domain id graph JSON model @@ -1332,7 +1332,7 @@ Item } } var accum_y = 0 - var temp_y = 0 + var host_temp_y = 0 for (var host in new_model["hosts"]) { var discard_host = true @@ -1341,22 +1341,28 @@ Item { accum_y += label_height_ + elements_spacing_ var new_users = [] + var user_temp_y = accum_y for (var user in new_model["hosts"][host]["users"]) { + var discard_user = true var metatraffic_ = new_model["hosts"][host]["users"][user]["metatraffic"] if (metatraffic_ != true || is_metatraffic_visible_) { accum_y += label_height_ + elements_spacing_ var new_processes = [] + var process_temp_y = accum_y for (var process in new_model["hosts"][host]["users"][user]["processes"]) { + var discard_process = true var metatraffic_ = new_model["hosts"][host]["users"][user]["processes"][process]["metatraffic"] if (metatraffic_ != true || is_metatraffic_visible_) { accum_y += label_height_ + elements_spacing_ var new_participants = [] + var participant_temp_y = accum_y for (var participant in new_model["hosts"][host]["users"][user]["processes"][process]["participants"]) { + var discard_participant = true var metatraffic_ = new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["metatraffic"] if (metatraffic_ != true || is_metatraffic_visible_) { @@ -1370,7 +1376,7 @@ Item if ((!filtered_topics_.length) || (filtered_topics_.length > 0 && filtered_topics_.includes(new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["endpoints"][endpoint]["topic"]))) { - discard_host = false + discard_participant = false; discard_process = false; discard_user = false; discard_host = false var kind = "DataWriter" if (new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["endpoints"][endpoint]["kind"] == "datareader") { @@ -1384,42 +1390,66 @@ Item "topic":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["endpoints"][endpoint]["topic"], "accum_y":accum_y } + accum_y += endpoint_height_ + elements_spacing_ + pending_endpoints_[pending_endpoints_.length] = endpoint } - accum_y += endpoint_height_ + elements_spacing_ - pending_endpoints_[pending_endpoints_.length] = endpoint } } - new_participants[new_participants.length] = { - "id":participant, - "kind": "DomainParticipant", - "alias":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["alias"], - "status":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["status"], - "app_id":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["app_id"], - "app_metadata":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["app_metadata"], - "endpoints":new_endpoints + if (!discard_participant) + { + new_participants[new_participants.length] = { + "id":participant, + "kind": "DomainParticipant", + "alias":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["alias"], + "status":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["status"], + "app_id":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["app_id"], + "app_metadata":new_model["hosts"][host]["users"][user]["processes"][process]["participants"][participant]["app_metadata"], + "endpoints":new_endpoints + } + accum_y += elements_spacing_ + participant_temp_y = accum_y + } + else + { + accum_y = participant_temp_y } - accum_y += elements_spacing_ } } - new_processes[new_processes.length] = { - "id":process, - "kind":"Process", - "alias":new_model["hosts"][host]["users"][user]["processes"][process]["alias"], - "pid": new_model["hosts"][host]["users"][user]["processes"][process]["pid"], - "status":new_model["hosts"][host]["users"][user]["processes"][process]["status"], - "participants":new_participants + if (!discard_process) + { + new_processes[new_processes.length] = { + "id":process, + "kind":"Process", + "alias":new_model["hosts"][host]["users"][user]["processes"][process]["alias"], + "pid": new_model["hosts"][host]["users"][user]["processes"][process]["pid"], + "status":new_model["hosts"][host]["users"][user]["processes"][process]["status"], + "participants":new_participants + } + accum_y += elements_spacing_ + process_temp_y = accum_y + } + else + { + accum_y = process_temp_y } - accum_y += elements_spacing_ } } - new_users[new_users.length] = { - "id":user, - "kind": "User", - "alias":new_model["hosts"][host]["users"][user]["alias"], - "status":new_model["hosts"][host]["users"][user]["status"], - "processes":new_processes + if (!discard_user) + { + new_users[new_users.length] = { + "id":user, + "kind": "User", + "alias":new_model["hosts"][host]["users"][user]["alias"], + "status":new_model["hosts"][host]["users"][user]["status"], + "processes":new_processes + } + accum_y += elements_spacing_ + user_temp_y = accum_y + } + else + { + accum_y = user_temp_y } - accum_y += elements_spacing_ } } if (!discard_host) @@ -1432,10 +1462,11 @@ Item "users":new_users } accum_y += elements_spacing_ - temp_y = accum_y + host_temp_y = accum_y } - else { - accum_y = temp_y + else + { + accum_y = host_temp_y } } @@ -1477,7 +1508,7 @@ Item { if (filtered_topics_.length == 1) { - domainGraphLayout.update_tab_name(topic_names[0] + " Topic View") + domainGraphLayout.update_tab_name(topic_names[0] + " Topic View", component_id) } else { @@ -1491,12 +1522,12 @@ Item print_topic_names += " and " + topic_names[topic_names.length-1] } - domainGraphLayout.update_tab_name(print_topic_names + " Topics View") + domainGraphLayout.update_tab_name(print_topic_names + " Topics View", component_id) } } else { - domainGraphLayout.update_tab_name("Domain " + domain_id + " View") + domainGraphLayout.update_tab_name("Domain " + domain_id + " View", component_id) } } diff --git a/qml/TabLayout.qml b/qml/TabLayout.qml index a95f64a7..942715bf 100644 --- a/qml/TabLayout.qml +++ b/qml/TabLayout.qml @@ -210,19 +210,26 @@ Item { component_id: stack.stack_id onUpdate_tab_name: { - tabLayout.tab_model_[current_]["title"] = new_name - - // update model to set the visual change - tab_list.model = tabLayout.tab_model_ - - // update left panel information - for (var i=0; i 0) + if (tabLayout.tab_model_[i]["stack_id"] == stack_id) { - controller.domain_click(stack_layout.children[i].currentItem.entity_id) - break; + tabLayout.tab_model_[i]["title"] = new_name + + // update model to set the visual change + tab_list.model = tabLayout.tab_model_ + + // update left panel information + for (var j=0; j 0) + { + controller.domain_click(stack_layout.children[j].currentItem.entity_id) + break; + } + } + break // exit loop } } }