From 6f2c8cfb316396063433fa9b4138846ee6b83d1f Mon Sep 17 00:00:00 2001 From: Surinder Kumar Date: Thu, 26 May 2016 11:11:14 +0530 Subject: [PATCH] Fixing couple issues with some of the nodes. * Added 'catalog' as parent type for the domain, procedure nodes. * Proper initialization of the FTS Configuration, FTS Parser, FTS Dictionary, FTS Template Nodes. * Proper Indentation in collection.js --- .../templates/collation/js/collation.js | 2 +- .../domains/templates/domains/js/domains.js | 2 +- .../fts_configuration/js/fts_configuration.js | 16 ++++++++-------- .../fts_dictionary/js/fts_dictionary.js | 12 ++++++------ .../templates/fts_parser/js/fts_parser.js | 15 ++++++++------- .../templates/fts_template/js/fts_templates.js | 11 ++++++----- .../templates/procedure/js/procedures.js | 2 +- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js index eb12f4041..eb331a496 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js @@ -108,7 +108,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Set schema default value to its parent Schema if(this.model.isNew()){ - this.model.set({'schema': this.model.node_info.schema.label}); + this.model.set({'schema': this.model.node_info.schema.label}); } return this; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js index 3a4542f76..91df7bd53 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js @@ -115,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { collection_type: 'coll-domain', hasSQL: true, hasDepends: true, - parent_type: ['schema'], + parent_type: ['schema', 'catalog'], Init: function() { // Avoid mulitple registration of menus if (this.initialized) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js index 42ed5509c..ac1f51734 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js @@ -459,16 +459,16 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { copy_config: undefined, // FTS configuration list to copy from tokens: undefined // token/dictionary pair list for node }, - initialize: function(attrs, args) { + initialize: function(attrs, opts) { var isNew = (_.size(attrs) === 0); + pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); if (isNew) { - var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user; - this.set({'owner': userInfo.name}, {silent: true}); - } - pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); - if (_.isUndefined(this.get('schema'))) { - this.set('schema', this.node_info.schema._id); + var user = pgBrowser.serverInfo[opts.node_info.server._id].user; + this.set({ + 'owner': user.name, + 'schema': opts.node_info.schema._id + }, {silent: true}); } }, // Defining schema for FTS Configuration @@ -576,4 +576,4 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } return pgBrowser.Nodes['coll-fts_configuration']; -}); \ No newline at end of file +}); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js index 57b0520a0..68e1501e0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js @@ -102,14 +102,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, initialize: function(attrs, args) { var isNew = (_.size(attrs) === 0); + pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); if (isNew) { - var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user; - this.set({'owner': userInfo.name}, {silent: true}); - } - pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); - if (_.isUndefined(this.get('schema'))) { - this.set('schema', this.node_info.schema._id); + var user = pgBrowser.serverInfo[args.node_info.server._id].user; + this.set({ + 'owner': user.name, + 'schema': args.node_info.schema._id + }, {silent: true}); } }, // Defining schema for fts dictionary diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js index fa541e38b..2389a8046 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js @@ -68,13 +68,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { prslextype: undefined, // Lextype function for fts parser prsheadline: undefined // Headline function for fts parse }, - initialize: function() { - pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, - arguments - ); - if (_.isUndefined(this.get('schema'))) { - this.set('schema', this.node_info.schema._id); - } + initialize: function(attrs, args) { + var isNew = (_.size(attrs) === 0); + pgAdmin.Browser.Node.Model.prototype.initialize.apply( + this, arguments + ); + if (isNew) { + this.set('schema', args.node_info.schema._id); + } }, // Defining schema for fts parser schema: [{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js index 4b0e44926..9d2d0d4b9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js @@ -63,11 +63,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { tmplinit: undefined, // Init function for fts template tmpllexize: undefined // Lexize function for fts template }, - initialize: function() { - pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); - if (_.isUndefined(this.get('schema'))) { - this.set('schema', this.node_info.schema._id); - } + initialize: function(attrs, args) { + var isNew = (_.size(attrs) === 0); + pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); + if (isNew) { + this.set('schema', args.node_info.schema._id); + } }, // Defining schema for fts template schema: [{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js index d2a1beae9..8fe0a5ad4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js @@ -30,7 +30,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Function) { hasSQL: true, hasDepends: true, hasScriptTypes: ['create', 'exec'], - parent_type: ['schema'], + parent_type: ['schema', 'catalog'], Init: function() { /* Avoid mulitple registration of menus */ if (this.proc_initialized)