1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: query and data tabs keyboard shortcuts (F5, F9)

This commit is contained in:
2020-10-04 17:32:15 +02:00
parent d563cec70d
commit 0bf2c8dc9d
2 changed files with 24 additions and 2 deletions

View File

@ -8,6 +8,7 @@
class="btn btn-link btn-sm"
:class="{'loading':isQuering}"
:disabled="!query"
title="F9"
@click="runQuery(query)"
>
<span>{{ $t('word.run') }}</span>
@ -81,6 +82,12 @@ export default {
return this.getWorkspace(this.connection.uid);
}
},
created () {
window.addEventListener('keydown', this.onKey);
},
beforeDestroy () {
window.removeEventListener('keydown', this.onKey);
},
methods: {
...mapActions({
addNotification: 'notifications/addNotification',
@ -103,7 +110,7 @@ export default {
return [];
},
async runQuery (query) {
if (!query) return;
if (!query || this.isQuering) return;
this.isQuering = true;
this.clearTabData();
@ -217,6 +224,11 @@ export default {
this.resultsCount = false;
this.affectedCount = false;
this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] });
},
onKey (e) {
e.stopPropagation();
if (e.key === 'F9')
this.runQuery(this.query);
}
}
};