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