diff --git a/packages/nc-gui/components/dashboard/settings/BaseSettings/Snapshots.vue b/packages/nc-gui/components/dashboard/settings/BaseSettings/Snapshots.vue index 88de484c57..ff9b7c1037 100644 --- a/packages/nc-gui/components/dashboard/settings/BaseSettings/Snapshots.vue +++ b/packages/nc-gui/components/dashboard/settings/BaseSettings/Snapshots.vue @@ -3,8 +3,6 @@ import dayjs from 'dayjs' const { t } = useI18n() -const { $api } = useNuxtApp() - const { sorts, sortDirection, loadSorts, handleGetSortedData, saveOrUpdate: saveOrUpdateSort } = useUserSorts('Webhook') const orderBy = computed>({ @@ -32,13 +30,10 @@ const { createSnapshot, listSnapshots, updateSnapshot, - restoreSnapshot, - deleteSnapshot, cancelNewSnapshot, isUnsavedSnapshotsPending, addNewSnapshot, isCreatingSnapshot, - isRestoringSnapshot, } = useBaseSettings() const columns = [ @@ -63,13 +58,46 @@ const columns = [ onMounted(async () => { await listSnapshots() }) +const deleteSnapshot = (s: SnapshotExtendedType) => { + const isOpen = ref(true) + + const { close } = useDialog(resolveComponent('DlgSnapshotDelete'), { + 'modelValue': isOpen, + 'snapshot': s, + 'onUpdate:modelValue': closeDialog, + 'onDeleted': async () => { + closeDialog() + await listSnapshots() + }, + }) + + function closeDialog() { + isOpen.value = false + close(1000) + } +} + +const restoreSnapshot = (s: SnapshotExtendedType) => { + const isOpen = ref(true) + + const { close } = useDialog(resolveComponent('DlgSnapshotRestore'), { + 'modelValue': isOpen, + 'snapshot': s, + 'onUpdate:modelValue': closeDialog, + 'onRestored': async () => { + closeDialog() + }, + }) + + function closeDialog() { + isOpen.value = false + close(1000) + } +}