Avoid unnecessary redraws of the SQL pane.

pull/3/head
Dave Page 2016-02-17 10:43:02 +00:00
parent 131043d7cb
commit 2233583dbd
1 changed files with 7 additions and 3 deletions

View File

@ -45,14 +45,16 @@ function(_, $, pgBrowser) {
sql = '-- No SQL generated for the selected object.';
if (node.hasSQL) {
sql = '-- Please wait while we fetch the SQL from the server.';
sql = '';
var url = node.generate_url(item, 'sql', data, true);
$.ajax({
url: url,
type:'GET',
success: function(res) {
pgAdmin.Browser.editor.setValue(res);
if (pgAdmin.Browser.editor.getValue() != res) {
pgAdmin.Browser.editor.setValue(res);
}
},
error: function() {
// TODO:: Report this
@ -60,7 +62,9 @@ function(_, $, pgBrowser) {
});
}
}
pgAdmin.Browser.editor.setValue(sql);
if (sql != '') {
pgAdmin.Browser.editor.setValue(sql);
}
}, 400);
},
sqlPanelVisibilityChanged: function(panel) {