Skip to content

Main UI: Visualize semantic model tree in item details screen #3227

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

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

mherwege
Copy link
Contributor

@mherwege mherwege commented Jun 12, 2025

Closes #3217

This is not ready for merging as it heavily relies on #3165, #3178 and #3223. All the code from these PR's is included in this one, so it is fully functional. It should be rebased once the other PR's have been reviewed.

This PR extends the item details screen to show part of the model the item is in, from the top, down to all its children. The tree is opened up to the level of the item. Clicking on a level in the tree, will take you to the related item.

With this PR, the terminology discussion from #3211 becomes less critical as the terminology is replaced by a graphical representation of the model with all information in it.

Below is how it looks like.

Note the Parent Group and Child Group sections will contain all semantic and non-semantic direct parent and child groups.

image

A concern may be this is introducing a load of the full model for each item. The REST API call only retrieves static data, therefore I believe it is cached and should not continuously pass the full payload over the network. In my tests with over 1000 items, I didn't see a strong negative performance impact, but it may depend on the system. An improvement could be to move the filtering to OH core with an extra REST parameter. However, this will also make caching less relevant.

@mherwege mherwege marked this pull request as draft June 12, 2025 13:00
Copy link

relativeci bot commented Jun 12, 2025

#3232 Bundle Size — 11.33MiB (+0.39%).

aefbbf3(current) vs 204ca25 main#3231(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 7 changes Regression 2 regressions
                 Current
#3232
     Baseline
#3231
Regression  Initial JS 2.01MiB(+0.03%) 2.01MiB
No change  Initial CSS 577.53KiB 577.53KiB
Change  Cache Invalidation 21.13% 17.81%
Change  Chunks 253(+0.8%) 251
Change  Assets 276(+0.73%) 274
Change  Modules 3019(+0.84%) 2994
Regression  Duplicate Modules 157(+6.08%) 148
Change  Duplicate Code 1.73%(+2.37%) 1.69%
No change  Packages 97 97
No change  Duplicate Packages 2 2
Bundle size by type  Change 2 changes Regression 2 regressions
                 Current
#3232
     Baseline
#3231
Regression  JS 9.53MiB (+0.42%) 9.49MiB
Regression  CSS 875.53KiB (+0.52%) 871KiB
No change  Fonts 526.1KiB 526.1KiB
No change  Media 295.6KiB 295.6KiB
No change  IMG 140.74KiB 140.74KiB
No change  HTML 1.38KiB 1.38KiB
No change  Other 871B 871B

Bundle analysis reportBranch mherwege:sub_modelProject dashboard


Generated by RelativeCIDocumentationReport issue

@florian-h05 florian-h05 added enhancement New feature or request main ui Main UI awaiting other PR Depends on another PR labels Jun 18, 2025
mherwege added 17 commits June 19, 2025 08:29
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
@ghys
Copy link
Member

ghys commented Jun 19, 2025

A concern may be this is introducing a load of the full model for each item.

Absolutely a concern, as you've identified :)

The REST API call only retrieves static data, therefore I believe it is cached and should not continuously pass the full payload over the network. (...) In my tests with over 1000 items, I didn't see a strong negative performance impact

I'm not sure we can rely only on the fact that the data retrieved repeatedly would be cached to say "it's all okay".
Sometimes there could be proxy servers between openHAB and the client, and the cache mechanisms might be screwed up so we could have a problem.

@mherwege
Copy link
Contributor Author

I'm not sure we can rely only on the fact that the data retrieved repeatedly would be cached to say "it's all okay".
Sometimes there could be proxy servers between openHAB and the client, and the cache mechanisms might be screwed up so we could have a problem.

So what are the options then?

  1. I abandon this.
  2. I extend the REST API to return this local tree for use in this view. It does mean it will effectively return data for each item opened and caching will not have any effect.

Any other suggestions?

@ghys
Copy link
Member

ghys commented Jun 19, 2025

So what are the options then?

I abandon this.

Please don't ragequit, it's a good feature, I just struggle how to implement it correctly :)

I have understood recently that you can't rely on client caches only.

I extend the REST API to return this local tree for use in this view. It does mean it will effectively return data for each item opened and caching will not have any effect.

It could work but it's a very specific API, will it have an use outside of that screen?

@mherwege
Copy link
Contributor Author

Please don't ragequit, it's a good feature, I just struggle how to implement it correctly :)

That’s not at all what I meant. I am much less experienced then you though, and I don’t see an easy solution.

It could work but it's a very specific API, will it have an use outside of that screen?

There actually already is a very specific one I believe is mostly there for this screen: get all children (recursive), including the dynamic data. It could be extended to get the parents as well. I was already looking into that, also because there still is a mismatch. On the item screen, the direct children have a state (from that API), but not the parents. I get these trough the model static data request, so without state.

Signed-off-by: Mark Herwege <[email protected]>
@mherwege
Copy link
Contributor Author

@ghys With the last commit, I now use an adjusted REST API to only retrieve the item model information. Therefore this requires openhab/openhab-core#4861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting other PR Depends on another PR enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show the full semantic hierarchy on Item's page
3 participants