fix: issues with trigger temp tabs

This commit is contained in:
Fabio Di Stasio 2021-07-17 16:09:57 +02:00
parent f6faad98f8
commit 6b725b1d40
3 changed files with 20 additions and 12 deletions

View File

@ -310,7 +310,13 @@ export default {
trigger: 'trigger-props' 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 }); this.setBreadcrumbs({ schema, [type]: misc.name });
}, },
showSchemaContext (event, schema) { showSchemaContext (event, schema) {

View File

@ -152,6 +152,7 @@ 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,
@ -211,10 +212,10 @@ export default {
this.getTriggerData(); this.getTriggerData();
} }
}, },
isChanged (val, oldVal) { 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 && !oldVal) { if (val) {
const triggerName = this.customizations.triggerTableInName ? `${this.originalTrigger.table}.${this.originalTrigger.name}` : this.originalTrigger.name; const triggerName = this.customizations.triggerTableInName ? `${this.originalTrigger.table}.${this.originalTrigger.name}` : this.originalTrigger.name;
this.newTab({ this.newTab({
@ -233,7 +234,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);
@ -273,6 +274,7 @@ 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

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