mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-20 11:48:31 -06:00
Cleanup and fix handling of Query Tool Cancel button status. Fixes #3319
This commit is contained in:
parent
b390c033cf
commit
d53c47e1cf
@ -17,4 +17,5 @@ Bug fixes
|
||||
*********
|
||||
|
||||
| `Bug #3309 <https://redmine.postgresql.org/issues/3309>`_ - Fix Directory format support for backups.
|
||||
| `Bug #3319 <https://redmine.postgresql.org/issues/3319>`_ - Cleanup and fix handling of Query Tool Cancel button status.
|
||||
| `Bug #3457 <https://redmine.postgresql.org/issues/3457>`_ - Fix debugging of procedures in EPAS packages.
|
||||
|
@ -240,12 +240,10 @@ class ExecuteQuery {
|
||||
|
||||
enableSQLEditorButtons() {
|
||||
this.sqlServerObject.disable_tool_buttons(false);
|
||||
$('#btn-cancel-query').prop('disabled', true);
|
||||
}
|
||||
|
||||
disableSQLEditorButtons() {
|
||||
this.sqlServerObject.disable_tool_buttons(true);
|
||||
$('#btn-cancel-query').prop('disabled', false);
|
||||
}
|
||||
|
||||
static wasConnectionLostToPythonServer(httpResponse) {
|
||||
|
@ -3370,6 +3370,10 @@ define('tools.querytool', [
|
||||
$('#btn-edit-dropdown').prop('disabled', disabled);
|
||||
$('#btn-edit').prop('disabled', disabled);
|
||||
$('#btn-load-file').prop('disabled', disabled);
|
||||
if (this.is_query_tool) {
|
||||
// Cancel query tool needs opposite behaviour
|
||||
$('#btn-cancel-query').prop('disabled', !disabled);
|
||||
}
|
||||
},
|
||||
|
||||
// This function will fetch the sql query from the text box
|
||||
@ -3461,8 +3465,6 @@ define('tools.querytool', [
|
||||
// This function will cancel the running query.
|
||||
_cancel_query: function() {
|
||||
var self = this;
|
||||
|
||||
$('#btn-cancel-query').prop('disabled', true);
|
||||
$.ajax({
|
||||
url: url_for('sqleditor.cancel_transaction', {
|
||||
'trans_id': self.transId,
|
||||
@ -3470,12 +3472,10 @@ define('tools.querytool', [
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
success: function(res) {
|
||||
if (res.data.status) {
|
||||
self.disable_tool_buttons(false);
|
||||
} else {
|
||||
self.disable_tool_buttons(false);
|
||||
if (!res.data.status) {
|
||||
alertify.alert(gettext('Cancel Query Error'), res.data.result);
|
||||
}
|
||||
self.disable_tool_buttons(false);
|
||||
is_query_running = false;
|
||||
setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
|
||||
},
|
||||
|
@ -228,15 +228,6 @@ describe('ExecuteQuery', () => {
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when query was cancelled', () => {
|
||||
@ -333,15 +324,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should not login is displayed', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
@ -406,15 +388,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should login is displayed', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
@ -483,15 +456,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should login is not displayed', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
@ -558,15 +522,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should login is displayed', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
@ -630,15 +585,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy)
|
||||
.toHaveBeenCalledWith('disabled', true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should login is not displayed', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
@ -970,14 +916,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should not disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
expect(cancelButtonSpy).not
|
||||
.toHaveBeenCalled();
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when cannot reach the Python Server', () => {
|
||||
@ -1251,15 +1189,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('disable the cancel query button', (done) => {
|
||||
setTimeout(() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('enable the query tool buttons', (done) => {
|
||||
setTimeout(() => {
|
||||
expect(sqlEditorMock.disable_tool_buttons).toHaveBeenCalledWith(false);
|
||||
@ -1369,16 +1298,6 @@ describe('ExecuteQuery', () => {
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when error is returned by the server', () => {
|
||||
@ -1428,16 +1347,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should not save the state', () => {
|
||||
setTimeout(() => {
|
||||
expect(sqlEditorMock.saveState).not.toHaveBeenCalled();
|
||||
@ -1496,16 +1405,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should save the state', () => {
|
||||
setTimeout(() => {
|
||||
expect(sqlEditorMock.saveState).toHaveBeenCalledWith(
|
||||
@ -1567,16 +1466,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should not save the state', () => {
|
||||
setTimeout(() => {
|
||||
expect(sqlEditorMock.saveState).not.toHaveBeenCalled();
|
||||
@ -1641,16 +1530,6 @@ describe('ExecuteQuery', () => {
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should disable the cancel button', (done) => {
|
||||
setTimeout(
|
||||
() => {
|
||||
let buttonFlash = $('#btn-cancel-query');
|
||||
|
||||
expect(buttonFlash.prop('disabled')).toEqual(true);
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should save the state', () => {
|
||||
setTimeout(() => {
|
||||
expect(sqlEditorMock.saveState).toHaveBeenCalledWith(
|
||||
|
Loading…
Reference in New Issue
Block a user