diff --git a/bundles/org.openhab.ui/web/src/assets/i18n/empty-states/en.json b/bundles/org.openhab.ui/web/src/assets/i18n/empty-states/en.json index aef295efca..d0bbeb6f81 100644 --- a/bundles/org.openhab.ui/web/src/assets/i18n/empty-states/en.json +++ b/bundles/org.openhab.ui/web/src/assets/i18n/empty-states/en.json @@ -45,5 +45,8 @@ "addons.text": "Add-ons add functionality to your openHAB system.

Install them with the button below.", "page.unavailable.title": "Page Unavailable", - "page.unavailable.text": "You are not allowed to view this page because of visibility restrictions." + "page.unavailable.text": "You are not allowed to view this page because of visibility restrictions.", + + "persistence.title": "No persistence add-on installed", + "persistence.text": "With persistence you can store Item states over time, no matter they are historic or future values. To configure persistence, you need at least one persistence add-on to be installed." } diff --git a/bundles/org.openhab.ui/web/src/js/routes.js b/bundles/org.openhab.ui/web/src/js/routes.js index 820ac1725d..3547cab23f 100644 --- a/bundles/org.openhab.ui/web/src/js/routes.js +++ b/bundles/org.openhab.ui/web/src/js/routes.js @@ -34,6 +34,7 @@ const InboxListPage = () => import(/* webpackChunkName: "admin-config" */ '../pa const TransformationsListPage = () => import(/* webpackChunkName: "admin-config" */ '../pages/settings/transformations/transformations-list.vue') const TransformationsEditPage = () => import(/* webpackChunkName: "admin-rules" */ '../pages/settings/transformations/transformation-edit.vue') +const PersistenceSettingsPage = () => import(/* webpackChunkName: "admin-config" */ '../pages/settings/persistence/persistence-settings.vue') const PersistenceEditPage = () => import(/* webpackChunkName: "admin-config" */ '../pages/settings/persistence/persistence-edit.vue') const SemanticModelPage = () => import(/* webpackChunkName: "admin-config" */ '../pages/settings/model/model.vue') @@ -279,6 +280,9 @@ export default [ }, { path: 'persistence/', + beforeEnter: [enforceAdminForRoute], + beforeLeave: [checkDirtyBeforeLeave], + async: loadAsync(PersistenceSettingsPage), routes: [ { path: ':serviceId', diff --git a/bundles/org.openhab.ui/web/src/pages/addons/addon-config.vue b/bundles/org.openhab.ui/web/src/pages/addons/addon-config.vue index 4bcc660c92..ecd704d1e0 100644 --- a/bundles/org.openhab.ui/web/src/pages/addons/addon-config.vue +++ b/bundles/org.openhab.ui/web/src/pages/addons/addon-config.vue @@ -10,11 +10,9 @@ - - - Persistence configuration - - + + Configure Persistence Policies + diff --git a/bundles/org.openhab.ui/web/src/pages/settings/menu/settings-menu.vue b/bundles/org.openhab.ui/web/src/pages/settings/menu/settings-menu.vue index 731c86a260..4ba543d6ec 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/menu/settings-menu.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/menu/settings-menu.vue @@ -72,6 +72,14 @@ :footer="objectsSubtitles.transform"> + + + Automation @@ -157,6 +165,7 @@ export default { addonsLoaded: false, servicesLoaded: false, addonsInstalled: [], + persistenceAddonsInstalled: [], addonsServices: [], systemServices: [], objectsSubtitles: { @@ -165,6 +174,7 @@ export default { items: 'Manage the functional layer', pages: 'Design displays for user control & monitoring', transform: 'Make raw data human-readable', + persistence: 'Persist data for future use', rules: 'Automate with triggers and actions', scenes: 'Store a set of desired states as a scene', scripts: 'Rules dedicated to running code', @@ -219,15 +229,23 @@ export default { // can be done in parallel! servicesPromise.then((data) => { - this.systemServices = data.filter(s => s.category === 'system') - this.addonsServices = data.filter(s => s.category !== 'system') + this.systemServices = data + .filter(s => (s.category === 'system') && (s.id !== 'org.openhab.persistence')) + .sort((s1, s2) => this.sortByLabel(s1, s2)) + this.addonsServices = data.filter(s => s.category !== 'system').sort((s1, s2) => this.sortByLabel(s1, s2)) this.servicesLoaded = true }) addonsPromise.then((data) => { - this.addonsInstalled = data.filter(a => a.installed && !['application/vnd.openhab.ruletemplate', 'application/vnd.openhab.uicomponent;type=widget', 'application/vnd.openhab.uicomponent;type=blocks'].includes(a.contentType)) + this.addonsInstalled = data + .filter(a => a.installed && !['application/vnd.openhab.ruletemplate', 'application/vnd.openhab.uicomponent;type=widget', 'application/vnd.openhab.uicomponent;type=blocks'].includes(a.contentType)) + .sort((s1, s2) => this.sortByLabel(s1, s2)) + this.persistenceAddonsInstalled = this.addonsInstalled.filter(a => a.installed && a.type === 'persistence') this.addonsLoaded = true }) }, + sortByLabel (s1, s2) { + return s1.label.toLowerCase() > s2.label.toLowerCase() ? 1 : -1 + }, loadCounters () { if (!this.apiEndpoints) return if (this.$store.getters.apiEndpoint('inbox')) this.$oh.api.get('/rest/inbox').then((data) => { this.inboxCount = data.filter((e) => e.flag === 'NEW').length.toString() }) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-settings.vue b/bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-settings.vue new file mode 100644 index 0000000000..4b1a057bcf --- /dev/null +++ b/bundles/org.openhab.ui/web/src/pages/settings/persistence/persistence-settings.vue @@ -0,0 +1,149 @@ + + +