Fixed validation issue in Synonyms node. Fixes #5409

pull/29/head
Akshay Joshi 2020-04-17 14:50:38 +05:30
parent c6deb9393c
commit d8ad0b8faf
2 changed files with 15 additions and 4 deletions

View File

@ -63,4 +63,5 @@ Bug fixes
| `Issue #5383 <https://redmine.postgresql.org/issues/5383>`_ - Fixed syntax error while refreshing the existing synonyms.
| `Issue #5387 <https://redmine.postgresql.org/issues/5387>`_ - Fixed an issue where the mode is not shown in the properties dialog of functions/procedures if all the arguments are "IN" arguments.
| `Issue #5400 <https://redmine.postgresql.org/issues/5400>`_ - Fixed internal server error when the database server is logged in with non-super user.
| `Issue #5409 <https://redmine.postgresql.org/issues/5409>`_ - Fixed validation issue in Synonyms node.
| `Issue #5410 <https://redmine.postgresql.org/issues/5410>`_ - Fixed an issue while removing the package body showing wrong modified SQL.

View File

@ -150,16 +150,13 @@ define('pgadmin.node.synonym', [
},
},{
id: 'synobjname', label: gettext('Target object'), cell: 'string',
type: 'text', disabled: 'inSchema', group: gettext('Definition'),
type: 'text', group: gettext('Definition'),
deps: ['targettype', 'synobjschema'],
control: 'node-ajax-options',
options: function(control) {
var trgTyp = control.model.get('targettype');
var trgSchema = control.model.get('synobjschema');
var res = [];
control.model.set('synobjname', undefined);
var node = control.field.get('schema_node'),
_url = node.generate_url.apply(
node, [
@ -184,6 +181,19 @@ define('pgadmin.node.synonym', [
});
return res;
},
disabled: function(m) {
if (this.node_info && 'catalog' in this.node_info) {
return true;
}
// Check the changed attributes if targettype or synobjschema
// is changed then reset the target object
if ('changed' in m && !('name' in m.changed) &&
('targettype' in m.changed || 'synobjschema' in m.changed)) {
m.set('synobjname', undefined);
}
return false;
},
},{
id: 'is_public_synonym', label: gettext('Public synonym?'),
type: 'switch', mode: ['properties'], cell: 'switch',