diff --git a/web-app/packages/app/src/App.vue b/web-app/packages/app/src/App.vue index 7db90208..11058bb7 100644 --- a/web-app/packages/app/src/App.vue +++ b/web-app/packages/app/src/App.vue @@ -134,6 +134,7 @@ export default defineComponent({ }) }, async created() { + this.init() await this.fetchConfig() if (this.loggedUser) { // here is loaded current workspace on startup (and reloaded in watcher when user has changed) @@ -161,7 +162,8 @@ export default defineComponent({ ...mapActions(useAppStore, ['setServerError']), ...mapActions(useInstanceStore, ['fetchPing', 'fetchConfig', 'initApp']), ...mapActions(useNotificationStore, { notificationError: 'error' }), - ...mapActions(useUserStore, ['checkCurrentWorkspace', 'updateLoggedUser']) + ...mapActions(useUserStore, ['checkCurrentWorkspace', 'updateLoggedUser']), + ...mapActions(useLayoutStore, ['init']) } }) diff --git a/web-app/packages/app/src/router.ts b/web-app/packages/app/src/router.ts index 0adb4523..aadd4e7b 100644 --- a/web-app/packages/app/src/router.ts +++ b/web-app/packages/app/src/router.ts @@ -7,7 +7,6 @@ import { FileBrowserView, FileVersionDetailView, ProjectVersionsView, - VersionDetailView, NotFoundView, VerifyEmailView, routeUtils, @@ -84,7 +83,7 @@ export const createRouter = (pinia: Pinia) => { sidebar: SideBar }, meta: { - title: 'Dashboard' + breadcrump: [{ title: 'Dashboard', path: '/dashboard' }] }, props: { default: true @@ -112,7 +111,11 @@ export const createRouter = (pinia: Pinia) => { props: { default: true }, - meta: { public: true, title: 'Projects' }, + meta: { + public: true, + title: 'Projects', + breadcrump: [{ title: 'Projects', path: '/projects' }] + }, children: [ { path: 'explore', @@ -146,6 +149,21 @@ export const createRouter = (pinia: Pinia) => { return } }, + /** Redirect of unused /history/:version_id path to /history?version_id */ + { + path: '/projects/:namespace/:projectName/history/:version_id', + name: 'project-versions-detail', + component: NotFoundView, + props: true, + meta: { public: true }, + beforeEnter: (to, from, next) => { + next({ + path: `/projects/${to.params.namespace}/${to.params.projectName}/history`, + query: { version_id: to.params.version_id } + }) + return + } + }, { path: '/projects/:namespace/:projectName', name: 'project', @@ -158,7 +176,7 @@ export const createRouter = (pinia: Pinia) => { default: true }, meta: { - title: 'Projects' + breadcrump: [{ title: 'Projects', path: '/projects' }] }, redirect: { name: 'project-tree' }, @@ -182,36 +200,55 @@ export const createRouter = (pinia: Pinia) => { component: ProjectVersionsView, props: true }, - { - path: 'history/:version_id', - name: 'project-versions-detail', - component: VersionDetailView, - props: true - }, { path: 'history/:version_id/:path', name: 'file-version-detail', component: FileVersionDetailView, props: true, - meta: { public: true } - } - ].map((child) => ({ - ...child, - beforeEnter: (to, from, next) => { - // added project name to matched route - to.matched = to.matched.map((route) => ({ - ...route, - meta: { - ...route.meta, - title: - route.name === to.name - ? (to.params.projectName as string) - : route.meta.title + meta: { public: true }, + // TODO: refactor to function in utils + beforeEnter(to, from, next) { + to.meta = { + ...to.meta, + breadcrump: [ + { + title: String(to.params.projectName), + path: `/projects/${to.params.namespace}/${to.params.projectName}/history` + }, + { + title: String(to.params.version_id), + path: `/projects/${to.params.namespace}/${to.params.projectName}/history/${to.params.version_id}` + }, + { + title: String(to.params.path), + path: to.fullPath + } + ] } - })) - next() + next() + } } - })) + ] + // Not apply for project version detail , which have own breadcrump + .map((child) => + child.name === 'file-version-detail' + ? child + : { + ...child, + beforeEnter: (to, from, next) => { + to.meta = { + ...to.meta, + breadcrump: [ + { + title: String(to.params.projectName), + path: to.fullPath + } + ] + } + next() + } + } + ) }, { path: '/:pathMatch(.*)*', diff --git a/web-app/packages/app/src/shims-vue-router.d.ts b/web-app/packages/app/src/shims-vue-router.d.ts index 0395864a..9cbc6fc4 100644 --- a/web-app/packages/app/src/shims-vue-router.d.ts +++ b/web-app/packages/app/src/shims-vue-router.d.ts @@ -4,6 +4,6 @@ declare module 'vue-router' { interface RouteMeta { public?: boolean allowedForNoWorkspace?: boolean - title?: string + breadcrump?: { title: string; path: string }[] } } diff --git a/web-app/packages/lib/components.d.ts b/web-app/packages/lib/components.d.ts index 277dad86..eea7b432 100644 --- a/web-app/packages/lib/components.d.ts +++ b/web-app/packages/lib/components.d.ts @@ -7,6 +7,8 @@ export {} declare module 'vue' { export interface GlobalComponents { + PAccordion: typeof import('primevue/accordion')['default'] + PAccordionTab: typeof import('primevue/accordiontab')['default'] PAvatar: typeof import('primevue/avatar')['default'] PBreadcrumb: typeof import('primevue/breadcrumb')['default'] PButton: typeof import('primevue/button')['default'] @@ -14,6 +16,7 @@ declare module 'vue' { PDataTable: typeof import('primevue/datatable')['default'] PDataView: typeof import('primevue/dataview')['default'] PDialog: typeof import('primevue/dialog')['default'] + PDivider: typeof import('primevue/divider')['default'] PDropdown: typeof import('primevue/dropdown')['default'] PImage: typeof import('primevue/image')['default'] PInlineMessage: typeof import('primevue/inlinemessage')['default'] @@ -47,8 +50,6 @@ declare module 'vue' { VIcon: typeof import('vuetify/components')['VIcon'] VImg: typeof import('vuetify/components')['VImg'] VLayout: typeof import('vuetify/components')['VLayout'] - VList: typeof import('vuetify/components')['VList'] - VListGroup: typeof import('vuetify/components')['VListGroup'] VListItem: typeof import('vuetify/components')['VListItem'] VListItemSubtitle: typeof import('vuetify/components')['VListItemSubtitle'] VListItemTitle: typeof import('vuetify/components')['VListItemTitle'] diff --git a/web-app/packages/lib/src/common/components/AppSection.vue b/web-app/packages/lib/src/common/components/AppSection.vue index f15d06a5..6d146fec 100644 --- a/web-app/packages/lib/src/common/components/AppSection.vue +++ b/web-app/packages/lib/src/common/components/AppSection.vue @@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial :class="[ ground ? 'surface-ground' - : 'surface-section border-round-2xl overflow-hidden' + : 'surface-section border-round-xl overflow-hidden' ]" >