fix: missing tabs uid

This commit is contained in:
Fabio Di Stasio 2022-04-30 17:15:33 +02:00
parent cdbadbb11a
commit 18b66b5032
19 changed files with 35 additions and 49 deletions

View File

@ -295,7 +295,7 @@ export default {
this.stopRefresh(); this.stopRefresh();
this.selectedCell = cell; this.selectedCell = cell;
this.selectedRow = cell.id; this.selectedRow = Number(cell.id);
this.contextEvent = event; this.contextEvent = event;
this.isContext = true; this.isContext = true;
}, },

View File

@ -13,6 +13,7 @@ import * as ace from 'ace-builds';
import 'ace-builds/webpack-resolver'; import 'ace-builds/webpack-resolver';
import '../libs/ext-language_tools'; import '../libs/ext-language_tools';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { uidGen } from 'common/libs/uidGen';
import { useApplicationStore } from '@/stores/application'; import { useApplicationStore } from '@/stores/application';
import { useSettingsStore } from '@/stores/settings'; import { useSettingsStore } from '@/stores/settings';
import Tables from '@/ipc-api/Tables'; import Tables from '@/ipc-api/Tables';
@ -59,7 +60,7 @@ export default {
cursorPosition: 0, cursorPosition: 0,
fields: [], fields: [],
customCompleter: [], customCompleter: [],
id: null, id: uidGen(),
lastSchema: null lastSchema: null
}; };
}, },
@ -226,7 +227,6 @@ export default {
} }
}, },
created () { created () {
this.id = this._uid;
this.lastSchema = this.schema; this.lastSchema = this.schema;
}, },
mounted () { mounted () {

View File

@ -319,6 +319,7 @@
<WorkspaceTabQuery <WorkspaceTabQuery
v-if="tab.type==='query'" v-if="tab.type==='query'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:connection="connection" :connection="connection"
@ -326,6 +327,7 @@
<WorkspaceTabTable <WorkspaceTabTable
v-else-if="['temp-data', 'data'].includes(tab.type)" v-else-if="['temp-data', 'data'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:table="tab.elementName" :table="tab.elementName"
@ -335,6 +337,7 @@
<WorkspaceTabNewTable <WorkspaceTabNewTable
v-else-if="tab.type === 'new-table'" v-else-if="tab.type === 'new-table'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -343,6 +346,7 @@
<WorkspaceTabPropsTable <WorkspaceTabPropsTable
v-else-if="tab.type === 'table-props'" v-else-if="tab.type === 'table-props'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:table="tab.elementName" :table="tab.elementName"
@ -351,6 +355,7 @@
<WorkspaceTabNewView <WorkspaceTabNewView
v-else-if="tab.type === 'new-view'" v-else-if="tab.type === 'new-view'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -359,6 +364,7 @@
<WorkspaceTabPropsView <WorkspaceTabPropsView
v-else-if="tab.type === 'view-props'" v-else-if="tab.type === 'view-props'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:connection="connection" :connection="connection"
:view="tab.elementName" :view="tab.elementName"
@ -367,6 +373,7 @@
<WorkspaceTabNewTrigger <WorkspaceTabNewTrigger
v-else-if="tab.type === 'new-trigger'" v-else-if="tab.type === 'new-trigger'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -376,6 +383,7 @@
<WorkspaceTabPropsTrigger <WorkspaceTabPropsTrigger
v-else-if="['temp-trigger-props', 'trigger-props'].includes(tab.type)" v-else-if="['temp-trigger-props', 'trigger-props'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:trigger="tab.elementName" :trigger="tab.elementName"
@ -384,6 +392,7 @@
<WorkspaceTabNewTriggerFunction <WorkspaceTabNewTriggerFunction
v-else-if="tab.type === 'new-trigger-function'" v-else-if="tab.type === 'new-trigger-function'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -393,6 +402,7 @@
<WorkspaceTabPropsTriggerFunction <WorkspaceTabPropsTriggerFunction
v-else-if="['temp-trigger-function-props', 'trigger-function-props'].includes(tab.type)" v-else-if="['temp-trigger-function-props', 'trigger-function-props'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:function="tab.elementName" :function="tab.elementName"
@ -401,6 +411,7 @@
<WorkspaceTabNewRoutine <WorkspaceTabNewRoutine
v-else-if="tab.type === 'new-routine'" v-else-if="tab.type === 'new-routine'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -410,6 +421,7 @@
<WorkspaceTabPropsRoutine <WorkspaceTabPropsRoutine
v-else-if="['temp-routine-props', 'routine-props'].includes(tab.type)" v-else-if="['temp-routine-props', 'routine-props'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:routine="tab.elementName" :routine="tab.elementName"
@ -418,6 +430,7 @@
<WorkspaceTabNewFunction <WorkspaceTabNewFunction
v-else-if="tab.type === 'new-function'" v-else-if="tab.type === 'new-function'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -427,6 +440,7 @@
<WorkspaceTabPropsFunction <WorkspaceTabPropsFunction
v-else-if="['temp-function-props', 'function-props'].includes(tab.type)" v-else-if="['temp-function-props', 'function-props'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:function="tab.elementName" :function="tab.elementName"
@ -435,6 +449,7 @@
<WorkspaceTabNewScheduler <WorkspaceTabNewScheduler
v-else-if="tab.type === 'new-scheduler'" v-else-if="tab.type === 'new-scheduler'"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:tab="tab" :tab="tab"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
@ -444,6 +459,7 @@
<WorkspaceTabPropsScheduler <WorkspaceTabPropsScheduler
v-else-if="['temp-scheduler-props', 'scheduler-props'].includes(tab.type)" v-else-if="['temp-scheduler-props', 'scheduler-props'].includes(tab.type)"
:key="tab.uid" :key="tab.uid"
:tab-uid="tab.uid"
:connection="connection" :connection="connection"
:is-selected="selectedTab === tab.uid" :is-selected="selectedTab === tab.uid"
:scheduler="tab.elementName" :scheduler="tab.elementName"

View File

@ -219,6 +219,7 @@ export default {
WorkspaceTabPropsFunctionParamsModal WorkspaceTabPropsFunctionParamsModal
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -271,9 +272,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction); return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction);
}, },

