|
|
|
@ -25,8 +25,6 @@ import {
|
|
|
|
|
import type { Row } from '#imports' |
|
|
|
|
|
|
|
|
|
const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((meta: Ref<TableType>, row: Ref<Row>) => { |
|
|
|
|
const { loadKanbanData, addOrEditStackRow } = useKanbanViewStoreOrThrow() |
|
|
|
|
|
|
|
|
|
const { $e, $state, $api } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
const { api, isLoading: isCommentsLoading, error: commentsError } = useApi() |
|
|
|
@ -121,6 +119,13 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
return $state.user?.value?.email === email |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const loadKanbanData = async () => { |
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
const { loadKanbanData: _loadKanbanData } = useKanbanViewStoreOrThrow() |
|
|
|
|
await _loadKanbanData() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const saveComment = async () => { |
|
|
|
|
try { |
|
|
|
|
if (!row.value || !comment.value) return |
|
|
|
@ -180,9 +185,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
redo: { |
|
|
|
|
fn: async (rowData: any) => { |
|
|
|
|
await $api.dbTableRow.create('noco', project.value.id as string, meta.value.id, { ...pkData, ...rowData }) |
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
await loadKanbanData() |
|
|
|
|
} |
|
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
}, |
|
|
|
|
args: [clone(insertObj)], |
|
|
|
@ -199,9 +202,8 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
if (res.message) { |
|
|
|
|
throw new Error(res.message) |
|
|
|
|
} |
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
|
|
|
|
|
await loadKanbanData() |
|
|
|
|
} |
|
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
}, |
|
|
|
|
args: [id], |
|
|
|
@ -233,9 +235,8 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
redo: { |
|
|
|
|
fn: async (id: string, data: Record<string, any>) => { |
|
|
|
|
await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data) |
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
await loadKanbanData() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
}, |
|
|
|
|
args: [id, clone(updateOrInsertObj)], |
|
|
|
@ -243,9 +244,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
undo: { |
|
|
|
|
fn: async (id: string, data: Record<string, any>) => { |
|
|
|
|
await $api.dbTableRow.update(NOCO, project.value.id as string, meta.value.id, encodeURIComponent(id), data) |
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
await loadKanbanData() |
|
|
|
|
} |
|
|
|
|
reloadTrigger?.trigger() |
|
|
|
|
}, |
|
|
|
|
args: [id, clone(undoObject)], |
|
|
|
@ -265,6 +264,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (activeView.value?.type === ViewTypes.KANBAN) { |
|
|
|
|
const { addOrEditStackRow } = useKanbanViewStoreOrThrow() |
|
|
|
|
addOrEditStackRow(row.value, isNewRow) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|