|
|
@ -39,6 +39,16 @@ export function useViewData( |
|
|
|
}, |
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const syncCount = async () => { |
|
|
|
|
|
|
|
const { count } = await $api.dbViewRow.count( |
|
|
|
|
|
|
|
NOCO, |
|
|
|
|
|
|
|
project?.value?.title as string, |
|
|
|
|
|
|
|
meta?.value?.id as string, |
|
|
|
|
|
|
|
viewMeta?.value?.id as string, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
paginationData.value.totalRows = count |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const loadData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => { |
|
|
|
const loadData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => { |
|
|
|
if (!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) return |
|
|
|
if (!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) return |
|
|
|
const response = await $api.dbViewRow.list('noco', project.value.id, meta.value.id, viewMeta.value.id, { |
|
|
|
const response = await $api.dbViewRow.list('noco', project.value.id, meta.value.id, viewMeta.value.id, { |
|
|
@ -70,6 +80,7 @@ export function useViewData( |
|
|
|
rowMeta: {}, |
|
|
|
rowMeta: {}, |
|
|
|
oldRow: { ...insertedData }, |
|
|
|
oldRow: { ...insertedData }, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
syncCount() |
|
|
|
} catch (error: any) { |
|
|
|
} catch (error: any) { |
|
|
|
notification.error({ |
|
|
|
notification.error({ |
|
|
|
message: 'Row insert failed', |
|
|
|
message: 'Row insert failed', |
|
|
@ -167,7 +178,6 @@ export function useViewData( |
|
|
|
}) |
|
|
|
}) |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -186,6 +196,7 @@ export function useViewData( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
formattedData.value.splice(rowIndex, 1) |
|
|
|
formattedData.value.splice(rowIndex, 1) |
|
|
|
|
|
|
|
syncCount() |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
notification.error({ |
|
|
|
notification.error({ |
|
|
|
message: 'Failed to delete row', |
|
|
|
message: 'Failed to delete row', |
|
|
@ -221,6 +232,7 @@ export function useViewData( |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
syncCount() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
@ -235,5 +247,6 @@ export function useViewData( |
|
|
|
deleteSelectedRows, |
|
|
|
deleteSelectedRows, |
|
|
|
updateOrSaveRow, |
|
|
|
updateOrSaveRow, |
|
|
|
selectedAllRecords, |
|
|
|
selectedAllRecords, |
|
|
|
|
|
|
|
syncCount, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|