-
-
Notifications
You must be signed in to change notification settings - Fork 243
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 a persistence configuration page #1917
Conversation
To Do
|
c9f6cab
to
7890b94
Compare
Job #1045: Bundle Size — 15.84MiB (~+0.01%).Metrics (1 change)
Total size by type (2 changes)
|
Looks great. Do you think we can add configurations for filters, too (without using the code tab?) |
It should be possible, I will have a look tomorrow or in the next days. It would be great if you could provide me real examples what the REST API returns for the filters. |
|
Thanks. @J-N-K And your code snippet is ready for your PR openhab/openhab-core#3642, right? |
Any Progress here @florian-h05 ?? |
Unfortunately not yet, I was really busy and my free time went into openhab-js. I will try to finish it this weekend. |
It is accessible from the add-on settings page and has both a design and a code tab. The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and duplicate configs for the same set of Items. The code tab also allows to also specify threshold and time filters and needs minor adjustment once openhab/openhab-core#3642 is merged code completion is not provided. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This adds a complete filter configuration from the UI together with support through the YAML code tab. Filter configuration provides input validation and automatically adds required parameters if they are not set. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
- Fix config/cron strategy already existing checks. - Remove cron strategies and filters from configs when they are removed to avoid 400 Bad Request. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@J-N-K @hmerk I am finished now, all filters can be configured by UI 🎉 |
bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-edit.vue
Show resolved
Hide resolved
predefinedStrategies: ['everyChange', 'everyUpdate', 'restoreOnStartup'], | ||
filterTypes: [ | ||
{ | ||
name: 'thresholdFilters', |
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.
maybe thresholdFilter
? It's the description of a single filter. Also below.
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.
This doesn't work, because the filter type name and label are used by the UI to render the sections and determine where to read from and where to store filters. And the property on the persistence is named thresholdFilters
.
I have implemented the UI part for filters in a way, that once additional filters are added you only need to update the filterTypes definition and the code tab.
bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-edit.vue
Outdated
Show resolved
Hide resolved
bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-edit.vue
Outdated
Show resolved
Hide resolved
Co-authored-by: J-N-K <github@klug.nrw> Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@hmerk I am currently testing this and we found a few minor quirks that Florian already fixed. So, almost done and looks pretty good to me. Probably can be merged by tonight. |
eefdff3
to
06e7127
Compare
- Display a message when no filters are available. - Hide the delete button in create mode. - Pre-select everyChange as persistence strategy for new configs. - Make all code only use the filterTypes definitions and don't rely on the existence of any filter type's array. - Allow numbers and underslash for cron strategy & filter names. - Validate that lower bound is less than upper bound for includeFilters. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05 I thoroughly tested it including the latest changes - thx 4 adding my request on the validation and allowing names with _ and numbers <3 And it looks good to me from a functional perspective. |
@ghys This is finally ready for review! Let's get this into 4.0 🥳 |
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.
Probably can be merged by tonight.
What Stefan wants, Stefan gets I suppose 😉
Jokes aside I have no quirks with this code and I think it's an important feature and therefore should be merged as early as possible so that it could be "battle-tested" before the release.
@florian-h05 |
I'm very open for suggestions, I am not super happy with the UX to get there. |
Just to add on that: the documentation for the filters has been nicely documented by @J-N-K here: openhab/openhab-docs#2088 |
Follow-up for #1917. - Display enabled filters in config footer. - Display filter configuration in filter footer. - Time filter: Define options for time unit. - Add a button to open the documentation. - Fixes an issue, where Filter creation fails due to missing filter type arrays. --------- Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Closes #1463.
Refs openhab/openhab-core#2871.
Refs openhab/openhab-core#3642.
It is accessible from the add-on settings page and has both a design and a code tab.
The design tab allows to set persistence strategies for Items, define cron strategies and set the default strategies. It does not duplicate names for (cron) persistence strategies and filters as well as configs for the same set of Items.
All four filters provided by openHAB core (treshold, time, equals/not equals, include/exclude) can be configured.
When the user removes a cron strategy or a filter, it is automatically removed from all configs so that there is no API failure (400 Bad Request).
No code completion is not provided, but required attributes for filters are automatically set on save to avoid API failure (500 Internal Server Error).
A few words about order and sorting: