mirror of
https://github.com/Fabio286/antares.git
synced 2025-03-15 10:50:04 +01:00
fix(UI): multiple temp tabs opened switching to tables from other elements
This commit is contained in:
parent
622b519cbb
commit
b35fc5b78b
@ -322,7 +322,14 @@ export default {
|
||||
}
|
||||
},
|
||||
selectTable ({ schema, table }) {
|
||||
this.newTab({ uid: this.connection.uid, elementName: table.name, schema: this.database.name, type: 'temp-data', elementType: table.type });
|
||||
this.newTab({
|
||||
uid: this.connection.uid,
|
||||
elementName: table.name,
|
||||
schema: this.database.name,
|
||||
type: 'temp-data',
|
||||
elementType: table.type
|
||||
});
|
||||
|
||||
this.setBreadcrumbs({ schema, [table.type]: table.name });
|
||||
},
|
||||
selectMisc ({ schema, misc, type }) {
|
||||
|
@ -581,70 +581,7 @@ export default {
|
||||
const workspaceTabs = state.workspaces.find(workspace => workspace.uid === uid);
|
||||
|
||||
switch (type) {
|
||||
case 'temp-data': {
|
||||
const existentTab = workspaceTabs
|
||||
? workspaceTabs.tabs.find(tab =>
|
||||
tab.schema === schema &&
|
||||
tab.elementName === elementName &&
|
||||
tab.elementType === elementType &&
|
||||
['temp-data', 'data'].includes(tab.type))
|
||||
: false;
|
||||
|
||||
if (existentTab) { // if data tab exists
|
||||
tabUid = existentTab.uid;
|
||||
}
|
||||
else {
|
||||
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type === 'temp-data') : false;
|
||||
if (tempTabs && tempTabs.length) { // if temp table already opened
|
||||
for (const tab of tempTabs) {
|
||||
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, elementName, elementType });
|
||||
tabUid = tab.uid;
|
||||
}
|
||||
}
|
||||
else {
|
||||
tabUid = uidGen('T');
|
||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'data': {
|
||||
const existentTab = workspaceTabs
|
||||
? workspaceTabs.tabs.find(tab =>
|
||||
tab.schema === schema &&
|
||||
tab.elementName === elementName &&
|
||||
tab.elementType === elementType &&
|
||||
['temp-data', 'data'].includes(tab.type))
|
||||
: false;
|
||||
|
||||
if (existentTab) {
|
||||
commit('REPLACE_TAB', { uid, tab: existentTab.uid, type, schema, elementName, elementType });
|
||||
tabUid = existentTab.uid;
|
||||
}
|
||||
else {
|
||||
tabUid = uidGen('T');
|
||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'table-props': {
|
||||
const existentTab = workspaceTabs
|
||||
? workspaceTabs.tabs.find(tab =>
|
||||
tab.elementName === elementName &&
|
||||
tab.elementType === elementType &&
|
||||
tab.type === type)
|
||||
: false;
|
||||
|
||||
if (existentTab) {
|
||||
commit('REPLACE_TAB', { uid, tab: existentTab.uid, type, schema, elementName, elementType });
|
||||
tabUid = existentTab.uid;
|
||||
}
|
||||
else {
|
||||
tabUid = uidGen('T');
|
||||
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'temp-data':
|
||||
case 'temp-trigger-props':
|
||||
case 'temp-trigger-function-props':
|
||||
case 'temp-function-props':
|
||||
@ -663,6 +600,7 @@ export default {
|
||||
}
|
||||
else {
|
||||
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type.includes('temp-')) : false;
|
||||
|
||||
if (tempTabs && tempTabs.length) { // if temp tab already opened
|
||||
for (const tab of tempTabs) {
|
||||
if (tab.isChanged) {
|
||||
@ -691,6 +629,8 @@ export default {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
case 'table-props':
|
||||
case 'trigger-props':
|
||||
case 'trigger-function-props':
|
||||
case 'function-props':
|
||||
|
Loading…
x
Reference in New Issue
Block a user