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

Model editor: Drag and drop #2970

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

mherwege
Copy link
Contributor

@mherwege mherwege commented Jan 3, 2025

Closes #2728
Closes #969

Allow drag and drop in the model view:

  1. Drag and drop inside the semantic model
  2. Move items into the semantic model
  3. Move between non-semantic groups (and duplicate)
  4. Ask for creation of location, equipment or point if item does not have a semantic class yet when moving into the semantic model

This PR requires further testing, but I do want to already provide it for others to start evaluating, as there is a fair amount of change. I probably have missed some boundary cases of changes in the model that are or are not possible.

Edit: I have tested this on different devices, and from my perspective, it works well. But again, I may have missed something. Therefore I would appreciate others to test.
I have put extensive debug logging into the code to be able to debug potential issues.

Here are a few gifs of what it looks like:

ModelMove1

ModelMove2

@mherwege mherwege changed the title [mainUI] Model drag and drop Model editor: Drag and drop Jan 3, 2025
@digitaldan
Copy link
Contributor

That's super cool.

Copy link

relativeci bot commented Jan 3, 2025

#2824 Bundle Size — 11.01MiB (+0.21%).

aa5cae7(current) vs 1c84a5b main#2821(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 2 regressions
                 Current
#2824
     Baseline
#2821
Regression  Initial JS 1.9MiB(+0.05%) 1.9MiB
No change  Initial CSS 577.29KiB 577.29KiB
Change  Cache Invalidation 20.31% 17.32%
No change  Chunks 227 227
No change  Assets 250 250
Change  Modules 2957(+0.17%) 2952
Regression  Duplicate Modules 158(+2.6%) 154
Change  Duplicate Code 1.84%(+2.22%) 1.8%
No change  Packages 98 98
No change  Duplicate Packages 2 2
Bundle size by type  Change 7 changes Regression 7 regressions
                 Current
#2824
     Baseline
#2821
Regression  JS 9.22MiB (+100%) undefined
Regression  CSS 868.11KiB (+100%) undefined
Regression  Fonts 526.1KiB (+100%) undefined
Regression  Media 295.6KiB (+100%) undefined
Regression  IMG 140.74KiB (+100%) undefined
Regression  HTML 1.38KiB (+100%) undefined
Regression  Other 871B (+100%) undefined

Bundle analysis reportBranch mherwege:model_drag_dropProject dashboard


Generated by RelativeCIDocumentationReport issue

@ghys
Copy link
Member

ghys commented Jan 3, 2025

Indeed and I can't imagine openHAB 5 without it :)

@ghys
Copy link
Member

ghys commented Jan 3, 2025

First comment from watching the GIFs alone would be to make sure there's a confirm message for every drag and drop as it might be too easy to screw up and make an involuntary change. This could be an additional dialog or a Cancel button to the existing ones - like the one asking whether to add an Equipment or a Point.

@mherwege
Copy link
Contributor Author

mherwege commented Jan 4, 2025

First comment from watching the GIFs alone would be to make sure there's a confirm message for every drag and drop as it might be too easy to screw up and make an involuntary change. This could be an additional dialog or a Cancel button to the existing ones - like the one asking whether to add an Equipment or a Point.

I have added some confirmation dialogs.

@mherwege
Copy link
Contributor Author

mherwege commented Jan 6, 2025

From my perspective, this is ready for review and testing by others.

@florian-h05 florian-h05 added enhancement New feature or request main ui Main UI labels Jan 7, 2025
@florian-h05
Copy link
Contributor

@ghys Do you want to review?

@ghys
Copy link
Member

ghys commented Jan 8, 2025

@florian-h05 yeah if you don't mind, this is personal for me (like the log viewer) since I always wanted to do it but never got around to it. So I'm glad it got implemented by @mherwege and I'll take care of this one and get it done.
I think you have plenty on your plate already :)

@ghys
Copy link
Member

ghys commented Jan 12, 2025

@mherwege I'm testing it and unfortunately I do have a major remark which IMO is a must fix...

The tree view now adds arrows/chevrons besides items even if they don't have children, it's super confusing:

Before:
image

After:
image

This leads to unnecessary clicks on them because you'd think there's something to expand when there's not.

Actually it's the case for the sitemap tree view now too (I missed it).

I think it should be fixed because it leads to confusion for example:

image

Since the Text widget here is an "expanded empty group" we could easily think the Switch is one of its children, when it's actually on the same level as a child of the Frame.

image

It is possible to at least show those after you've started the drag operation only (so you can insert into an empty group)?

florian-h05 added a commit to florian-h05/openhab-webui that referenced this pull request Jan 12, 2025
@florian-h05
Copy link
Contributor

Actually it's the case for the sitemap tree view now too (I missed it).

Fixed in #3007.

@mherwege
Copy link
Contributor Author

@mherwege I'm testing it and unfortunately I do have a major remark which IMO is a must fix...

The tree view now adds arrows/chevrons besides items even if they don't have children, it's super confusing:

Yes, fair enough. And it looks like @florian-h05 already found a fix for it in the sitemap editor. I will look into doing something similar here, but need to find some time for doing it. It doesn't look to be a major change, so should be easy enough to include without changing everything. I don't think it should impact other review comments you may have.

@mherwege
Copy link
Contributor Author

I created a fix in this PR.

florian-h05 added a commit that referenced this pull request Jan 13, 2025
@florian-h05 florian-h05 removed their request for review January 13, 2025 12:29
@florian-h05
Copy link
Contributor

@ghys Can you please have another look at this?

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]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
4 participants