From c0dd153ea8ef487bd8cc83a6c071e26436761efc Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 28 Nov 2024 14:47:57 +0000 Subject: [PATCH] feat: snapshot ui and move misc settings to base tab --- .../dashboard/TreeView/ProjectNode.vue | 15 +- .../dashboard/settings/BaseSettings.vue | 228 ++++++++++++++++++ .../components/dashboard/settings/Misc.vue | 82 ------- .../components/general/AddBaseButton.vue | 22 -- packages/nc-gui/components/project/View.vue | 13 +- packages/nc-gui/context/index.ts | 1 - packages/nc-gui/lang/en.json | 6 + packages/nc-gui/pages/index.vue | 23 -- .../pages/index/[typeOrId]/[baseId].vue | 17 -- packages/nc-gui/store/config.ts | 2 +- 10 files changed, 259 insertions(+), 150 deletions(-) create mode 100644 packages/nc-gui/components/dashboard/settings/BaseSettings.vue delete mode 100644 packages/nc-gui/components/dashboard/settings/Misc.vue delete mode 100644 packages/nc-gui/components/general/AddBaseButton.vue diff --git a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue index 6aacfb36ad..94f219c84a 100644 --- a/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue +++ b/packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue @@ -95,8 +95,6 @@ const { activeProjectId } = storeToRefs(useBases()) const { baseUrl } = useBase() -const toggleDialog = inject(ToggleDialogInj, () => {}) - const { $e } = useNuxtApp() const isOptionsOpen = ref(false) @@ -525,6 +523,17 @@ watch( }, ) +const { navigateToProject } = useGlobal() + +const openBaseSettings = async (baseId: string) => { + navigateToProject({ + baseId, + query: { + page: 'base-settings', + }, + }) +} + const showNodeTooltip = ref(true) @@ -745,7 +754,7 @@ const showNodeTooltip = ref(true) key="teamAndSettings" data-testid="nc-sidebar-base-settings" class="nc-sidebar-base-base-settings" - @click="toggleDialog(true, 'teamAndAuth', undefined, base.id)" + @click="openBaseSettings(base.id)" >
diff --git a/packages/nc-gui/components/dashboard/settings/BaseSettings.vue b/packages/nc-gui/components/dashboard/settings/BaseSettings.vue new file mode 100644 index 0000000000..f1296cf3e6 --- /dev/null +++ b/packages/nc-gui/components/dashboard/settings/BaseSettings.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/packages/nc-gui/components/dashboard/settings/Misc.vue b/packages/nc-gui/components/dashboard/settings/Misc.vue deleted file mode 100644 index fc93473f31..0000000000 --- a/packages/nc-gui/components/dashboard/settings/Misc.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - diff --git a/packages/nc-gui/components/general/AddBaseButton.vue b/packages/nc-gui/components/general/AddBaseButton.vue deleted file mode 100644 index 7a5e83c676..0000000000 --- a/packages/nc-gui/components/general/AddBaseButton.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/packages/nc-gui/components/project/View.vue b/packages/nc-gui/components/project/View.vue index 7db6246b23..e152101c18 100644 --- a/packages/nc-gui/components/project/View.vue +++ b/packages/nc-gui/components/project/View.vue @@ -58,8 +58,10 @@ watch( projectPageTab.value = 'collaborator' } else if (newVal === 'data-source') { projectPageTab.value = 'data-source' - } else { + } else if (newVal === 'allTable') { projectPageTab.value = 'allTable' + } else { + projectPageTab.value = 'base-settings' } return } @@ -201,6 +203,15 @@ watch( + + + +
diff --git a/packages/nc-gui/context/index.ts b/packages/nc-gui/context/index.ts index de9af47c44..00164590ff 100644 --- a/packages/nc-gui/context/index.ts +++ b/packages/nc-gui/context/index.ts @@ -50,7 +50,6 @@ export const EditModeInj: InjectionKey> = Symbol('edit-mode-injecti export const SharedViewPasswordInj: InjectionKey> = Symbol('shared-view-password-injection') export const CellUrlDisableOverlayInj: InjectionKey> = Symbol('cell-url-disable-url') export const DropZoneRef: InjectionKey> = Symbol('drop-zone-ref') -export const ToggleDialogInj: InjectionKey = Symbol('toggle-dialog-injection') export const CellClickHookInj: InjectionKey | undefined> = Symbol('cell-click-injection') export const SaveRowInj: InjectionKey<(() => void) | undefined> = Symbol('save-row-injection') export const CurrentCellInj: InjectionKey> = Symbol('current-cell-injection') diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index eb0ceb1494..b26b95ed27 100644 --- a/packages/nc-gui/lang/en.json +++ b/packages/nc-gui/lang/en.json @@ -93,6 +93,8 @@ "none": "None" }, "general": { + "snapshot": "Snapshot", + "baseSnapshots": "Base Snapshots", "featurePreview": "Feature Preview", "scripts": "Scripts", "configure": "Configure", @@ -648,6 +650,10 @@ "lockedByUser": "Locked by {user}" }, "labels": { + "miscBaseSettingsLabel": "Snapshots are complete backups of your database at the time of creation. Restoring a snapshot duplicates the data.", + "snapShotSubText": "Snapshots are complete backups of your database at the time of creation. Restoring a snapshot duplicates the data.", + "newSnapshot": "New Snapshot", + "searchASnapshot": "Search a snapshot", "continue": "Continue", "toggleExperimentalFeature": "Enable or disable experimental features with ease, allowing you to explore and evaluate upcoming functionalities.", "modifiedOn": "Modified on", diff --git a/packages/nc-gui/pages/index.vue b/packages/nc-gui/pages/index.vue index ab1adced0c..c41df67440 100644 --- a/packages/nc-gui/pages/index.vue +++ b/packages/nc-gui/pages/index.vue @@ -4,14 +4,6 @@ definePageMeta({ hasSidebar: true, }) -const dialogOpen = ref(false) - -const openDialogKey = ref('') - -const dataSourcesState = ref('') - -const baseId = ref() - const basesStore = useBases() const { populateWorkspace } = useWorkspace() @@ -101,15 +93,6 @@ onMounted(() => { } }) }) - -function toggleDialog(value?: boolean, key?: string, dsState?: string, pId?: string) { - dialogOpen.value = value ?? !dialogOpen.value - openDialogKey.value = key || '' - dataSourcesState.value = dsState || '' - baseId.value = pId || '' -} - -provide(ToggleDialogInj, toggleDialog) - diff --git a/packages/nc-gui/pages/index/[typeOrId]/[baseId].vue b/packages/nc-gui/pages/index/[typeOrId]/[baseId].vue index e1f8985c57..1e6604e29b 100644 --- a/packages/nc-gui/pages/index/[typeOrId]/[baseId].vue +++ b/packages/nc-gui/pages/index/[typeOrId]/[baseId].vue @@ -3,23 +3,6 @@ definePageMeta({ hideHeader: true, hasSidebar: true, }) - -const dialogOpen = ref(false) - -const openDialogKey = ref('') - -const dataSourcesState = ref('') - -const baseId = ref() - -function toggleDialog(value?: boolean, key?: string, dsState?: string, pId?: string) { - dialogOpen.value = value ?? !dialogOpen.value - openDialogKey.value = key || '' - dataSourcesState.value = dsState || '' - baseId.value = pId || '' -} - -provide(ToggleDialogInj, toggleDialog)