mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Prevent a query being executed whilst one is already in progress. Fixes #1532
This commit is contained in:
parent
a3e8ba93ae
commit
6d839a2924
@ -32,6 +32,8 @@ define(
|
|||||||
F7_KEY = 118,
|
F7_KEY = 118,
|
||||||
F8_KEY = 119;
|
F8_KEY = 119;
|
||||||
|
|
||||||
|
var is_query_running = false;
|
||||||
|
|
||||||
// Defining the backbone model for the sql grid
|
// Defining the backbone model for the sql grid
|
||||||
var sqlEditorViewModel = Backbone.Model.extend({
|
var sqlEditorViewModel = Backbone.Model.extend({
|
||||||
|
|
||||||
@ -1049,6 +1051,9 @@ define(
|
|||||||
* Shift+F7 - Explain analyze query
|
* Shift+F7 - Explain analyze query
|
||||||
*/
|
*/
|
||||||
keyAction: function(ev) {
|
keyAction: function(ev) {
|
||||||
|
// return if query is running
|
||||||
|
if (is_query_running) return;
|
||||||
|
|
||||||
var keyCode = ev.which || ev.keyCode;
|
var keyCode = ev.which || ev.keyCode;
|
||||||
if (ev.shiftKey && keyCode == F7_KEY) {
|
if (ev.shiftKey && keyCode == F7_KEY) {
|
||||||
// Explain analyze query.
|
// Explain analyze query.
|
||||||
@ -1294,10 +1299,12 @@ define(
|
|||||||
self.disable_tool_buttons(false);
|
self.disable_tool_buttons(false);
|
||||||
$("#btn-cancel-query").prop('disabled', true);
|
$("#btn-cancel-query").prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
is_query_running = false;
|
||||||
}
|
}
|
||||||
else if (res.data.status === 'Busy') {
|
else if (res.data.status === 'Busy') {
|
||||||
// If status is Busy then poll the result by recursive call to the poll function
|
// If status is Busy then poll the result by recursive call to the poll function
|
||||||
self._poll();
|
self._poll();
|
||||||
|
is_query_running = true;
|
||||||
}
|
}
|
||||||
else if (res.data.status === 'NotConnected') {
|
else if (res.data.status === 'NotConnected') {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user