Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic hierarchy follow up #4818

Merged
merged 14 commits into from
Dec 3, 2024
Merged

Topic hierarchy follow up #4818

merged 14 commits into from
Dec 3, 2024

Conversation

cstns
Copy link
Contributor

@cstns cstns commented Nov 22, 2024

Description

  • restructured hierarchy computed prop to extend functionality
  • remember open state for each topic segment
  • alter topic count to include deeply nested topics not just immediate children
  • add the ability to copy topic path

Related Issue(s)

closes #4801
closes #4802
also implemented a topic open state management mentioned in the main PR as a comment

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

- restructured hierarchy computed prop to extend functionality
- remember open state for each topic segment
- alter topic count to include deeply nested topics not just immediate children
- add the ability to copy topic path
@cstns cstns self-assigned this Nov 22, 2024
@cstns cstns requested review from Steve-Mcl and knolleary November 22, 2024 11:29
@cstns cstns mentioned this pull request Nov 22, 2024
10 tasks
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.70%. Comparing base (ac51a56) to head (e925f84).
Report is 24 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4818   +/-   ##
=======================================
  Coverage   78.70%   78.70%           
=======================================
  Files         316      316           
  Lines       15152    15152           
  Branches     3486     3486           
=======================================
  Hits        11925    11925           
  Misses       3227     3227           
Flag Coverage Δ
backend 78.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Serban, the topic count at the fully collapsed level is 8 in this screenshot but it is not reflective of the actual number of topics. You are counting the number of topics + the number of levels.

Let me try to clarify:
There really only is 5 topics:

  • another-long-topic with spaces and Not-well-formed/at/all/really/test1
  • another-long-topic with spaces and Not-well-formed/at/all/really/test2
  • another-long-topic with spaces and Not-well-formed/at/all/really/test3
  • another-long-topic with spaces and Not-well-formed/at/all/really/test6
  • another-long-topic with spaces and Not-well-formed/at/all/really/test8
    ... but your tree is counting nesting levels as additional topics

In MQTT Explorer, this is clearer as they only show the count on the immediate parent:

MQTT_Explorer_NJ4OM0GqiH

@cstns
Copy link
Contributor Author

cstns commented Nov 25, 2024

Altered the counting method to only consider terminating segments/children

This implies that a response of

'foo/bar',
'foo/bar/paz',
'foo/bar/baz',
'foo/bar/asd',
'foo/faz',
'foo/taz'

will yield
image

Not 100% sure if the initial foo/bar should be counted off as a terminating segment as it has nested topics. @hardillb please advise

@hardillb
Copy link
Contributor

Yes if foo/bar has a message

@cstns
Copy link
Contributor Author

cstns commented Nov 25, 2024

In this case, the UI would need some tweaking to let users know that foo/bar is a standalone topic otherwise it would seem that the counter is glitching

@joepavitt I'd appreciate your input on the UI side

@cstns
Copy link
Contributor Author

cstns commented Nov 25, 2024

@hardillb would something along these lines be suggestive enough?

image

@Steve-Mcl
Copy link
Contributor

@hardillb would something along these lines be suggestive enough?

image

Cant we just lose the slashes in the visualisation (obviously they are still required to make a valid topic in the copy data) and where there is an empty topic, perhaps a grey (empty) placeholder would be better?

Also. that count of 7 doesn't look right? What were the underlying topics that built that out?

@hardillb
Copy link
Contributor

hardillb commented Nov 25, 2024

Removing the slashes works, but would still need a way to indicate mid topic message.

The video from Steve has access to the last message value which helps, but we don't have that.

How about not adding the extra entry (with the bare /) but adding a * to the actual row in the tree

e.g.

foo 
      | - bar *
              | - asd
              | - baz
              | - paz 

@cstns
Copy link
Contributor Author

cstns commented Nov 26, 2024

Also. that count of 7 doesn't look right? What were the underlying topics that built that out?

These were just some images I took of the hierarchy after manipulating the dom to figure out a way to represent the different states the counter can be ignored for the moment until we decide on how we represent the data.

Cant we just lose the slashes in the visualisation (obviously they are still required to make a valid topic in the copy data) and where there is an empty topic, perhaps a grey (empty) placeholder would be better?

How about not adding the extra entry (with the bare /) but adding a * to the actual row in the tree

This would be a iteration with empty placeholders and * to represent mid topic endpoints (maybe also putting a title on the * with helper text to make it more suggestive)

image
generated from the following payload:

[
    '/flim/flam', // empty start segment
    'bork//spork', // empty middle segment
    'blim/bizzle/squark/blurp',
    'blim/bizzle/squark/florp/', // empty end segment
    'foo/bar', // middle terminating segment with nested topics
    'foo/bar/paz',
    'foo/bar/baz',
    'foo/bar/asd',
    'foo/faz',
    'foo/taz'
]