View File

@ -179,6 +179,7 @@ export default {
WorkspaceTabPropsRoutineParamsModal WorkspaceTabPropsRoutineParamsModal
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -231,9 +232,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalRoutine) !== JSON.stringify(this.localRoutine); return JSON.stringify(this.originalRoutine) !== JSON.stringify(this.localRoutine);
}, },

View File

@ -158,6 +158,7 @@ export default {
WorkspaceTabPropsSchedulerTimingModal WorkspaceTabPropsSchedulerTimingModal
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -207,9 +208,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalScheduler) !== JSON.stringify(this.localScheduler); return JSON.stringify(this.originalScheduler) !== JSON.stringify(this.localScheduler);
}, },

View File

@ -186,6 +186,7 @@ export default {
WorkspaceTabNewTableEmptyState WorkspaceTabNewTableEmptyState
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -244,9 +245,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
defaultCollation () { defaultCollation () {
if (this.workspace.customizations.collations) if (this.workspace.customizations.collations)
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || ''; return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || '';

View File

@ -146,6 +146,7 @@ export default {
QueryEditor QueryEditor
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -195,9 +196,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },

View File

@ -122,6 +122,7 @@ export default {
QueryEditor QueryEditor
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -175,9 +176,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction); return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction);
}, },

View File

@ -135,6 +135,7 @@ export default {
QueryEditor QueryEditor
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean, isSelected: Boolean,
@ -183,9 +184,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalView) !== JSON.stringify(this.localView); return JSON.stringify(this.originalView) !== JSON.stringify(this.localView);
}, },

View File

