Do not send the incomplete definition of a node object to the server

instead show proper message.

Tweaked by Ashesh for adding the proper message
This commit is contained in:
Khushboo Vashi 2016-05-10 12:34:20 +05:30 committed by Ashesh Vashi
parent e8b4bb909b
commit 7a400bacf3
2 changed files with 33 additions and 27 deletions

View File

@ -12,6 +12,7 @@ function(_, S, pgAdmin) {
'CLICK_FOR_DETAILED_MSG': '%s<br><br>' + '{{ _('Click here for details.')|safe }}',
'GENERAL_CATEGORY': '{{ _("General")|safe }}',
'SQL_TAB': '{{ _('SQL') }}',
'SQL_INCOMPLETE': '{{ _('Incomplete definition') }}',
'SQL_NO_CHANGE': '-- ' + '{{ _('Nothing changed')|safe }}',
'MUST_BE_INT' : "{{ _("'%%s' must be an integer.")|safe }}",
'MUST_BE_NUM' : "{{ _("'%%s' must be a numeric.")|safe }}",

View File

@ -1394,9 +1394,10 @@
// Fetch the information only if the SQL tab is visible at the moment.
if (this.dialog && obj.shown == this.tabIndex) {
// We will send request to sever only if something is changed in model
// We will send a request to the sever only if something has changed
// in a model and also it does not contain any error.
if(this.model.sessChanged()) {
if (_.size(this.model.errorModel.attributes) == 0) {
var self = this,
node = self.field.get('schema_node'),
msql_url = node.generate_url.apply(
@ -1425,7 +1426,11 @@
});
} else {
this.sqlCtrl.clearHistory();
this.sqlCtrl.setValue(window.pgAdmin.Browser.messages.SQL_NO_CHANGE);
this.sqlCtrl.setValue('-- ' + window.pgAdmin.Browser.messages.SQL_INCOMPLETE);
}
} else {
this.sqlCtrl.clearHistory();
this.sqlCtrl.setValue('-- ' + window.pgAdmin.Browser.messages.SQL_NO_CHANGE);
}
this.sqlCtrl.refresh.apply(this.sqlCtrl);
}