fix(gantt): open task with double click from the gantt chart
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2023-09-12 15:12:16 +02:00
parent 09ffd9414b
commit a6eb804fae
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import {computed, ref, watch, type Ref} from 'vue'
import {useRouter, type RouteLocationNormalized, type RouteLocationRaw} from 'vue-router'
import {useRouter, type RouteLocationNormalized, type RouteLocationRaw, type RouteRecordName} from 'vue-router'
import equal from 'fast-deep-equal/es6'
export type Filters = Record<string, any>
@ -9,6 +9,7 @@ export function useRouteFilters<CurrentFilters extends Filters>(
getDefaultFilters: (route: RouteLocationNormalized) => CurrentFilters,
routeToFilters: (route: RouteLocationNormalized) => CurrentFilters,
filtersToRoute: (filters: CurrentFilters) => RouteLocationRaw,
routeAllowList: RouteRecordName[] = [],
) {
const router = useRouter()
@ -21,7 +22,8 @@ export function useRouteFilters<CurrentFilters extends Filters>(
(route, oldRoute) => {
if (
route?.name !== oldRoute?.name ||
routeFromFiltersFullPath.value === route.fullPath
routeFromFiltersFullPath.value === route.fullPath ||
!routeAllowList.includes(route.name ?? '')
) {
return
}

View File

@ -101,6 +101,7 @@ export function useGanttFilters(route: Ref<RouteLocationNormalized>): UseGanttFi
ganttGetDefaultFilters,
ganttRouteToFilters,
ganttFiltersToRoute,
['project.gantt'],
)
const {

View File

@ -59,7 +59,7 @@ export function useGanttTaskList<F extends Filters>(
async function addTask(task: Partial<ITask>) {
const newTask = await taskService.create(new TaskModel({...task}))
tasks.value.set(newTask.id, newTask)
return newTask
}
@ -77,12 +77,12 @@ export function useGanttTaskList<F extends Filters>(
// set in expectation that server update works
tasks.value.set(newTask.id, newTask)
try {
try {
const updatedTask = await taskService.update(newTask)
// update the task with possible changes from server
tasks.value.set(updatedTask.id, updatedTask)
success('Saved')
} catch(e: any) {
} catch (e: any) {
error('Something went wrong saving the task')
// roll back changes
tasks.value.set(task.id, oldTask)