@ -241,6 +241,7 @@ export default {
ModalAskParameters ModalAskParameters
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
function: String, function: String,
isSelected: Boolean, isSelected: Boolean,
@ -292,9 +293,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction); return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction);
}, },

View File

@ -152,7 +152,6 @@
<label class="form-label ml-2">{{ $t('message.routineBody') }}</label> <label class="form-label ml-2">{{ $t('message.routineBody') }}</label>
<QueryEditor <QueryEditor
v-show="isSelected" v-show="isSelected"
:key="`${routine}-${_uid}`"
ref="queryEditor" ref="queryEditor"
v-model="localRoutine.sql" v-model="localRoutine.sql"
:workspace="workspace" :workspace="workspace"
@ -198,6 +197,7 @@ export default {
ModalAskParameters ModalAskParameters
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
routine: String, routine: String,
isSelected: Boolean, isSelected: Boolean,
@ -249,9 +249,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalRoutine) !== JSON.stringify(this.localRoutine); return JSON.stringify(this.originalRoutine) !== JSON.stringify(this.localRoutine);
}, },

View File

@ -157,6 +157,7 @@ export default {
WorkspaceTabPropsSchedulerTimingModal WorkspaceTabPropsSchedulerTimingModal
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
scheduler: String, scheduler: String,
isSelected: Boolean, isSelected: Boolean,
@ -204,9 +205,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalScheduler) !== JSON.stringify(this.localScheduler); return JSON.stringify(this.originalScheduler) !== JSON.stringify(this.localScheduler);
}, },

View File

@ -196,6 +196,7 @@ export default {
WorkspaceTabPropsTableForeignModal WorkspaceTabPropsTableForeignModal
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
isSelected: Boolean, isSelected: Boolean,
table: String, table: String,
@ -250,9 +251,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
defaultEngine () { defaultEngine () {
const engine = this.getDatabaseVariable(this.connection.uid, 'default_storage_engine'); const engine = this.getDatabaseVariable(this.connection.uid, 'default_storage_engine');
return engine ? engine.value : ''; return engine ? engine.value : '';

View File

@ -344,6 +344,7 @@
<script> <script>
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useNotificationsStore } from '@/stores/notifications';
import { useWorkspacesStore } from '@/stores/workspaces'; import { useWorkspacesStore } from '@/stores/workspaces';
import ConfirmModal from '@/components/BaseConfirmModal'; import ConfirmModal from '@/components/BaseConfirmModal';

View File

@ -145,6 +145,7 @@ export default {
QueryEditor QueryEditor
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
trigger: String, trigger: String,
isSelected: Boolean, isSelected: Boolean,
@ -192,9 +193,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },

View File

@ -119,6 +119,7 @@ export default {
ModalAskParameters ModalAskParameters
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
function: String, function: String,
isSelected: Boolean, isSelected: Boolean,
@ -170,9 +171,6 @@ export default {
customizations () { customizations () {
return this.workspace.customizations; return this.workspace.customizations;
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction); return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction);
}, },

View File

@ -134,6 +134,7 @@ export default {
QueryEditor QueryEditor
}, },
props: { props: {
tabUid: String,
connection: Object, connection: Object,
isSelected: Boolean, isSelected: Boolean,
schema: String, schema: String,
@ -178,9 +179,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
isChanged () { isChanged () {
return JSON.stringify(this.originalView) !== JSON.stringify(this.localView); return JSON.stringify(this.originalView) !== JSON.stringify(this.localView);
}, },

View File

@ -211,6 +211,7 @@ export default {
}, },
mixins: [tableTabs], mixins: [tableTabs],
props: { props: {
tabUid: String,
connection: Object, connection: Object,
tab: Object, tab: Object,
isSelected: Boolean isSelected: Boolean
@ -261,9 +262,6 @@ export default {
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
tabUid () {
return this.$vnode?.key;
},
breadcrumbsSchema () { breadcrumbsSchema () {
return this.workspace.breadcrumbs.schema || null; return this.workspace.breadcrumbs.schema || null;
}, },