1
1
mirror of https://github.com/Fabio286/antares.git synced 2024-12-17 19:31:26 +01:00

fix: query tab content disappears reordering or closing other tabs, closes #261

This commit is contained in:
Fabio Di Stasio 2022-05-15 18:15:05 +02:00
parent a082514f88
commit c5baf2b0d3

View File

@ -255,7 +255,8 @@ export default {
durationsCount: 0, durationsCount: 0,
affectedCount: null, affectedCount: null,
editorHeight: 200, editorHeight: 200,
isHistoryOpen: false isHistoryOpen: false,
debounceTimeout: null
}; };
}, },
computed: { computed: {
@ -285,6 +286,19 @@ export default {
} }
}, },
watch: { watch: {
query (val) {
clearTimeout(this.debounceTimeout);
this.debounceTimeout = setTimeout(() => {
this.updateTabContent({
uid: this.connection.uid,
tab: this.tab.uid,
type: 'query',
schema: this.selectedSchema,
content: val
});
}, 200);
},
isSelected (val) { isSelected (val) {
if (val) { if (val) {
this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` }); this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` });
@ -357,13 +371,6 @@ export default {
return acc + (curr.report ? curr.report.affectedRows : 0); return acc + (curr.report ? curr.report.affectedRows : 0);
}, null); }, null);
this.updateTabContent({
uid: this.connection.uid,
tab: this.tab.uid,
type: 'query',
schema: this.selectedSchema,
content: query
});
this.saveHistory(params); this.saveHistory(params);
if (!this.autocommit) if (!this.autocommit)
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: true }); this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: true });