mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Improve network/server activity feedback for the user. Fixes #1751
This commit is contained in:
committed by
Dave Page
parent
f9dacc5237
commit
3b4776ab5f
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
'underscore', 'underscore.string', 'jquery', 'pgadmin.browser',
|
||||
'alertify', 'pgadmin.alertifyjs'
|
||||
'alertify', 'pgadmin.alertifyjs', 'pgadmin.browser.messages',
|
||||
], function(_, S, $, pgBrowser, Alertify) {
|
||||
|
||||
pgBrowser.ShowNodeSQL = pgBrowser.ShowNodeSQL || {};
|
||||
@@ -84,15 +84,25 @@ define([
|
||||
if (node.hasSQL) {
|
||||
|
||||
sql = '';
|
||||
var url = node.generate_url(item, 'sql', data, true);
|
||||
var url = node.generate_url(item, 'sql', data, true),
|
||||
timer;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:'GET',
|
||||
beforeSend: function(jqXHR, settings) {
|
||||
// Generate a timer for the request
|
||||
timer = setTimeout(function(){
|
||||
// notify user if request is taking longer than 1 second
|
||||
|
||||
pgAdmin.Browser.editor.setValue(pgBrowser.messages['LOADING_MESSAGE']);
|
||||
}, 1000);
|
||||
},
|
||||
success: function(res) {
|
||||
if (pgAdmin.Browser.editor.getValue() != res) {
|
||||
pgAdmin.Browser.editor.setValue(res);
|
||||
}
|
||||
clearTimeout(timer);
|
||||
},
|
||||
error: function(xhr, error, message) {
|
||||
var _label = treeHierarchy[n_type].label;
|
||||
|
||||
Reference in New Issue
Block a user