mirror of https://github.com/Fabio286/antares.git
perf(UI): hide edit/delete functions in readonly mode
This commit is contained in:
parent
4df4c6197d
commit
37d44c95ee
|
@ -16,7 +16,7 @@
|
|||
/> {{ t('general.run') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedMisc.type === 'trigger' && customizations.triggerEnableDisable"
|
||||
v-if="selectedMisc.type === 'trigger' && customizations.triggerEnableDisable && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="toggleTrigger"
|
||||
>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedMisc.type === 'scheduler'"
|
||||
v-if="selectedMisc.type === 'scheduler' && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="toggleScheduler"
|
||||
>
|
||||
|
@ -63,7 +63,11 @@
|
|||
:size="18"
|
||||
/> {{ t('general.copyName') }}</span>
|
||||
</div>
|
||||
<div class="context-element" @click="showDeleteModal">
|
||||
<div
|
||||
v-if="!connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
|
@ -117,6 +121,7 @@ import Routines from '@/ipc-api/Routines';
|
|||
import Schedulers from '@/ipc-api/Schedulers';
|
||||
import Triggers from '@/ipc-api/Triggers';
|
||||
import { copyText } from '@/libs/copyText';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useNotificationsStore } from '@/stores/notifications';
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
|
||||
|
@ -132,6 +137,7 @@ const emit = defineEmits(['close-context', 'reload']);
|
|||
|
||||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { getConnectionByUid } = useConnectionsStore();
|
||||
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
|
@ -154,6 +160,7 @@ const workspace = computed(() => {
|
|||
const customizations = computed(() => {
|
||||
return getWorkspace(selectedWorkspace.value).customizations;
|
||||
});
|
||||
const connection = computed(() => getConnectionByUid(selectedWorkspace.value));
|
||||
|
||||
const deleteMessage = computed(() => {
|
||||
switch (props.selectedMisc.type) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
:context-event="contextEvent"
|
||||
@close-context="closeContext"
|
||||
>
|
||||
<div class="context-element">
|
||||
<div v-if="!connection.readonly" class="context-element">
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
|
@ -135,7 +135,7 @@
|
|||
/> {{ t('database.export') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaImport"
|
||||
v-if="workspace.customizations.schemaImport && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="initImport"
|
||||
>
|
||||
|
@ -147,7 +147,7 @@
|
|||
/> {{ t('database.import') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaEdit"
|
||||
v-if="workspace.customizations.schemaEdit && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showEditModal"
|
||||
>
|
||||
|
@ -159,7 +159,7 @@
|
|||
/> {{ t('database.editSchema') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="workspace.customizations.schemaDrop"
|
||||
v-if="workspace.customizations.schemaDrop && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
|
@ -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');
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
/> {{ t('application.settings') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedTable && selectedTable.type === 'table' && customizations.tableDuplicate"
|
||||
v-if="selectedTable && selectedTable.type === 'table' && customizations.tableDuplicate && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="duplicateTable"
|
||||
>
|
||||
|
@ -72,7 +72,7 @@
|
|||
/> {{ t('database.duplicateTable') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectedTable && selectedTable.type === 'table'"
|
||||
v-if="selectedTable && selectedTable.type === 'table' && !connection.readonly"
|
||||
class="context-element"
|
||||
@click="showEmptyModal"
|
||||
>
|
||||
|
@ -83,7 +83,11 @@
|
|||
:size="18"
|
||||
/> {{ t('database.emptyTable') }}</span>
|
||||
</div>
|
||||
<div class="context-element" @click="showDeleteModal">
|
||||
<div
|
||||
v-if="!connection.readonly"
|
||||
class="context-element"
|
||||
@click="showDeleteModal"
|
||||
>
|
||||
<span class="d-flex">
|
||||
<BaseIcon
|
||||
class="text-light mt-1 mr-1"
|
||||
|
@ -151,6 +155,7 @@ import BaseContextMenu from '@/components/BaseContextMenu.vue';
|
|||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import Tables from '@/ipc-api/Tables';
|
||||
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';
|
||||
|
@ -168,6 +173,7 @@ const emit = defineEmits(['close-context', 'duplicate-table', 'reload', 'delete-
|
|||
const { addNotification } = useNotificationsStore();
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { showExportModal } = useSchemaExportStore();
|
||||
const { getConnectionByUid } = useConnectionsStore();
|
||||
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
|
@ -185,6 +191,7 @@ const forceTruncate = ref(false);
|
|||
|
||||
const workspace = computed(() => 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);
|
||||
|
|
Loading…
Reference in New Issue