-
Notifications
You must be signed in to change notification settings - Fork 337
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
Add groups #2826
Add groups #2826
Conversation
This was caused by the huge number of MODIFIED events, each refreshing only one thing at a time. A new LAYOUT_MODIFIED event was added which on the client side simply refreshes all things
Pretty cool! I would definitely benefit from this approach. My things page has gotten pretty crowded (52 things), and several of the things that I don't interact with (scenes, notifiers, schedulers, and more) would be nice to drop into a low-level directory. |
@bewee
Absolutely! |
Hi @bewee, Thank you very much for this contribution and for the significant effort you've put into implementing it. The UI is very cool. I'd like to follow-up with some visual CSS tweaks, but that's a minor issue. You may have noticed that there has been some previous discussion about grouping things in #1191, including some alternative approaches. My main feedback is about the term "directory", and the fact that (if I have understood correctly) a Thing can only belong to a single directory. This is in contrast with other proposals like "groups" or "tags" which may allow things to belong to multiple groups. The Web Thing API exposed by the gateway is currently in the process of standardisation at the W3C (the REST API as a "Core Profile" and the WebSocket API as the "Web Thing Protocol"). In the W3C specifications the term "directory" will soon have a special meaning, with the definition of a Directory Service API for exposing a collection of Things (like your /directories API endpoint) and a Thing Description for describing directories (like your directory descriptions). The (work in process) W3C Directory Service API doesn't have exactly the same purpose as the directories feature you have implemented here, as it's not really designed for a gateway to have multiple directories, but rather to act as a single directory which can be filtered/queried using JSONPath/XPath/SPARQL. However, I have recently proposed an alternative approach which could allow for multiple directories. I suppose you could theoretically use the W3C's current approach for multiple directories by providing a Thing Description and API endpoint for each, but it's not really designed to be used that way. My concern with the API implementation in this PR is that if and when we come to implement the W3C Directory Service API, this is going to get confusing. Therefore I can see two possible paths forward for this feature:
Number 1 would be cool, but number 2 would likely be easier and quicker to land. |
Hi @benfrancis,
Alright, if you describe those I could try fixing them. But I guess it may be simpler if you just do these changes by yourself?😅
Oops, actually I didn't. I think I only searched the issues for the keywords "directory", "folder" and "category". From my personal understanding, "groups" should probably rather group similar devices in order to control them together. #1191 (comment) mentions doing this using an add-on, which I think is a feasible idea (since with this suggestion, you could now move all the grouped things into one directory that you almost never have to touch again) and only keep the group device up on top. Thoughts?
I do like this idea, however I have no clue how feasible it is. I will have a look at the spec you linked, but as you already say that it's not really meant to be used that way, I have the feeling that it may be a bad idea to force this suggestion into the W3C API?
Just want to also propose renaming it to "categories" (that's the second choice I had in mind when building this, but unfortunately I decided in favour of directories🙈) |
Oh, and one more thing that I think would be pretty cool is adding directories (or categories or groups or whatsoever) to the "Generate local authorization" screen + permission system. But I did not yet have a look at how complex this would become |
@bewee wrote:
That's fine, I don't want to hold up your PR on visual design nits.
I agree, having things belonging to multiple groups doesn't really fit your current UI and API design. In some ways it would be a shame to lose that, because I like how simple the UI is.
This smells like a workaround for some unfulfilled requirements we should be solving in a different way. If we design the system well, there shouldn't be a need for "dummy things" that you need to hide from view. It would be helpful if you could (in a separate issue) explain the reasons that you currently have dummy things, and maybe we can find better solutions to those problems.
For the same reasons, I don't really think this is a great solution. A dummy thing acting as a placeholder for a group of other things is just another workaround.
I agree. This isn't really an intended use case for that API and those discussions are already complicated enough!
I agree the name "directories" is a better name than "categories", since they can be used for lots of different use cases like grouping devices by room, device type, owner etc. It just conflicts at the API level with the concept of the gateway as one big directory of devices as being defined at the W3C. The conclusion from #1191 seemed to be that "groups" was a good generic term which covers all of these use cases. If you wanted to experiment with an alternative implementation that allows devices to belong to multiple groups then that would be cool, but I'd also be fine with landing this feature with the limitation of things only being allowed to belong to one group in order to keep the UI simple. If someone then wants to expand that to allow more complex groupings then they can either:
What do you think? |
Hi @benfrancis,
I have absolutely no problem with the name "groups", just wanted to bring up another alternative :) I can do the renaming to "groups" soon and update this PR (from now on, I will just call this feature "groups" and reference to the feature described in #1191 as "tags")
See #2828
I somewhat disagree here. My private workaround right now is to have a virtual thing "Main Light Controller" which (programmed via Node-RED add-on, but similar things can be done using the rules engine) forwards to the four lights in my room. I find it extremely convenient to be able to control all my stuff at once (what i mostly do), but to still have the "original things" laying around somewhere down in a folder when I need them. And tbh I really like the simplicity of this approach, interacting with multiple devices through one thing that lays directly on my gateway's home page (and not in one more submenu or something). Setting this up, as well as adding another light to the main controller, is a bit of a pain. And I believe that an integrated tags feature, just as well as an add-on adapter, would be an extremely great way to make such a setup simpler. I would prefer the build-in variant because I believe that it would be way more user-friendly (with an adapter add-on, you most likely would have to deal with inserting some stuff into the add-on config). What I would mainly like to plead for is implementing tags to be part of the things view, to look like (or really similar to) a thing and to be controlled like a thing (in short, no new UI one has to get used to). So to sum things up and answer your question: I think that groups (a means of bringing some structure into the big bunch of things) are a fundamentally different feature than tags (a means of controlling similar devices all at once). So I would prefer to land this feature the way it is, with one thing only being allowed in at most one group at once. But when I find some time, I would love to have another look at the tags feature as I just tried to describe it :) |
My 2 cents: It seems Bewee just wanted a quick way to organise the things overview page. The gateway-wide grouping feature (#1191), which could be foundational for all kinds of functionaity, seems to be me to be a different kettle of fish. A much bigger kettle. With that in mind, that big future functionality might need to be called 'groups'. So why not call this PR's structure something that reflects the "a thing can only placed in one" nature. If it's just a small upgrade of the things overview page, then directory or "folder" makes sense to me. |
Is there anything else I can do for now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was a bit busy.
Looks good to me 😄
Looks like you need to run prettier 😅 |
So, what do we want to do now concerning naming? |
Looks like I need to approve every build o.O
I'm fine with |
On my local machine, there are 15 more failing tests from 3 test suites, most of them with error Also, should I write some additional tests for the groups feature? If so, how extensive should the tests be? |
Could we give the build another try? The mentioned failing tests may have only been a problem with my machine... |
Sure^^ |
Codecov Report
@@ Coverage Diff @@
## master #2826 +/- ##
==========================================
- Coverage 66.52% 65.01% -1.52%
==========================================
Files 121 124 +3
Lines 7615 7938 +323
Branches 1289 1314 +25
==========================================
+ Hits 5066 5161 +95
- Misses 2506 2735 +229
+ Partials 43 42 -1
Continue to review full report at Codecov.
|
The integration tests often fail without any obvious reason.
Normally I would say absolutely but I don't want you to suffer from integration test nightmares. |
I'd wish I could simply release it now. |
This proposes adding directories as a means of grouping things. Directories get placed below things. You can drag a thing into a directory or remove it from its current directory. You can add (through the "+" screen) and delete directories and change the order among them. You can also open or close each directory, and which directories are open gets cached on the current device.
On the way, I also reworked the layout indexing mechanism so that things no longer "flicker" after being dropped (this was especially annoying when e.g. dragging the last thing to the first position, or when your Internet connection was slow, or even both).
I know that translations as well as a feature for renaming directories are still missing, and I would add these in case you like the general idea of having directories. Some stuff may still be a little rough or maybe sort of "not-the-way-the-gateway-does-it". In this case particularly, but concerning everything else as well of course, I would really appreciate any feedback :)