chore(views): remove old view routes
This commit is contained in:
parent
bc34a33922
commit
59ced554cd
@ -37,7 +37,7 @@
|
||||
v-slot="{ Component }"
|
||||
:route="routeWithModal"
|
||||
>
|
||||
<keep-alive :include="['project.view', 'project.gantt', 'project.table', 'project.kanban']">
|
||||
<keep-alive :include="['project.view']">
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
|
@ -62,7 +62,7 @@ export const KEYBOARD_SHORTCUTS : ShortcutGroup[] = [
|
||||
},
|
||||
{
|
||||
title: 'project.kanban.title',
|
||||
available: (route) => route.name === 'project.kanban',
|
||||
available: (route) => route.name === 'project.view',
|
||||
shortcuts: [
|
||||
{
|
||||
title: 'keyboardShortcuts.task.done',
|
||||
|
@ -5,10 +5,8 @@ import {saveLastVisited} from '@/helpers/saveLastVisited'
|
||||
import {saveProjectView, getProjectView} from '@/helpers/projectView'
|
||||
import {parseDateOrString} from '@/helpers/time/parseDateOrString'
|
||||
import {getNextWeekDate} from '@/helpers/time/getNextWeekDate'
|
||||
import {setTitle} from '@/helpers/setTitle'
|
||||
import {LINK_SHARE_HASH_PREFIX} from '@/constants/linkShareHash'
|
||||
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
|
||||
@ -33,16 +31,8 @@ const NewLabelComponent = () => import('@/views/labels/NewLabel.vue')
|
||||
// Migration
|
||||
const MigrationComponent = () => import('@/views/migrate/Migration.vue')
|
||||
const MigrationHandlerComponent = () => import('@/views/migrate/MigrationHandler.vue')
|
||||
// Project Views
|
||||
const ProjectList = () => import('@/views/project/ProjectList.vue')
|
||||
const ProjectGantt = () => import('@/views/project/ProjectGantt.vue')
|
||||
const ProjectTable = () => import('@/views/project/ProjectTable.vue')
|
||||
// Project View
|
||||
const ProjectView = () => import('@/views/project/ProjectView.vue')
|
||||
// If we load the component async, using it as a backdrop view will not work. Instead, everything explodes
|
||||
// with an error from the core saying "Cannot read properties of undefined (reading 'parentNode')"
|
||||
// Of course, with no clear indicator of where the problem comes from.
|
||||
// const ProjectKanban = () => import('@/views/project/ProjectKanban.vue')
|
||||
import ProjectKanban from '@/views/project/ProjectKanban.vue'
|
||||
const ProjectInfo = () => import('@/views/project/ProjectInfo.vue')
|
||||
|
||||
// Project Settings
|
||||
@ -372,43 +362,6 @@ const router = createRouter({
|
||||
viewId: route.params.viewId ? parseInt(route.params.viewId as string): undefined,
|
||||
}),
|
||||
},
|
||||
{
|
||||
path: '/projects/:projectId/list',
|
||||
name: 'project.list',
|
||||
component: ProjectList,
|
||||
beforeEnter: (to) => saveProjectView(to.params.projectId, to.name),
|
||||
props: route => ({ projectId: Number(route.params.projectId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/projects/:projectId/gantt',
|
||||
name: 'project.gantt',
|
||||
component: ProjectGantt,
|
||||
beforeEnter: (to) => saveProjectView(to.params.projectId, to.name),
|
||||
// FIXME: test if `useRoute` would be the same. If it would use it instead.
|
||||
props: route => ({route}),
|
||||
},
|
||||
{
|
||||
path: '/projects/:projectId/table',
|
||||
name: 'project.table',
|
||||
component: ProjectTable,
|
||||
beforeEnter: (to) => saveProjectView(to.params.projectId, to.name),
|
||||
props: route => ({ projectId: Number(route.params.projectId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/projects/:projectId/kanban',
|
||||
name: 'project.kanban',
|
||||
component: ProjectKanban,
|
||||
beforeEnter: (to) => {
|
||||
saveProjectView(to.params.projectId, to.name)
|
||||
// Properly set the page title when a task popup is closed
|
||||
const projectStore = useProjectStore()
|
||||
const projectFromStore = projectStore.projects[Number(to.params.projectId)]
|
||||
if(projectFromStore) {
|
||||
setTitle(projectFromStore.title)
|
||||
}
|
||||
},
|
||||
props: route => ({ projectId: Number(route.params.projectId as string) }),
|
||||
},
|
||||
{
|
||||
path: '/teams',
|
||||
name: 'teams.index',
|
||||
|
@ -29,7 +29,8 @@ watch(
|
||||
() => viewId,
|
||||
() => {
|
||||
if (viewId === 0) {
|
||||
// Ideally, we would do that in the router redirect, but we can't access the project store there.
|
||||
// Ideally, we would do that in the router redirect, but we the projects (and therefore, the views)
|
||||
// are not always loaded then.
|
||||
const viewId = projectStore.projects[projectId].views[0].id
|
||||
router.replace({
|
||||
name: 'project.view',
|
||||
|
@ -17,6 +17,7 @@ import type {IProjectView} from '@/modelTypes/IProjectView'
|
||||
// convenient internal filter object
|
||||
export interface GanttFilters {
|
||||
projectId: IProject['id']
|
||||
viewId: IProjectView['id'],
|
||||
dateFrom: DateISO
|
||||
dateTo: DateISO
|
||||
showTasksWithoutDates: boolean
|
||||
@ -42,6 +43,7 @@ function ganttRouteToFilters(route: Partial<RouteLocationNormalized>): GanttFilt
|
||||
const ganttRoute = route
|
||||
return {
|
||||
projectId: Number(ganttRoute.params?.projectId),
|
||||
viewId: Number(ganttRoute.params?.viewId),
|
||||
dateFrom: parseDateProp(ganttRoute.query?.dateFrom as DateKebab) || getDefaultDateFrom(),
|
||||
dateTo: parseDateProp(ganttRoute.query?.dateTo as DateKebab) || getDefaultDateTo(),
|
||||
showTasksWithoutDates: parseBooleanProp(ganttRoute.query?.showTasksWithoutDates as string) || DEFAULT_SHOW_TASKS_WITHOUT_DATES,
|
||||
@ -70,8 +72,11 @@ function ganttFiltersToRoute(filters: GanttFilters): RouteLocationRaw {
|
||||
}
|
||||
|
||||
return {
|
||||
name: 'project.gantt',
|
||||
params: {projectId: filters.projectId},
|
||||
name: 'project.view',
|
||||
params: {
|
||||
projectId: filters.projectId,
|
||||
viewId: filters.viewId,
|
||||
},
|
||||
query,
|
||||
}
|
||||
}
|
||||
@ -99,7 +104,7 @@ export function useGanttFilters(route: Ref<RouteLocationNormalized>, view: IProj
|
||||
ganttGetDefaultFilters,
|
||||
ganttRouteToFilters,
|
||||
ganttFiltersToRoute,
|
||||
['project.gantt'],
|
||||
['project.view'],
|
||||
)
|
||||
|
||||
const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user