Ensure sort/filter dialog should display proper message after losing database connection. Fixes #3561

This commit is contained in:
Aditya Toshniwal
2018-08-22 16:38:31 +05:30
committed by Akshay Joshi
parent 0f17b4f738
commit 25679fd542
6 changed files with 88 additions and 46 deletions

View File

@@ -7,17 +7,32 @@ import Backform from 'pgadmin.backform';
import axios from 'axios';
import queryToolActions from 'sources/sqleditor/query_tool_actions';
import filterDialogModel from 'sources/sqleditor/filter_dialog_model';
import {handleQueryToolAjaxError} from 'sources/sqleditor/query_tool_http_error_handler';
let FilterDialog = {
'dialog': function(handler) {
geturl: function(transId, reconnect) {
let url = url_for('sqleditor.get_filter_data', {
'trans_id': transId,
});
if(reconnect) {
url += '?connect=1';
}
return url;
},
'dialog': function(handler, reconnect) {
let title = gettext('Sort/Filter options');
axios.get(
url_for('sqleditor.get_filter_data', {
'trans_id': handler.transId,
}),
{ headers: {'Cache-Control' : 'no-cache'} }
).then(function (res) {
let response = res.data.data.result;
$.ajax({
url: this.geturl(handler.transId, reconnect),
headers: {
'Cache-Control' : 'no-cache',
},
})
.done(function (res) {
let response = res.data.result;
// Check the alertify dialog already loaded then delete it to clear
// the cache
@@ -234,6 +249,9 @@ let FilterDialog = {
});
Alertify.filterDialog(title).resizeTo('65%', '60%');
})
.fail(function(e) {
handleQueryToolAjaxError(pgAdmin, handler, e, '_show_filter', [], true);
});
},
};