I think the ^ payload includes all possible use cases

@Steve-Mcl
Copy link
Contributor

A * is a valid character in a topic so presenting it where one does not exist feels wrong.

Also, I really think we should not show the topic separators / - they are implied by the tree structure. This is how the very popular MQTT explorer does it and deviation from that may cause confusion.

@cstns
Copy link
Contributor Author

cstns commented Nov 27, 2024

This is the latest iteration:
image

  • removed slashes from topic headers (except empty terminating topics - see florp)
  • counters reflect the topics count (including terminating topics which are included in the parent count not on itself - see foo which includes bar, which is a terminating topic)
  • currently marking terminating topics with a heroicon archive icon which when hovered has a help cursor and 'This topic is also able to receive events' title which is displayed when hovered over

@cstns cstns requested review from joepavitt and hardillb November 27, 2024 15:12
@joepavitt
Copy link
Contributor

currently marking terminating topics with a heroicon archive icon which when hovered has a help cursor and 'This topic is also able to receive events' title which is displayed when hovered over

Can you explain what this means please? I'd expect every tier to be able to receive topics? The archive icon looks like a delete/remove icon

@hardillb
Copy link
Contributor

currently marking terminating topics with a heroicon archive icon which when hovered has a help cursor and 'This topic is also able to receive events' title which is displayed when hovered over

Can you explain what this means please? I'd expect every tier to be able to receive topics? The archive icon looks like a delete/remove icon

While every level can, not every level has, the marker is on the topics that have had a message published, leaving intermediate levels unmarked.

@cstns
Copy link
Contributor Author

cstns commented Nov 29, 2024

From what I can tell not all topics have messages. If i have a topic response with the following form:

[
   'acme/foo', 
    'acme/foo/bar/paz',
    'acme/foo/bar/baz',
]

only the terminating foo, paz and baz topics hold messages while acme and bar don't.

We don't display topic messages like MQTT Explorer does so we'd need a way to demarcate what topics hold or don't hold messages. While terminating topics are self explanatory that they have messages, topics like foo are not represented/demarcated accordingly in our interface.

MQTT Explorer displays the last received message even on middle topics and for all terminating topics so you can differentiate between topic segments that are holding messages.

Another representation solution that was mentioned was to mark middle topics with {...} or we could go with another hero-icon.

@knolleary
Copy link
Member

Herewith my opinions. In summary, lets keep things simple. Lets not worry about markers in the topic hierachy where messages are published or not. We can revisit that if/when we consider enabling a live view of content.

Empty topic at the start

image

At the top level, rather than (empty), lets display it as /flim - ie, show the leading / (which we otherwise don't show).

Topic counts

Lets just use the count of nodes in the graph below the level - regardless of leaf/edge/message/no-message etc.

So given

[
   'acme/foo', 
    'acme/foo/bar/paz',
    'acme/foo/bar/baz',
]
  • acme will display a count of 4
  • acme/foo will show 3
  • acme/foo/bar will show 2

@joepavitt
Copy link
Contributor

Agree with everything @knolleary has said

@cstns
Copy link
Contributor Author

cstns commented Nov 29, 2024

At the top level, rather than (empty), lets display it as /flim - ie, show the leading / (which we otherwise don't show).

The problem with this is that '/' or '(empty)' as we represent it is a valid root topic.

As for the counter and not demarcating segments with messages, I can go wherever which way you decide.

@cstns
Copy link
Contributor Author

cstns commented Nov 29, 2024

The problem with this is that '/' or '(empty)' as we represent it is a valid root topic.

missed the leading slash in /flim.

Ok then, I'll adjust accordingly!

Copy link
Member

@knolleary knolleary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cstns super close, but one case not quite working as expected.

If I publish to top/a/b - then it correctly shows me top at the top level:

image

If I then publish to /top/c/d - it then only shows /top at the top level, and the topics under top have now been placed under it:

image

In this scenario, I'd expect to see separate top-level entries for top and /top

…w-up

# Conflicts:
#	frontend/src/pages/team/UNS/Hierarchy/components/TopicSegment.vue
@cstns cstns requested a review from knolleary December 3, 2024 14:54
@cstns
Copy link
Contributor Author

cstns commented Dec 3, 2024

should be fixed now, I don't know how i missed it 😅

Copy link
Member

@knolleary knolleary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@knolleary knolleary merged commit cd97da9 into main Dec 3, 2024
13 checks passed
@knolleary knolleary deleted the topic-hierarchy-follow-up branch December 3, 2024 16:26
@knolleary knolleary linked an issue Dec 4, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants