diff --git a/bundles/org.openhab.ui/web/src/js/routes.js b/bundles/org.openhab.ui/web/src/js/routes.js index 970ec578c4..9d12159d98 100644 --- a/bundles/org.openhab.ui/web/src/js/routes.js +++ b/bundles/org.openhab.ui/web/src/js/routes.js @@ -92,7 +92,45 @@ export default [ // keepAlive: true, options: { transition: 'f7-dive' - } + }, + routes: [ + { + path: 'overview', + component: HomePage, + options: { + props: { + initialTab: 'overview' + } + } + }, + { + path: 'locations', + component: HomePage, + options: { + props: { + initialTab: 'locations' + } + } + }, + { + path: 'equipment', + component: HomePage, + options: { + props: { + initialTab: 'equipment' + } + } + }, + { + path: 'properties', + component: HomePage, + options: { + props: { + initialTab: 'properties' + } + } + } + ] }, { path: '/page/:uid', diff --git a/bundles/org.openhab.ui/web/src/pages/home.vue b/bundles/org.openhab.ui/web/src/pages/home.vue index 867b70ca24..f441c68fdc 100644 --- a/bundles/org.openhab.ui/web/src/pages/home.vue +++ b/bundles/org.openhab.ui/web/src/pages/home.vue @@ -21,10 +21,10 @@ - - - - + + + + @@ -88,6 +88,7 @@ import ModelTab from './home/model-tab.vue' import HomeCards from './home/homecards-mixin' export default { + props: ['initialTab'], mixins: [HomeCards], components: { OverviewTab, @@ -100,7 +101,7 @@ export default { showCards: false, showPinToHome: false, showExitToApp: false, - currentTab: 'overview', + currentTab: this.initialTab || 'overview', overviewPageKey: this.$utils.id(), items: [] } @@ -164,6 +165,7 @@ export default { }, methods: { onPageBeforeIn () { + this.$f7router.updateCurrentUrl('/' + this.currentTab) this.overviewPageKey = this.$utils.id() }, onPageAfterIn () { @@ -193,6 +195,10 @@ export default { exitToApp () { window.OHApp.exitToApp() }, + switchTab (tab) { + this.currentTab = tab + this.$f7router.updateCurrentUrl('/' + this.currentTab) + }, tabVisible (tab) { if (!this.tabsVisible) return false if (!this.homePageComponent) return true diff --git a/bundles/org.openhab.ui/web/src/pages/home/homecards-mixin.js b/bundles/org.openhab.ui/web/src/pages/home/homecards-mixin.js index c546f2360f..ddf87e1261 100644 --- a/bundles/org.openhab.ui/web/src/pages/home/homecards-mixin.js +++ b/bundles/org.openhab.ui/web/src/pages/home/homecards-mixin.js @@ -114,7 +114,6 @@ export default { item.children.forEach(child => this.sortModel(child)) }, loadModel (page) { - this.modelReady = false console.debug('Loading semantic model and building semantic homepages ...') this.$oh.api.get('/rest/items?staticDataOnly=true&metadata=semantics,listWidget,widgetOrder') .then((data) => {