Skip to content

Commit

Permalink
Refs #19743: Fix topic filtering visual bugs
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Nov 3, 2023
1 parent 713f38c commit 0545df8
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 47 deletions.
103 changes: 67 additions & 36 deletions qml/DomainGraphLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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_)
{
Expand All @@ -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")
{
Expand All @@ -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)
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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
{
Expand All @@ -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)
}
}

Expand Down
29 changes: 18 additions & 11 deletions qml/TabLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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<stack_layout.count; i++)
for (var i = 0; i<tabLayout.tab_model_.length; i++)
{
if (stack_layout.children[i].stack_id == tabLayout.tab_model_[current_]["stack_id"] &&
stack_layout.children[i].currentItem.entity_id > 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<stack_layout.count; j++)
{
if (stack_layout.children[j].stack_id == tabLayout.tab_model_[i]["stack_id"] &&
stack_layout.children[j].currentItem.entity_id > 0)
{
controller.domain_click(stack_layout.children[j].currentItem.entity_id)
break;
}
}
break // exit loop
}
}
}
Expand Down

0 comments on commit 0545df8

Please sign in to comment.