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

add rulesWithTags to oh-repeater #1724

Merged
merged 4 commits into from Feb 21, 2023
Merged

Conversation

stefan-hoehn
Copy link
Contributor

fixes #1721 Add Scenes option to oh-repeater component

This PR adds the possibility to iterate over a list of rules queried via a tag.

For example it allows to create a list of Scenes via the oh-repeater by using the rulesTag = Scene and trigger the rule via a oh-button.

Example

slots:
  default:
    - component: oh-list
      slots:
        default:
          - component: oh-repeater
            config:
              for: scene
              sourceType: rulesWithTags
              ruleTags: Scene
            slots:
              default:
                - component: oh-button
                  config:
                    action: rule
                    actionRule: =loop.scene.uid
                    text: =loop.scene.name

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@stefan-hoehn stefan-hoehn requested a review from a team as a code owner February 19, 2023 12:34
@relativeci
Copy link

relativeci bot commented Feb 19, 2023

Job #788: Bundle Size — 16.25MiB (~+0.01%).

8101f10(current) vs 397887d main#787(baseline)

⚠️ Bundle contains 16 duplicate packages

Metrics (1 change)
                 Current
Job #788
     Baseline
Job #787
Initial JS 1.86MiB(+0.03%) 1.86MiB
Initial CSS 608.52KiB 608.52KiB
Cache Invalidation 90.64% 90.64%
Chunks 218 218
Assets 688 688
Modules 2020 2020
Duplicate Modules 108 108
Duplicate Code 1.74% 1.74%
Packages 138 138
Duplicate Packages 15 15
Total size by type (2 changes)
                 Current
Job #788
     Baseline
Job #787
CSS 857.79KiB 857.79KiB
Fonts 1.08MiB 1.08MiB
HTML 1.23KiB 1.23KiB
IMG 140.74KiB 140.74KiB
JS 9.19MiB (~+0.01%) 9.19MiB
Media 295.6KiB 295.6KiB
Other 4.71MiB (~+0.01%) 4.71MiB

View job #788 reportView main branch activity

Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM, please have a look at my comments.

We should also keep in mind that this approach works fine if you are logged in as an admin user, but if you are logged out or only logged in as a regular user, this won't work because the /rest/rules endpoint requires admin role.
We therefore need some way to access the scenes as unauthorized user, just as we can access the Items. This should be reported and discussed in openHAB core, because we need unauthorized access to scene rules.

I'd expect that we then have to adjust the REST endpoint, so I'd probably wait with merging this. IMO there is no value yet for the most users because they normally shouldn't be logged in as admin.

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@hmerk
Copy link

hmerk commented Feb 20, 2023

This should be reported and discussed in openHAB core, because we need unauthorized access to scene rules.

Issue opened
openhab/openhab-core#3390

Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment, and please fix the linting npm run lint:fix.
If this is done, we are ready to merge this.

@hmerk
Copy link

hmerk commented Feb 20, 2023

Core PR created by @J-N-K
openhab/openhab-core#3392

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
@ghys
Copy link
Member

ghys commented Feb 21, 2023

Let's wait for openhab/openhab-core#3392 before merging.

@hmerk
Copy link

hmerk commented Feb 21, 2023

Let's wait for openhab/openhab-core#3392 before merging.

It was merged just now 😉

@ghys ghys merged commit b3ca6b2 into openhab:main Feb 21, 2023
@ghys ghys added enhancement New feature or request main ui Main UI labels Feb 21, 2023
@ghys ghys added this to the 4.0 milestone Feb 21, 2023
@hmerk
Copy link

hmerk commented Feb 21, 2023

@stefan-hoehn @ghys @florian-h05 @J-N-K @kaikreuzer
Thanks to all of you for this joint effort.
I think that having the scene editor and the option to use it with the oh-repeater is a great new feature for openHAB 4 👍

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.

Add Scenes option to oh-repeater component
4 participants