mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
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:
parent
e8b4bb909b
commit
7a400bacf3
@ -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 }}",
|
||||
|
@ -1394,38 +1394,43 @@
|
||||
// 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(
|
||||
node, [
|
||||
null, 'msql', this.field.get('node_data'), !self.model.isNew(),
|
||||
this.field.get('node_info')
|
||||
]);
|
||||
|
||||
var self = this,
|
||||
node = self.field.get('schema_node'),
|
||||
msql_url = node.generate_url.apply(
|
||||
node, [
|
||||
null, 'msql', this.field.get('node_data'), !self.model.isNew(),
|
||||
this.field.get('node_info')
|
||||
]);
|
||||
// Fetching the modified SQL
|
||||
self.model.trigger('pgadmin-view:msql:fetching', self.method, node);
|
||||
|
||||
// Fetching the modified SQL
|
||||
self.model.trigger('pgadmin-view:msql:fetching', self.method, node);
|
||||
|
||||
$.ajax({
|
||||
url: msql_url,
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
data: self.model.toJSON(true, 'GET'),
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
}).done(function(res) {
|
||||
self.sqlCtrl.clearHistory();
|
||||
self.sqlCtrl.setValue(res.data);
|
||||
}).fail(function() {
|
||||
self.model.trigger('pgadmin-view:msql:error', self.method, node, arguments);
|
||||
}).always(function() {
|
||||
self.model.trigger('pgadmin-view:msql:fetched', self.method, node, arguments);
|
||||
});
|
||||
$.ajax({
|
||||
url: msql_url,
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
data: self.model.toJSON(true, 'GET'),
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
}).done(function(res) {
|
||||
self.sqlCtrl.clearHistory();
|
||||
self.sqlCtrl.setValue(res.data);
|
||||
}).fail(function() {
|
||||
self.model.trigger('pgadmin-view:msql:error', self.method, node, arguments);
|
||||
}).always(function() {
|
||||
self.model.trigger('pgadmin-view:msql:fetched', self.method, node, arguments);
|
||||
});
|
||||
} else {
|
||||
this.sqlCtrl.clearHistory();
|
||||
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.setValue('-- ' + window.pgAdmin.Browser.messages.SQL_NO_CHANGE);
|
||||
}
|
||||
this.sqlCtrl.refresh.apply(this.sqlCtrl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user