Skip to content

Commit

Permalink
fix(UI): multiple trigger tabs open on single click on explore bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Jul 19, 2021
1 parent e1855a2 commit e78ca24
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
3 changes: 0 additions & 3 deletions src/renderer/components/WorkspaceEmptyState.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<div class="empty-icon">
<img :src="require(`@/images/logo-${applicationTheme}.svg`).default" width="200">
</div>
<!-- <p class="empty-title h5">
{{ $t('message.appWelcome') }}
</p> -->
<p class="h6 empty-subtitle">
{{ $t('message.noOpenTabs') }}
</p>
Expand Down
16 changes: 1 addition & 15 deletions src/renderer/components/WorkspacePropsTabTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export default {
return {
isLoading: false,
isSaving: false,
isReady: false,
originalTrigger: null,
localTrigger: { sql: '' },
lastTrigger: null,
Expand Down Expand Up @@ -214,18 +213,6 @@ export default {
},
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 () {
Expand All @@ -234,7 +221,7 @@ export default {
window.addEventListener('keydown', this.onKey);
},
mounted () {
window.addEventListener('resize', this.resizeQueryEditor); ;
window.addEventListener('resize', this.resizeQueryEditor);
},
destroyed () {
window.removeEventListener('resize', this.resizeQueryEditor);
Expand Down Expand Up @@ -274,7 +261,6 @@ export default {
this.originalTrigger = response;
this.localTrigger = JSON.parse(JSON.stringify(this.originalTrigger));
this.sqlProxy = this.localTrigger.sql;
this.isReady = true;
if (this.customizations.triggerMultipleEvents) {
this.originalTrigger.event.forEach(e => {
Expand Down
22 changes: 17 additions & 5 deletions src/renderer/store/modules/workspaces.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,6 @@ export default {
};

commit('ADD_WORKSPACE', workspace);

// if (getters.getWorkspace(uid).tabs.length < 3)
// dispatch('newTab', { uid, type: 'query' });
},
changeBreadcrumbs ({ commit, getters }, payload) {
const breadcrumbsObj = {
Expand Down Expand Up @@ -615,8 +612,23 @@ export default {
const tempTabs = workspaceTabs ? workspaceTabs.tabs.filter(tab => tab.type === 'temp-trigger-props') : false;
if (tempTabs && tempTabs.length) { // if temp tab already opened
for (const tab of tempTabs) {
commit('REPLACE_TAB', { uid, tab: tab.uid, type, schema, elementName, elementType });
tabUid = tab.uid;
if (tab.isChanged) {
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 {
Expand Down

0 comments on commit e78ca24

Please sign in to comment.