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

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

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
@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

#2701 Bundle Size — 11MiB (+0.21%).

f8276e8(current) vs 7ef5b6f main#2698(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 2 regressions
                 Current
#2701
     Baseline
#2698
Regression  Initial JS 1.9MiB(+0.05%) 1.9MiB
No change  Initial CSS 577.21KiB 577.21KiB
Change  Cache Invalidation 20.3% 17.51%
No change  Chunks 227 227
No change  Assets 250 250
Change  Modules 2956(+0.17%) 2951
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 2 changes Regression 2 regressions
                 Current
#2701
     Baseline
#2698
Regression  JS 9.21MiB (+0.24%) 9.19MiB
Regression  CSS 867.72KiB (+0.08%) 867.02KiB
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: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.

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
@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.

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
@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
Regression from openhab#2904.
Reported in openhab#2970 (comment).

Signed-off-by: Florian Hotze <dev@florianhotze.com>
@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.

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
@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
Regression from #2904.
Reported in #2970 (comment).

Signed-off-by: Florian Hotze <dev@florianhotze.com>
@florian-h05 florian-h05 removed their request for review January 13, 2025 12:29
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
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
Development

Successfully merging this pull request may close these issues.

4 participants