@@ -22,6 +22,7 @@ import Sidebar from './modules/sidebar/sections/Sidebar.vue'
22
22
import { useResizeObserver } from ' @vueuse/core'
23
23
import { loadState } from ' @nextcloud/initial-state'
24
24
import { useTablesStore } from ' ./store/store.js'
25
+ import { generateUrl } from ' @nextcloud/router'
25
26
26
27
export default {
27
28
name: ' App' ,
@@ -44,7 +45,7 @@ export default {
44
45
}
45
46
},
46
47
computed: {
47
- ... mapState (useTablesStore, [' isLoadingSomething' ]),
48
+ ... mapState (useTablesStore, [' isLoadingSomething' , ' activeView ' , ' activeTable ' , ' activeContext ' ]),
48
49
},
49
50
watch: {
50
51
' $route' (to, from) {
@@ -63,6 +64,8 @@ export default {
63
64
methods: {
64
65
... mapActions (useTablesStore, [' loadTablesFromBE' , ' getAllContexts' , ' loadViewsSharedWithMeFromBE' , ' loadTemplatesFromBE' , ' setActiveRowId' , ' setActiveTableId' , ' setActiveViewId' , ' setActiveContextId' ]),
65
66
routing (currentRoute ) {
67
+ const url = generateUrl (' /apps/tables/' )
68
+
66
69
try {
67
70
if (loadState (' tables' , ' contextId' , undefined )) {
68
71
// prepare route, when Context is opened from navigation bar
@@ -85,20 +88,20 @@ export default {
85
88
this .setActiveTableId (parseInt (currentRoute .params .tableId ))
86
89
this .setPageTitle (this .activeTable .title )
87
90
if (! currentRoute .path .includes (' /row/' )) {
88
- this .switchActiveMenuEntry (document .querySelector (' header .header-left .app-menu a[title="Tables"] ' ))
91
+ this .switchActiveMenuEntry (document .querySelector (` header .header-start .app-menu a[href=" ${ url } "] ` ))
89
92
}
90
93
} else if (currentRoute .path .startsWith (' /view/' )) {
91
94
this .setActiveViewId (parseInt (currentRoute .params .viewId ))
92
95
this .setPageTitle (this .activeView .title )
93
96
if (! currentRoute .path .includes (' /row/' )) {
94
- this .switchActiveMenuEntry (document .querySelector (' header .header-left .app-menu a[title="Tables"] ' ))
97
+ this .switchActiveMenuEntry (document .querySelector (` header .header-start .app-menu a[href=" ${ url } "] ` ))
95
98
}
96
99
} else if (currentRoute .path .startsWith (' /application/' )) {
97
100
const contextId = parseInt (currentRoute .params .contextId )
98
101
this .setActiveContextId (contextId)
99
102
this .setPageTitle (this .activeContext .name )
100
103
// This breaks if there are multiple contexts with the same name or another app has the same name. We need a better way to identify the correct element.
101
- this .switchActiveMenuEntry (document .querySelector (` header .header-left .app-menu [title="${ this .activeContext .name } "]` ))
104
+ this .switchActiveMenuEntry (document .querySelector (` header .header-start .app-menu [title="${ this .activeContext .name } "]` ))
102
105
103
106
// move the focus away from nav bar (import for app-internal switch)
104
107
const appContent = document .getElementById (' app-content-vue' )
@@ -112,7 +115,7 @@ export default {
112
115
},
113
116
switchActiveMenuEntry (targetElement ) {
114
117
targetElement = targetElement? .tagName ? .toLowerCase () === ' a' ? targetElement .parentElement : targetElement
115
- const currentlyActive = document .querySelector (' header .header-left .app-menu li.app-menu-entry--active' )
118
+ const currentlyActive = document .querySelector (' header .header-start .app-menu li.app-menu-entry--active' )
116
119
currentlyActive .classList .remove (' app-menu-entry--active' )
117
120
targetElement .classList .add (' app-menu-entry--active' )
118
121
},
0 commit comments