Skip to content

Commit

Permalink
fix: issues with trigger temp tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Jul 17, 2021
1 parent f6faad9 commit 6b725b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
8 changes: 7 additions & 1 deletion src/renderer/components/WorkspaceExploreBarSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,13 @@ export default {
trigger: 'trigger-props'
};
this.newTab({ uid: this.connection.uid, elementName: misc.name, schema: this.database.name, type: miscTabs[type], elementType: type });
this.newTab({
uid: this.connection.uid,
elementName: misc.name,
schema: this.database.name,
type: miscTabs[type],
elementType: type
});
this.setBreadcrumbs({ schema, [type]: misc.name });
},
showSchemaContext (event, schema) {
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/WorkspacePropsTabTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export default {
return {
isLoading: false,
isSaving: false,
isReady: false,
originalTrigger: null,
localTrigger: { sql: '' },
lastTrigger: null,
Expand Down Expand Up @@ -211,10 +212,10 @@ export default {
this.getTriggerData();
}
},
isChanged (val, oldVal) {
isChanged (val) {
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
if (val && !oldVal) {
if (val) {
const triggerName = this.customizations.triggerTableInName ? `${this.originalTrigger.table}.${this.originalTrigger.name}` : this.originalTrigger.name;
this.newTab({
Expand All @@ -233,7 +234,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 @@ -273,6 +274,7 @@ 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
16 changes: 8 additions & 8 deletions src/renderer/store/modules/workspaces.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ export default {
const existentTab = workspaceTabs
? workspaceTabs.tabs.find(tab =>
tab.schema === schema &&
tab.elementName === elementName &&
tab.elementType === elementType &&
['temp-data', 'data'].includes(tab.type))
tab.elementName === elementName &&
tab.elementType === elementType &&
['temp-data', 'data'].includes(tab.type))
: false;

if (existentTab) {
Expand All @@ -585,8 +585,8 @@ export default {
const existentTab = workspaceTabs
? workspaceTabs.tabs.find(tab =>
tab.elementName === elementName &&
tab.elementType === elementType &&
tab.type === type)
tab.elementType === elementType &&
tab.type === type)
: false;

if (existentTab) {
Expand All @@ -603,9 +603,9 @@ export default {
const existentTab = workspaceTabs
? workspaceTabs.tabs.find(tab =>
tab.schema === schema &&
tab.elementName === elementName &&
tab.elementType === elementType &&
['temp-trigger-props', 'trigger-props'].includes(tab.type))
tab.elementName === elementName &&
tab.elementType === elementType &&
['temp-trigger-props', 'trigger-props'].includes(tab.type))
: false;

if (existentTab) { // if tab exists
Expand Down

0 comments on commit 6b725b1

Please sign in to comment.