From 37d44c95ee559f3ee1345e91fca5e2c1e86c5fbf Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Wed, 18 Sep 2024 16:42:21 +0200 Subject: [PATCH] perf(UI): hide edit/delete functions in readonly mode --- .../components/WorkspaceExploreBarMiscContext.vue | 13 ++++++++++--- .../components/WorkspaceExploreBarSchemaContext.vue | 12 ++++++++---- .../components/WorkspaceExploreBarTableContext.vue | 13 ++++++++++--- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/renderer/components/WorkspaceExploreBarMiscContext.vue b/src/renderer/components/WorkspaceExploreBarMiscContext.vue index bc0b5c84..33805991 100644 --- a/src/renderer/components/WorkspaceExploreBarMiscContext.vue +++ b/src/renderer/components/WorkspaceExploreBarMiscContext.vue @@ -16,7 +16,7 @@ /> {{ t('general.run') }}
@@ -36,7 +36,7 @@
@@ -63,7 +63,11 @@ :size="18" /> {{ t('general.copyName') }}
-
+
{ const customizations = computed(() => { return getWorkspace(selectedWorkspace.value).customizations; }); +const connection = computed(() => getConnectionByUid(selectedWorkspace.value)); const deleteMessage = computed(() => { switch (props.selectedMisc.type) { diff --git a/src/renderer/components/WorkspaceExploreBarSchemaContext.vue b/src/renderer/components/WorkspaceExploreBarSchemaContext.vue index 11ff8889..55615f68 100644 --- a/src/renderer/components/WorkspaceExploreBarSchemaContext.vue +++ b/src/renderer/components/WorkspaceExploreBarSchemaContext.vue @@ -3,7 +3,7 @@ :context-event="contextEvent" @close-context="closeContext" > -
+
{{ t('database.export') }}
@@ -147,7 +147,7 @@ /> {{ t('database.import') }}
@@ -159,7 +159,7 @@ /> {{ t('database.editSchema') }}
@@ -219,6 +219,7 @@ import ModalImportSchema from '@/components/ModalImportSchema.vue'; import Application from '@/ipc-api/Application'; import Schema from '@/ipc-api/Schema'; import { copyText } from '@/libs/copyText'; +import { useConnectionsStore } from '@/stores/connections'; import { useNotificationsStore } from '@/stores/notifications'; import { useSchemaExportStore } from '@/stores/schemaExport'; import { useWorkspacesStore } from '@/stores/workspaces'; @@ -248,7 +249,9 @@ const workspacesStore = useWorkspacesStore(); const schemaExportStore = useSchemaExportStore(); const { showExportModal } = schemaExportStore; +const connectionsStore = useConnectionsStore(); const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore); +const { getConnectionByUid } = connectionsStore; const { getWorkspace, @@ -261,6 +264,7 @@ const isEditModal = ref(false); const isImportSchemaModal = ref(false); const workspace = computed(() => getWorkspace(selectedWorkspace.value)); +const connection = computed(() => getConnectionByUid(selectedWorkspace.value)); const openCreateTableTab = () => { emit('open-create-table-tab'); diff --git a/src/renderer/components/WorkspaceExploreBarTableContext.vue b/src/renderer/components/WorkspaceExploreBarTableContext.vue index 279584a1..a4b1faad 100644 --- a/src/renderer/components/WorkspaceExploreBarTableContext.vue +++ b/src/renderer/components/WorkspaceExploreBarTableContext.vue @@ -60,7 +60,7 @@ /> {{ t('application.settings') }}
@@ -72,7 +72,7 @@ /> {{ t('database.duplicateTable') }}
@@ -83,7 +83,11 @@ :size="18" /> {{ t('database.emptyTable') }}
-
+
getWorkspace(selectedWorkspace.value)); const customizations = computed(() => workspace.value && workspace.value.customizations ? workspace.value.customizations : null); +const connection = computed(() => getConnectionByUid(selectedWorkspace.value)); const showTableExportModal = () => { showExportModal(props.selectedSchema, props.selectedTable.name);