1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix(UI): multiple trigger tabs open on single click on explore bar

This commit is contained in:
2021-07-19 11:28:11 +02:00
parent e1855a262d
commit e78ca2417e
3 changed files with 18 additions and 23 deletions

View File

@ -3,9 +3,6 @@
<div class="empty-icon"> <div class="empty-icon">
<img :src="require(`@/images/logo-${applicationTheme}.svg`).default" width="200"> <img :src="require(`@/images/logo-${applicationTheme}.svg`).default" width="200">
</div> </div>
<!-- <p class="empty-title h5">
{{ $t('message.appWelcome') }}
</p> -->
<p class="h6 empty-subtitle"> <p class="h6 empty-subtitle">
{{ $t('message.noOpenTabs') }} {{ $t('message.noOpenTabs') }}
</p> </p>

View File

@ -152,7 +152,6 @@ export default {
return { return {
isLoading: false, isLoading: false,
isSaving: false, isSaving: false,
isReady: false,
originalTrigger: null, originalTrigger: null,
localTrigger: { sql: '' }, localTrigger: { sql: '' },
lastTrigger: null, lastTrigger: null,
@ -214,18 +213,6 @@ export default {
}, },
isChanged (val) { isChanged (val) {
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val }); this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
if (val) {
const triggerName = this.customizations.triggerTableInName ? `${this.originalTrigger.table}.${this.originalTrigger.name}` : this.originalTrigger.name;
this.newTab({
uid: this.connection.uid,
elementName: triggerName,
schema: this.schema,
type: 'trigger-props',
elementType: 'trigger'
});
}
} }
}, },
async created () { async created () {
@ -234,7 +221,7 @@ export default {
window.addEventListener('keydown', this.onKey); window.addEventListener('keydown', this.onKey);
}, },
mounted () { mounted () {
window.addEventListener('resize', this.resizeQueryEditor); ; window.addEventListener('resize', this.resizeQueryEditor);
}, },
destroyed () { destroyed () {
window.removeEventListener('resize', this.resizeQueryEditor); window.removeEventListener('resize', this.resizeQueryEditor);
@ -274,7 +261,6 @@ export default {
this.originalTrigger = response; this.originalTrigger = response;
this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger)); this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger));
this.sqlProxy = this.localTrigger.sql; this.sqlProxy = this.localTrigger.sql;
this.isReady = true;
if (this.customizations.triggerMultipleEvents) { if (this.customizations.triggerMultipleEvents) {
this.originalTrigger.event.forEach(e => { this.originalTrigger.event.forEach(e => {

View File

@ -497,9 +497,6 @@ export default {
}; };
commit('ADD_WORKSPACE', workspace); commit('ADD_WORKSPACE', workspace);
// if (getters.getWorkspace(uid).tabs.length < 3)
// dispatch('newTab', { uid, type: 'query' });
}, },
changeBreadcrumbs ({ commit, getters }, payload) { changeBreadcrumbs ({ commit, getters }, payload) {
const breadcrumbsObj = { const breadcrumbsObj = {
@ -615,8 +612,23 @@ export default {
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type === 'temp-trigger-props') : false; const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type === 'temp-trigger-props') : false;
if (tempTabs && tempTabs.length) { // if temp tab already opened if (tempTabs && tempTabs.length) { // if temp tab already opened
for (const tab of tempTabs) { for (const tab of tempTabs) {
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, elementName, elementType }); if (tab.isChanged) {
tabUid = tab.uid; commit('REPLACE_TAB', { // make permanent a temp table with unsaved changes
uid,
tab: tab.uid,
type: 'trigger-props',
schema: tab.schema,
elementName: tab.elementName,
elementType: tab.elementType
});
tabUid = uidGen('T');
commit('NEW_TAB', { uid, tab: tabUid, content, type, autorun, schema, elementName, elementType });
}
else {
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, elementName, elementType });
tabUid = tab.uid;
}
} }
} }
else { else {