mirror of https://github.com/Fabio286/antares.git
feat: query and data tabs keyboard shortcuts (F5, F9)
This commit is contained in:
parent
d563cec70d
commit
0bf2c8dc9d
|
@ -8,6 +8,7 @@
|
||||||
class="btn btn-link btn-sm"
|
class="btn btn-link btn-sm"
|
||||||
:class="{'loading':isQuering}"
|
:class="{'loading':isQuering}"
|
||||||
:disabled="!query"
|
:disabled="!query"
|
||||||
|
title="F9"
|
||||||
@click="runQuery(query)"
|
@click="runQuery(query)"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.run') }}</span>
|
<span>{{ $t('word.run') }}</span>
|
||||||
|
@ -81,6 +82,12 @@ export default {
|
||||||
return this.getWorkspace(this.connection.uid);
|
return this.getWorkspace(this.connection.uid);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification',
|
addNotification: 'notifications/addNotification',
|
||||||
|
@ -103,7 +110,7 @@ export default {
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
async runQuery (query) {
|
async runQuery (query) {
|
||||||
if (!query) return;
|
if (!query || this.isQuering) return;
|
||||||
this.isQuering = true;
|
this.isQuering = true;
|
||||||
this.clearTabData();
|
this.clearTabData();
|
||||||
|
|
||||||
|
@ -217,6 +224,11 @@ export default {
|
||||||
this.resultsCount = false;
|
this.resultsCount = false;
|
||||||
this.affectedCount = false;
|
this.affectedCount = false;
|
||||||
this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] });
|
this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] });
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.key === 'F9')
|
||||||
|
this.runQuery(this.query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<button
|
<button
|
||||||
class="btn btn-link btn-sm"
|
class="btn btn-link btn-sm"
|
||||||
:class="{'loading':isQuering}"
|
:class="{'loading':isQuering}"
|
||||||
|
title="F5"
|
||||||
@click="reloadTable"
|
@click="reloadTable"
|
||||||
>
|
>
|
||||||
<span>{{ $t('word.refresh') }}</span>
|
<span>{{ $t('word.refresh') }}</span>
|
||||||
|
@ -108,6 +109,10 @@ export default {
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
|
window.addEventListener('keydown', this.onKey);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
|
@ -176,13 +181,18 @@ export default {
|
||||||
return this.table;
|
return this.table;
|
||||||
},
|
},
|
||||||
reloadTable () {
|
reloadTable () {
|
||||||
this.getTableData();
|
if (!this.isQuering) this.getTableData();
|
||||||
},
|
},
|
||||||
showAddModal () {
|
showAddModal () {
|
||||||
this.isAddModal = true;
|
this.isAddModal = true;
|
||||||
},
|
},
|
||||||
hideAddModal () {
|
hideAddModal () {
|
||||||
this.isAddModal = false;
|
this.isAddModal = false;
|
||||||
|
},
|
||||||
|
onKey (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (e.key === 'F5')
|
||||||
|
this.reloadTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue