1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-18 12:40:41 +01:00

fix: prevents F5 shortcut to run in non-selected workspaces

This commit is contained in:
Fabio Di Stasio 2021-02-18 18:01:12 +01:00
parent 94c4952319
commit 7c4ca999ce
2 changed files with 11 additions and 6 deletions

View File

@ -17,7 +17,7 @@
class="btn btn-primary btn-sm" class="btn btn-primary btn-sm"
:class="{'loading':isQuering}" :class="{'loading':isQuering}"
:disabled="!query" :disabled="!query"
title="F9" title="F5"
@click="runQuery(query)" @click="runQuery(query)"
> >
<span>{{ $t('word.run') }}</span> <span>{{ $t('word.run') }}</span>
@ -89,10 +89,14 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace',
selectedWorkspace: 'workspaces/getSelected'
}), }),
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
},
isWorkspaceSelected () {
return this.workspace.uid === this.selectedWorkspace;
} }
}, },
created () { created () {
@ -169,9 +173,9 @@ export default {
this.$refs.queryEditor.editor.resize(); this.$refs.queryEditor.editor.resize();
}, },
onKey (e) { onKey (e) {
if (this.isSelected) { if (this.isSelected && this.isWorkspaceSelected) {
e.stopPropagation(); e.stopPropagation();
if (e.key === 'F9') if (e.key === 'F5')
this.runQuery(this.query); this.runQuery(this.query);
} }
} }

View File

@ -142,13 +142,14 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace',
selectedWorkspace: 'workspaces/getSelected'
}), }),
workspace () { workspace () {
return this.getWorkspace(this.connection.uid); return this.getWorkspace(this.connection.uid);
}, },
isSelected () { isSelected () {
return this.workspace.selected_tab === 'data'; return this.workspace.selected_tab === 'data' && this.workspace.uid === this.selectedWorkspace;
}, },
isTable () { isTable () {
return !!this.workspace.breadcrumbs.table; return !!this.workspace.breadcrumbs.table;