Fix an issue in NodeAjaxControl caching with cache-node field and add cache-node field in Trigger & Event trigger node so that whenever the user creates new Trigger Function we get new data from server in NodeAjaxControl. . Fixes #2242

This commit is contained in:
Murtuza Zabuawala 2017-05-04 16:02:28 +01:00 committed by Dave Page
parent 93df5e3e54
commit 95f763463f
3 changed files with 6 additions and 5 deletions

View File

@ -67,7 +67,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
source: undefined,
language: undefined
},
// Default values!
initialize: function(attrs, args) {
var isNew = (_.size(attrs) === 0);
@ -79,7 +79,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
}
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
},
// Define the schema for the event trigger node
schema: [{
id: 'name', label: '{{ _('Name') }}', cell: 'string',
@ -105,7 +105,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
},{
id: 'eventfunname', label:'{{ _('Trigger function') }}',
type: 'text', control: 'node-ajax-options', group: "Definition",
url:'fopts'
url:'fopts', cache_node: 'trigger_function'
},{
id: 'eventname', label:'{{ _('Events') }}',
type:"radio", group: "Definition", cell: 'string',

View File

@ -283,7 +283,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) {
id: 'tfunction', label:'{{ _('Trigger Function') }}',
type: 'text', disabled: 'inSchemaWithModelCheck',
mode: ['create','edit', 'properties'], group: '{{ _('Definition') }}',
control: 'node-ajax-options', url: 'get_triggerfunctions'
control: 'node-ajax-options', url: 'get_triggerfunctions',
cache_node: 'trigger_function'
},{
id: 'tgargs', label:'{{ _('Arguments') }}', cell: 'string',
group: '{{ _('Definition') }}',

View File

@ -126,7 +126,7 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
cache_level,
cache_node = this.field.get('cache_node');
cache_node = (cache_node && pgAdmin.Browser.Nodes['cache_node']) || node;
cache_node = (cache_node && pgAdmin.Browser.Nodes[cache_node]) || node;
if (this.field.has('cache_level')) {
cache_level = this.field.get('cache_level');