-
-
Notifications
You must be signed in to change notification settings - Fork 422
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 feature to sort group members with metadata configuration #2553
base: main
Are you sure you want to change the base?
Add feature to sort group members with metadata configuration #2553
Conversation
7e9944b
to
d3b1a53
Compare
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
d3b1a53
to
4748644
Compare
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.
Code looks good to me in general and the feature might be useful.
Before merging, I'd like to see a comment from @ghys as you had pinged him specifically as well on whether this fits for the UI to support it or whether some tweaks are desired.
Thanks for looking into this. From my POV we at least need to tweak the REST API to make use of this feature or add a special method for retrieving sorted groups / member of groups. |
The UI has its own sorting function which will consider the index put in the |
The feature to order based on Would it make sense to add an |
Holy cow, there's been a lot of stuff going on on GitHub I've simply missed. Playing catchup. All I have to add is this is something that has been asked for many times by sitemap users. I could see it potentially being useful in rules too, though there are already ways to sort members of a Group there. I can't comment on MainUI concerns. |
@cweitkamp What is the status here? Judging from your last comment I assume there's still work to do before we can merge? |
@cweitkamp Are you still around and could comment on the status here? |
See #2123 (comment)
This is an initial draft on sorting group members with metadata configuration. Items in groups can be sorted by name, label or state. Default ordering is ascending.
demo.items
Allowed values for
sortBy
:LABEL
,NAME
andSTATE
.Allowed values for
ordering
:DESCENDING
, otherwise ascending ordering will be used. Configuration ofordering
is optional.Sort members by state picks up a
Comparator
from items, which can be implemented individually for each item type.Item
class provides a defaultComparator
to sort states in alphabetically order by applyingtoFullString()
on the state first.UIs and other services have to be changed afterwards to benefit from this feature.
@openhab/core-maintainers wdyt?
// CC @ghys @rkoshak
Signed-off-by: Christoph Weitkamp github@christophweitkamp.de