Moved the javascripts of different modules from 'templates' to 'static' directory.

Moving the javascripts for the following modules:
 - About
 - Browser nodes
 - Dashboard
 - FileManager
 - Vendor/snap.svg
 - Preferences
 - Settings
 - Backup
 - Datagrid
 - Debugger
 - Sqleditor
 - Grant Wizard
 - Import & Export
 - Maintenance
 - Restore and
 - User Management
This commit is contained in:
Surinder Kumar 2017-07-27 17:25:07 +05:30 committed by Ashesh Vashi
parent 831c614a60
commit 6d5417709c
83 changed files with 1058 additions and 8928 deletions

View File

@ -26,7 +26,7 @@ from pgadmin.model import db, ServerGroup
class ServerGroupModule(BrowserPluginModule):
NODE_TYPE = "server-group"
NODE_TYPE = "server_group"
def get_nodes(self, *arg, **kwargs):
"""Return a JSON document listing the server groups for the user"""

View File

@ -86,6 +86,14 @@ class ForeignServerModule(CollectionNodeModule):
"""
return databases.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = ForeignServerModule(__name__)

View File

@ -101,6 +101,14 @@ class UserMappingModule(CollectionNodeModule):
return servers.ServerModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = UserMappingModule(__name__)

View File

@ -94,6 +94,14 @@ class CatalogObjectColumnsModule(CollectionNodeModule):
'show_system_objects'
)
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = CatalogObjectColumnsModule(__name__)

View File

@ -56,7 +56,7 @@ class ForeignTableModule(SchemaChildModule):
- Load the module script for Foreign Table, when schema node is
initialized.
"""
NODE_TYPE = 'foreign-table'
NODE_TYPE = 'foreign_table'
COLLECTION_LABEL = gettext("Foreign Tables")
def __init__(self, *args, **kwargs):
@ -396,7 +396,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
row['oid'],
scid,
row['name'],
icon="icon-foreign-table"
icon="icon-foreign_table"
))
return make_json_response(
@ -430,7 +430,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
row['oid'],
scid,
row['name'],
icon="icon-foreign-table"
icon="icon-foreign_table"
),
status=200
)
@ -689,7 +689,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader):
foid,
scid,
self.request['name'],
icon="icon-foreign-table"
icon="icon-foreign_table"
)
)
except Exception as e:

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

View File

@ -0,0 +1,719 @@
/* Create and Register Foreign Table Collection and Node. */
define('pgadmin.node.foreign_table', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify',
'pgadmin.browser.collection'
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify) {
if (!pgBrowser.Nodes['coll-foreign_table']) {
var foreigntable = pgBrowser.Nodes['coll-foreign_table'] =
pgBrowser.Collection.extend({
node: 'foreign_table',
label: gettext('Foreign Tables'),
type: 'coll-foreign_table',
columns: ['name', 'owner', 'description']
});
};
// Integer Cell for Columns Length and Precision
var IntegerDepCell = Backgrid.IntegerCell.extend({
initialize: function() {
Backgrid.NumberCell.prototype.initialize.apply(this, arguments);
Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);
},
dependentChanged: function () {
this.$el.empty();
var model = this.model;
var column = this.column;
var editable = this.column.get("editable");
var is_editable = _.isFunction(editable) ? !!editable.apply(column, [model]) : !!editable;
if (is_editable){ this.$el.addClass("editable"); }
else { this.$el.removeClass("editable"); }
this.delegateEvents();
return this;
},
remove: Backgrid.Extension.DependentCell.prototype.remove
});
// Options Model
var ColumnOptionsModel = pgBrowser.Node.Model.extend({
idAttribute: 'option',
defaults: {
option: undefined,
value: undefined
},
schema: [
{id: 'option', label:'Option', type:'text', editable: true, cellHeaderClasses: 'width_percent_30'},
{
id: 'value', label:'Value', type: 'text', editable: true, cellHeaderClasses: 'width_percent_50'
}
],
validate: function() {
if (_.isUndefined(this.get('value')) ||
_.isNull(this.get('value')) ||
String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') {
var msg = 'Please enter a value.';
this.errorModel.set('value', msg);
return msg;
} else {
this.errorModel.unset('value');
}
return null;
}
});
// Columns Model
var ColumnsModel = pgBrowser.Node.Model.extend({
idAttribute: 'attnum',
defaults: {
attname: undefined,
datatype: undefined,
typlen: undefined,
precision: undefined,
typdefault: undefined,
attnotnull: undefined,
collname: undefined,
attnum: undefined,
inheritedfrom: undefined,
inheritedid: undefined,
attstattarget: undefined,
coloptions: []
},
type_options: undefined,
schema: [{
id: 'attname', label: gettext('Name'), cell: 'string', type: 'text',
editable: 'is_editable_column', cellHeaderClasses: 'width_percent_40'
},{
id: 'datatype', label: gettext('Data Type'), cell: 'node-ajax-options',
control: 'node-ajax-options', type: 'text', url: 'get_types',
editable: 'is_editable_column', cellHeaderClasses: 'width_percent_0',
group: gettext('Definition'),
transform: function(d, self){
self.model.type_options = d;
return d;
}
},{
id: 'typlen', label: gettext('Length'),
cell: 'string', group: gettext('Definition'),
type: 'int', deps: ['datatype'],
disabled: function(m) {
var val = m.get('typlen');
// We will store type from selected from combobox
if(!(_.isUndefined(m.get('inheritedid'))
|| _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom'))
|| _.isNull(m.get('inheritedfrom')))) {
if (!_.isUndefined(val)) {
setTimeout(function() {
m.set('typlen', undefined);
}, 10);
}
return true;
}
var of_type = m.get('datatype'),
has_length = false;
if(m.type_options) {
m.set('is_tlength', false, {silent: true});
// iterating over all the types
_.each(m.type_options, function(o) {
// if type from selected from combobox matches in options
if ( of_type == o.value ) {
// if length is allowed for selected type
if(o.length)
{
// set the values in model
has_length = true;
m.set('is_tlength', true, {silent: true});
m.set('min_val', o.min_val, {silent: true});
m.set('max_val', o.max_val, {silent: true});
}
}
});
if (!has_length && !_.isUndefined(val)) {
setTimeout(function() {
m.set('typlen', undefined);
}, 10);
}
return !(m.get('is_tlength'));
}
if (!has_length && !_.isUndefined(val)) {
setTimeout(function() {
m.set('typlen', undefined);
}, 10);
}
return true;
},
cellHeaderClasses: 'width_percent_10'
},{
id: 'precision', label: gettext('Precision'),
type: 'int', deps: ['datatype'],
cell: 'string', group: gettext('Definition'),
disabled: function(m) {
var val = m.get('precision');
if(!(_.isUndefined(m.get('inheritedid'))
|| _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom'))
|| _.isNull(m.get('inheritedfrom')))) {
if (!_.isUndefined(val)) {
setTimeout(function() {
m.set('precision', undefined);
}, 10);
}
return true;
}
var of_type = m.get('datatype'),
has_precision = false;
if(m.type_options) {
m.set('is_precision', false, {silent: true});
// iterating over all the types
_.each(m.type_options, function(o) {
// if type from selected from combobox matches in options
if ( of_type == o.value ) {
// if precession is allowed for selected type
if(o.precision)
{
has_precision = true;
// set the values in model
m.set('is_precision', true, {silent: true});
m.set('min_val', o.min_val, {silent: true});
m.set('max_val', o.max_val, {silent: true});
}
}
});
if (!has_precision && !_.isUndefined(val)) {
setTimeout(function() {
m.set('precision', undefined);
}, 10);
}
return !(m.get('is_precision'));
}
if (!has_precision && !_.isUndefined(val)) {
setTimeout(function() {
m.set('precision', undefined);
}, 10);
}
return true;
}, cellHeaderClasses: 'width_percent_10'
},{
id: 'typdefault', label: gettext('Default'), type: 'text',
cell: 'string', min_version: 90300, group: gettext('Definition'),
placeholder: "Enter an expression or a value.",
cellHeaderClasses: 'width_percent_10',
editable: function(m) {
if(!(_.isUndefined(m.get('inheritedid'))
|| _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom'))
|| _.isNull(m.get('inheritedfrom')))) { return false; }
if (this.get('node_info').server.version < 90300){
return false;
}
return true;
}
},{
id: 'attnotnull', label: gettext('Not Null'),
cell: 'boolean',type: 'switch', editable: 'is_editable_column',
cellHeaderClasses: 'width_percent_10', group: gettext('Definition')
},{
id: 'attstattarget', label: gettext('Statistics'), min_version: 90200,
cell: 'integer', type: 'int', group: gettext('Definition'),
editable: function(m) {
if (_.isUndefined(m.isNew) || m.isNew()) { return false; }
if (this.get('node_info').server.version < 90200){
return false;
}
return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false
}, cellHeaderClasses: 'width_percent_10'
},{
id: 'collname', label: gettext('Collation'), cell: 'node-ajax-options',
control: 'node-ajax-options', type: 'text', url: 'get_collations',
min_version: 90300, editable: function(m) {
if (!(_.isUndefined(m.isNew)) && !m.isNew()) { return false; }
return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false
},
cellHeaderClasses: 'width_percent_20', group: gettext('Definition')
},{
id: 'attnum', cell: 'string',type: 'text', visible: false
},{
id: 'inheritedfrom', label: gettext('Inherited From'), cell: 'string',
type: 'text', visible: false, mode: ['properties', 'edit'],
cellHeaderClasses: 'width_percent_10'
},{
id: 'coloptions', label: gettext('Options'), cell: 'string',
type: 'collection', group: gettext('Options'), mode: ['edit', 'create'],
model: ColumnOptionsModel, canAdd: true, canDelete: true, canEdit: false,
control: Backform.UniqueColCollectionControl, uniqueCol : ['option'],
min_version: 90200
}],
validate: function() {
var errmsg = null;
if (_.isUndefined(this.get('attname')) || String(this.get('attname')).replace(/^\s+|\s+$/g, '') == '') {
errmsg = gettext('Column Name cannot be empty!');
this.errorModel.set('attname', errmsg);
} else {
this.errorModel.unset('attname');
}
if (_.isUndefined(this.get('datatype')) || String(this.get('datatype'))
.replace(/^\s+|\s+$/g, '') == '') {
errmsg = gettext('Column Datatype cannot be empty!');
this.errorModel.set('datatype', errmsg);
} else {
this.errorModel.unset('datatype');
}
return errmsg;
},
is_editable_column: function(m) {
return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false
},
toJSON: Backbone.Model.prototype.toJSON
});
/* NodeAjaxOptionsMultipleControl is for multiple selection of Combobox.
* This control is used to select Multiple Parent Tables to be inherited.
* It also populates/vacates Columns on selection/deselection of the option (i.e. table name).
* To populates the column, it calls the server and fetch the columns data
* for the selected table.
*/
var NodeAjaxOptionsMultipleControl = Backform.NodeAjaxOptionsControl.extend({
onChange: function(e) {
var model = this.model,
$el = $(e.target),
attrArr = this.field.get("name").split('.'),
name = attrArr.shift(),
path = attrArr.join('.'),
value = this.getValueFromDOM(),
changes = {},
columns = model.get('columns'),
inherits = model.get(name);
if (this.model.errorModel instanceof Backbone.Model) {
if (_.isEmpty(path)) {
this.model.errorModel.unset(name);
} else {
var nestedError = this.model.errorModel.get(name);
if (nestedError) {
this.keyPathSetter(nestedError, path, null);
this.model.errorModel.set(name, nestedError);
}
}
}
var self = this;
if (typeof(inherits) == "string"){ inherits = JSON.parse(inherits); }
// Remove Columns if inherit option is deselected from the combobox
if(_.size(value) < _.size(inherits)) {
var dif = _.difference(inherits, value);
var rmv_columns = columns.where({inheritedid: parseInt(dif[0])});
columns.remove(rmv_columns);
}
else
{
_.each(value, function(i) {
// Fetch Columns from server
var fnd_columns = columns.where({inheritedid: parseInt(i)});
if (fnd_columns && fnd_columns.length <= 0) {
inhted_columns = self.fetchColumns(i);
columns.add(inhted_columns);
}
});
}
changes[name] = _.isEmpty(path) ? value : _.clone(model.get(name)) || {};
this.stopListening(this.model, "change:" + name, this.render);
model.set(changes);
this.listenTo(this.model, "change:" + name, this.render);
},
fetchColumns: function(table_id){
var self = this,
url = 'get_columns',
m = self.model.top || self.model;
if (url) {
var node = this.field.get('schema_node'),
node_info = this.field.get('node_info'),
full_url = node.generate_url.apply(
node, [
null, url, this.field.get('node_data'),
this.field.get('url_with_id') || false, node_info
]),
cache_level = this.field.get('cache_level') || node.type,
cache_node = this.field.get('cache_node');
cache_node = (cache_node && pgBrowser.Nodes['cache_node']) || node;
m.trigger('pgadmin:view:fetching', m, self.field);
var data = {attrelid: table_id}
// Fetching Columns data for the selected table.
$.ajax({
async: false,
url: full_url,
data: data,
success: function(res) {
/*
* We will cache this data for short period of time for avoiding
* same calls.
*/
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
}
});
m.trigger('pgadmin:view:fetched', m, self.field);
// To fetch only options from cache, we do not need time from 'at'
// attribute but only options.
//
// It is feasible that the data may not have been fetched.
data = (data && data.data) || [];
return data;
}
},
});
// Constraints Model
var ConstraintModel = pgBrowser.Node.Model.extend({
idAttribute: 'conoid',
initialize: function(attrs, args) {
var isNew = (_.size(attrs) === 0);
if (!isNew) {
this.convalidated_default = this.get('convalidated')
}
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
},
defaults: {
conoid: undefined,
conname: undefined,
consrc: undefined,
connoinherit: undefined,
convalidated: true,
conislocal: undefined
},
convalidated_default: true,
schema: [{
id: 'conoid', type: 'text', cell: 'string', visible: false
},{
id: 'conname', label: gettext('Name'), type: 'text', cell: 'string',
editable: 'is_editable', cellHeaderClasses: 'width_percent_30'
},{
id: 'consrc', label: gettext('Check'), type: 'multiline',
editable: 'is_editable', cell: Backgrid.Extension.TextareaCell,
cellHeaderClasses: 'width_percent_30'
},{
id: 'connoinherit', label: gettext('No Inherit'), type: 'switch',
cell: 'boolean', editable: 'is_editable',
cellHeaderClasses: 'width_percent_20'
},{
id: 'convalidated', label: gettext('Validate?'), type: 'switch',
cell: 'boolean', cellHeaderClasses: 'width_percent_20',
editable: function(m) {
var server = this.get('node_info').server;
if (_.isUndefined(m.isNew)) { return true; }
if (!m.isNew()) {
if(m.get('convalidated') && m.convalidated_default) {
return false;
}
return true;
}
return true;
}
}
],
validate: function() {
var err = {},
errmsg;
if (_.isUndefined(this.get('conname')) || String(this.get('conname')).replace(/^\s+|\s+$/g, '') == '') {
err['conname'] = gettext('Constraint Name cannot be empty!');
errmsg = errmsg || err['conname'];
}
if (_.isUndefined(this.get('consrc')) || String(this.get('consrc'))
.replace(/^\s+|\s+$/g, '') == '') {
err['consrc'] = gettext('Constraint Check cannot be empty!');
errmsg = errmsg || err['consrc'];
}
this.errorModel.clear().set(err);
return errmsg;
},
is_editable: function(m) {
return _.isUndefined(m.isNew) ? true : m.isNew();
},
toJSON: Backbone.Model.prototype.toJSON
});
// Options Model
var OptionsModel = pgBrowser.Node.Model.extend({
defaults: {
option: undefined,
value: undefined
},
schema: [{
id: 'option', label: gettext('Option'), cell: 'string', type: 'text',
editable: true, cellHeaderClasses:'width_percent_50'
},{
id: 'value', label: gettext('Value'), cell: 'string',type: 'text',
editable: true, cellHeaderClasses:'width_percent_50'
}
],
validate: function() {
// TODO: Add validation here
},
toJSON: Backbone.Model.prototype.toJSON
});
if (!pgBrowser.Nodes['foreign_table']) {
pgBrowser.Nodes['foreign_table'] = pgBrowser.Node.extend({
type: 'foreign_table',
sqlAlterHelp: 'sql-alterforeigntable.html',
sqlCreateHelp: 'sql-createforeigntable.html',
dialogHelp: url_for('help.static', {'filename': 'foreign_table_dialog.html'}),
label: gettext('Foreign Table'),
collection_type: 'coll-foreign_table',
hasSQL: true,
hasDepends: true,
hasScriptTypes: ['create', 'select', 'insert', 'update', 'delete'],
parent_type: ['schema'],
Init: function() {
/* Avoid multiple registration of menus */
if (this.initialized)
return;
this.initialized = true;
pgBrowser.add_menus([{
name: 'create_foreign-table_on_coll', node: 'coll-foreign_table', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: gettext('Foreign Table...'),
icon: 'wcTabIcon icon-foreign-table', data: {action: 'create', check: true},
enable: 'canCreate'
},{
name: 'create_foreign-table', node: 'foreign_table', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: gettext('Foreign Table...'),
icon: 'wcTabIcon icon-foreign-table', data: {action: 'create', check: true},
enable: 'canCreate'
},{
name: 'create_foreign-table', node: 'schema', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: gettext('Foreign Table...'),
icon: 'wcTabIcon icon-foreign_table', data: {action: 'create', check: false},
enable: 'canCreate'
}
]);
},
canDrop: pgBrowser.Nodes['schema'].canChildDrop,
canDropCascade: pgBrowser.Nodes['schema'].canChildDrop,
model: pgBrowser.Node.Model.extend({
initialize: function(attrs, args) {
var isNew = (_.size(attrs) === 0);
if (isNew) {
var schema = args.node_info.schema._label,
userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
// Set Selected Schema and Current User
this.set({
'basensp': schema, 'owner': userInfo.name
}, {silent: true});
}
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
},
defaults: {
name: undefined,
oid: undefined,
owner: undefined,
basensp: undefined,
description: undefined,
ftsrvname: undefined,
strftoptions: undefined,
inherits: [],
columns: [],
constraints: [],
ftoptions: [],
relacl: [],
stracl: [],
seclabels: []
},
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit']
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties']
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
control: Backform.NodeListByNameControl,
node: 'role', type: 'text', select2: { allowClear: false }
},{
id: 'basensp', label: gettext('Schema'), cell: 'node-list-by-name',
control: 'node-list-by-name', cache_level: 'database', type: 'text',
node: 'schema', mode:['create', 'edit']
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline'
},{
id: 'ftsrvname', label: gettext('Foreign server'), cell: 'string', control: 'node-ajax-options',
type: 'text', group: gettext('Definition'), url: 'get_foreign_servers', disabled: function(m) { return !m.isNew(); }
},{
id: 'inherits', label: gettext('Inherits'), group: gettext('Definition'),
type: 'array', min_version: 90500, control: NodeAjaxOptionsMultipleControl,
url: 'get_tables', select2: {multiple: true},
'cache_level': 'database',
transform: function(d, self){
if (this.field.get('mode') == 'edit') {
var oid = this.model.get('oid');
var s = _.findWhere(d, {'id': oid});
if (s) {
d = _.reject(d, s);
}
}
return d;
}
},{
id: 'columns', label: gettext('Columns'), cell: 'string',
type: 'collection', group: gettext('Columns'), visible: false, mode: ['edit', 'create'],
model: ColumnsModel, canAdd: true, canDelete: true, canEdit: true,
columns: ['attname', 'datatype', 'inheritedfrom'],
canDeleteRow: function(m) {
return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false
},
canEditRow: function(m) {
return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false
}
},
{
id: 'constraints', label: gettext('Constraints'), cell: 'string',
type: 'collection', group: gettext('Constraints'), visible: false, mode: ['edit', 'create'],
model: ConstraintModel, canAdd: true, canDelete: true, columns: ['conname','consrc', 'connoinherit', 'convalidated'],
canEdit: function(o) {
if (o instanceof Backbone.Model) {
if (o instanceof ConstraintModel) {
return o.isNew();
}
}
return true;
}, min_version: 90500, canDeleteRow: function(m) {
return (m.get('conislocal') == true || _.isUndefined(m.get('conislocal'))) ? true : false
}
},{
id: 'strftoptions', label: gettext('Options'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties']
},{
id: 'ftoptions', label: gettext('Options'), cell: 'string',
type: 'collection', group: gettext('Options'), mode: ['edit', 'create'],
model: OptionsModel, canAdd: true, canDelete: true, canEdit: false,
control: 'unique-col-collection', uniqueCol : ['option']
},{
id: 'relacl', label: gettext('Privileges'), cell: 'string',
type: 'text', group: gettext('Security'),
mode: ['properties'], min_version: 90200
}, pgBrowser.SecurityGroupUnderSchema, {
id: 'acl', label: gettext('Privileges'), model: pgAdmin
.Browser.Node.PrivilegeRoleModel.extend(
{privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'],
editable: false, type: 'collection', group: 'security',
mode: ['edit', 'create'],
canAdd: true, canDelete: true, control: 'unique-col-collection',
min_version: 90200
},{
id: 'seclabels', label: gettext('Security Labels'),
model: pgBrowser.SecLabelModel, type: 'collection',
group: 'security', mode: ['edit', 'create'],
min_version: 90100, canAdd: true,
canEdit: false, canDelete: true,
control: 'unique-col-collection', uniqueCol : ['provider']
}
],
validate: function()
{
var err = {},
errmsg,
seclabels = this.get('seclabels');
if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') {
err['name'] = gettext('Name cannot be empty.');
errmsg = errmsg || err['name'];
}
if (_.isUndefined(this.get('basensp')) || String(this.get('basensp'))
.replace(/^\s+|\s+$/g, '') == '') {
err['basensp'] = gettext('Schema cannot be empty.');
errmsg = errmsg || err['basensp'];
}
if (_.isUndefined(this.get('ftsrvname')) || String(this.get('ftsrvname')).replace(/^\s+|\s+$/g, '') == '') {
err['ftsrvname'] = gettext('Foreign server cannot be empty.');
errmsg = errmsg || err['ftsrvname'];
}
this.errorModel.clear().set(err);
return null;
}
}),
canCreate: function(itemData, item, data) {
//If check is false then , we will allow create menu
if (data && data.check == false)
return true;
var t = pgBrowser.tree, i = item, d = itemData;
// To iterate over tree to check parent node
while (i) {
// If it is schema then allow user to create foreign table
if (_.indexOf(['schema'], d._type) > -1)
return true;
if ('coll-foreign-table' == d._type) {
//Check if we are not child of catalog
var prev_i = t.hasParent(i) ? t.parent(i) : null,
prev_d = prev_i ? t.itemData(prev_i) : null;
if( prev_d._type == 'catalog') {
return false;
} else {
return true;
}
}
i = t.hasParent(i) ? t.parent(i) : null;
d = i ? t.itemData(i) : null;
}
// by default we do not want to allow create menu
return true;
}
});
}
return pgBrowser.Nodes['foreign_table'];
});

View File

@ -30,7 +30,7 @@ class ForeignTableAddTestCase(BaseTestGenerator):
scenarios = [
# Fetching default URL for foreign server node.
('Check foreign table Node', dict(url='/browser/foreign-table/obj/'))
('Check foreign table Node', dict(url='/browser/foreign_table/obj/'))
]
def setUp(self):

View File

@ -30,7 +30,7 @@ class ForeignTableDeleteTestCase(BaseTestGenerator):
scenarios = [
# Fetching default URL for foreign table node.
('Check foreign table Node', dict(url='/browser/foreign-table/obj/'))
('Check foreign table Node', dict(url='/browser/foreign_table/obj/'))
]
def setUp(self):

View File

@ -29,7 +29,7 @@ class ForeignTableGetTestCase(BaseTestGenerator):
"""
scenarios = [
# Fetching default URL for foreign server node.
('Check foreign table Node', dict(url='/browser/foreign-table/obj/'))
('Check foreign table Node', dict(url='/browser/foreign_table/obj/'))
]
def setUp(self):

View File

@ -30,7 +30,7 @@ class ForeignTablePutTestCase(BaseTestGenerator):
"""
scenarios = [
# Fetching default URL for foreign server node.
('Check foreign table Node', dict(url='/browser/foreign-table/obj/'))
('Check foreign table Node', dict(url='/browser/foreign_table/obj/'))
]
def setUp(self):

View File

@ -109,6 +109,14 @@ class EdbFuncModule(CollectionNodeModule):
self.SHOW_ON_BROWSER, category_label=gettext('Nodes')
)
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = EdbFuncModule(__name__)
@ -693,6 +701,14 @@ class EdbProcModule(CollectionNodeModule):
self.SHOW_ON_BROWSER, category_label=gettext('Nodes')
)
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
procedure_blueprint = EdbProcModule(__name__)

View File

@ -91,6 +91,14 @@ class EdbVarModule(CollectionNodeModule):
"""
return False
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = EdbVarModule(__name__)

View File

@ -92,6 +92,14 @@ class ColumnsModule(CollectionNodeModule):
"""
return False
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = ColumnsModule(__name__)

View File

@ -72,6 +72,14 @@ class ConstraintsModule(CollectionNodeModule):
"""
return database.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = ConstraintsModule(__name__)

View File

@ -46,7 +46,7 @@ class CheckConstraintModule(CollectionNodeModule):
- Load the module script for the Check Constraint, when any of the
Check node is initialized.
"""
NODE_TYPE = 'check_constraints'
NODE_TYPE = 'check_constraint'
COLLECTION_LABEL = _("Check Constraints")
def __init__(self, *args, **kwargs):
@ -75,6 +75,16 @@ class CheckConstraintModule(CollectionNodeModule):
"""
return database.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
@property
def csssnippets(self):
"""

View File

@ -1,5 +1,5 @@
// Check Constraint Module: Node
define('pgadmin.node.check_constraints', [
define('pgadmin.node.check_constraint', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify',
'sources/alerts/alertify_wrapper',

View File

@ -25,7 +25,7 @@ class CheckConstraintAddTestCase(BaseTestGenerator):
"""This class will add check constraint to existing table"""
scenarios = [
('Add check constraint to table',
dict(url='/browser/check_constraints/obj/'))
dict(url='/browser/check_constraint/obj/'))
]
def setUp(self):

View File

@ -25,7 +25,7 @@ class CheckConstraintDeleteTestCase(BaseTestGenerator):
"""This class will delete check constraint to existing table"""
scenarios = [
('Delete check constraint to table',
dict(url='/browser/check_constraints/obj/'))
dict(url='/browser/check_constraint/obj/'))
]
def setUp(self):

View File

@ -25,7 +25,7 @@ class CheckConstraintGetTestCase(BaseTestGenerator):
"""This class will fetch check constraint to existing table"""
scenarios = [
('Fetch check constraint to table',
dict(url='/browser/check_constraints/obj/'))
dict(url='/browser/check_constraint/obj/'))
]
def setUp(self):

View File

@ -26,7 +26,7 @@ class CheckConstraintPutTestCase(BaseTestGenerator):
"""This class will update check constraint to existing table"""
scenarios = [
('Update check constraint to table',
dict(url='/browser/check_constraints/obj/'))
dict(url='/browser/check_constraint/obj/'))
]
def setUp(self):

View File

@ -93,6 +93,14 @@ class ExclusionConstraintModule(ConstraintTypeModule):
"""
return database.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = ExclusionConstraintModule(__name__)

View File

@ -93,6 +93,14 @@ class ForeignKeyConstraintModule(ConstraintTypeModule):
"""
return database.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
@property
def csssnippets(self):
"""

View File

@ -493,6 +493,8 @@ define('pgadmin.node.foreign_key', [
newRow.addClass("new");
$(newRow).pgMakeVisible('backform-tab');
} else {
//delete m;
}
return false;

View File

@ -93,6 +93,14 @@ class IndexConstraintModule(ConstraintTypeModule):
"""
return database.DatabaseModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
class PrimaryKeyConstraintModule(IndexConstraintModule):
"""

View File

@ -1,569 +0,0 @@
define('pgadmin.node.{{node_type}}', [
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin',
'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'
], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) {
// Extend the browser's node class for index constraint node
if (!pgBrowser.Nodes['{{node_type}}']) {
pgAdmin.Browser.Nodes['{{node_type}}'] = pgBrowser.Node.extend({
getTreeNodeHierarchy: pgBrowser.tableChildTreeNodeHierarchy,
type: '{{node_type}}',
label: '{{ node_label }}',
collection_type: 'coll-constraints',
sqlAlterHelp: 'ddl-alter.html',
sqlCreateHelp: 'ddl-constraints.html',
{% if node_type == 'primary_key' %}
dialogHelp: '{{ url_for('help.static', filename='primary_key_dialog.html') }}',
{% else %}
dialogHelp: '{{ url_for('help.static', filename='unique_constraint_dialog.html') }}',
{% endif %}
hasSQL: true,
hasDepends: true,
hasStatistics: true,
statsPrettifyFields: ['Index size'],
parent_type: ['table','partition'],
canDrop: true,
canDropCascade: true,
Init: function() {
/* Avoid multiple registration of menus */
if (this.initialized)
return;
this.initialized = true;
pgBrowser.add_menus([{
name: 'create_{{node_type}}_on_coll', node: 'coll-constraints', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 4, label: '{{ node_label }}',
icon: 'wcTabIcon icon-{{node_type}}', data: {action: 'create', check: true},
enable: 'canCreate'
}
]);
},
canCreate: function(itemData, item, data) {
// If check is false then , we will allow create menu
if (data && data.check == false)
return true;
var t = pgBrowser.tree, i = item, d = itemData, parents = [],
immediate_parent_table_found = false,
is_immediate_parent_table_partitioned = false;
// To iterate over tree to check parent node
while (i) {
// If table is partitioned table then return false
if (!immediate_parent_table_found && (d._type == 'table' || d._type == 'partition')) {
immediate_parent_table_found = true;
if ('is_partitioned' in d && d.is_partitioned) {
is_immediate_parent_table_partitioned = true;
}
}
// If it is schema then allow user to create table
if (_.indexOf(['schema'], d._type) > -1) {
{% if node_type == 'primary_key' %}
if (is_immediate_parent_table_partitioned) {
return false;
}
// There should be only one primary key per table.
var children = t.children(arguments[1], false),
primary_key_found = false;
_.each(children, function(child){
data = pgBrowser.tree.itemData($(child));
if (!primary_key_found && data._type == "primary_key") {
primary_key_found = true;
}
});
return !primary_key_found;
{% else %}
return !is_immediate_parent_table_partitioned;
{% endif %}
}
parents.push(d._type);
i = t.hasParent(i) ? t.parent(i) : null;
d = i ? t.itemData(i) : null;
}
// If node is under catalog then do not allow 'create' menu
if (_.indexOf(parents, 'catalog') > -1) {
return false;
} else {
return !is_immediate_parent_table_partitioned;
}
},
// Define the model for index constraint node
model: pgAdmin.Browser.Node.Model.extend({
idAttribute: 'oid',
defaults: {
name: undefined,
oid: undefined,
comment: undefined,
spcname: undefined,
index: undefined,
fillfactor: undefined,
condeferrable: undefined,
condeferred: undefined,
columns: []
},
// Define the schema for the index constraint node
schema: [{
id: 'name', label: gettext('Name'), type: 'text',
mode: ['properties', 'create', 'edit'], editable:true,
cellHeaderClasses:'width_percent_40',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'], editable: false,
cellHeaderClasses:'width_percent_20',
},{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],
deps:['name'], disabled:function(m) {
var name = m.get('name');
if (!(name && name != '')) {
setTimeout(function(){
if(m.get('comment') && m.get('comment') !== '') {
m.set('comment', null);
}
},10);
return true;
} else {
return false;
}
}
},{
id: 'columns', label: gettext('Columns'),
type: 'collection', group: gettext('Definition'),
editable: false,
cell: Backgrid.StringCell.extend({
initialize: function() {
Backgrid.StringCell.prototype.initialize.apply(this, arguments);
var self = this,
collection = this.model.get('columns');
// Do not listen for any event(s) for existing constraint.
if (_.isUndefined(self.model.get('oid'))) {
var tableCols = self.model.top.get('columns');
self.listenTo(tableCols, 'remove' , self.removeColumn);
self.listenTo(tableCols, 'change:name', self.resetColOptions);
}
collection.on('pgadmin:multicolumn:updated', function() {
self.render.apply(self);
});
self.listenTo(collection, "add", self.render);
self.listenTo(collection, "remove", self.render);
},
removeColumn: function(m) {
var self = this,
removedCols = self.model.get('columns').where(
{column: m.get('name')}
);
self.model.get('columns').remove(removedCols);
setTimeout(function () {
self.render();
}, 10);
{% if node_type == 'primary_key' %}
var key = 'primary_key'
{% else %}
var key = 'unique_constraint'
{% endif %}
setTimeout(function () {
constraints = self.model.top.get(key);
var removed = [];
constraints.each(function(constraint) {
if (constraint.get("columns").length == 0) {
removed.push(constraint);
}
});
constraints.remove(removed);
},100);
},
resetColOptions : function(m) {
var self = this,
updatedCols = self.model.get('columns').where(
{column: m.previous('name')}
);
if (updatedCols.length > 0) {
/*
* Table column name has changed so update
* column name in primary key as well.
*/
updatedCols[0].set(
{"column": m.get('name')},
{silent: true});
}
setTimeout(function () {
self.render();
}, 10);
},
formatter: {
fromRaw: function (rawValue, model) {
return rawValue.pluck("column").toString();
},
toRaw: function (val, model) {
return val;
}
},
render: function() {
return Backgrid.StringCell.prototype.render.apply(this, arguments);
},
remove: function() {
var tableCols = this.model.top.get('columns'),
primary_key_col = this.model.get('columns');
if (primary_key_col) {
primary_key_col.off('pgadmin:multicolumn:updated');
}
this.stopListening(tableCols, 'remove' , self.removeColumn);
this.stopListening(tableCols, 'change:name' , self.resetColOptions);
Backgrid.StringCell.prototype.remove.apply(this, arguments);
}
}),
canDelete: true, canAdd: true,
control: Backform.MultiSelectAjaxControl.extend({
defaults: _.extend(
{},
Backform.NodeListByNameControl.prototype.defaults,
{
select2: {
multiple: true,
allowClear: true,
width: 'style',
placeholder: gettext('Select the column(s)'),
}
}
),
keyPathAccessor: function(obj, path) {
var res = obj;
if(_.isArray(res)) {
return _.map(res, function(o) { return o['column']
});
}
path = path.split('.');
for (var i = 0; i < path.length; i++) {
if (_.isNull(res)) return null;
if (_.isEmpty(path[i])) continue;
if (!_.isUndefined(res[path[i]])) res = res[path[i]];
}
return _.isObject(res) && !_.isArray(res) ? null : res;
},
initialize: function() {
// Here we will decide if we need to call URL
// Or fetch the data from parent columns collection
var self = this;
if(this.model.handler) {
Backform.Select2Control.prototype.initialize.apply(this, arguments);
// Do not listen for any event(s) for existing constraint.
if (_.isUndefined(self.model.get('oid'))) {
var tableCols = self.model.top.get('columns');
self.listenTo(tableCols, 'remove' , self.resetColOptions);
self.listenTo(tableCols, 'change:name', self.resetColOptions);
}
self.custom_options();
} else {
Backform.MultiSelectAjaxControl.prototype.initialize.apply(this, arguments);
}
self.model.get('columns').on('pgadmin:multicolumn:updated', function() {
self.render.apply(self);
});
},
resetColOptions: function(m) {
var self = this;
setTimeout(function () {
self.custom_options();
self.render.apply(self);
}, 50);
},
custom_options: function() {
// We will add all the columns entered by user in table model
var columns = this.model.top.get('columns'),
added_columns_from_tables = [];
if (columns.length > 0) {
_.each(columns.models, function(m) {
var col = m.get('name');
if(!_.isUndefined(col) && !_.isNull(col)) {
added_columns_from_tables.push(
{label: col, value: col, image:'icon-column'}
);
}
});
}
// Set the values in to options so that user can select
this.field.set('options', added_columns_from_tables);
},
onChange: function(e) {
var self = this,
model = this.model,
$el = $(e.target),
attrArr = this.field.get("name").split('.'),
name = attrArr.shift(),
path = attrArr.join('.'),
vals = this.getValueFromDOM(),
collection = model.get(name),
removed = [];
this.stopListening(this.model, "change:" + name, this.render);
/*
* Iterate through all the values, and find out how many are already
* present in the collection.
*/
collection.each(function(m) {
var column = m.get('column'),
idx = _.indexOf(vals, column);
if (idx > -1) {
vals.splice(idx, 1);
} else {
removed.push(column);
}
});
/*
* Adding new values
*/
_.each(vals, function(v) {
var m = new (self.field.get('model'))(
{column: v}, { silent: true,
top: self.model.top,
collection: collection,
handler: collection
});
collection.add(m);
});
/*
* Removing unwanted!
*/
_.each(removed, function(v) {
collection.remove(collection.where({column: v}));
});
this.listenTo(this.model, "change:" + name, this.render);
},
remove: function() {
if(this.model.handler) {
var self = this,
tableCols = self.model.top.get('columns');
self.stopListening(tableCols, 'remove' , self.resetColOptions);
self.stopListening(tableCols, 'change:name' , self.resetColOptions);
self.model.get('columns').off('pgadmin:multicolumn:updated');
Backform.Select2Control.prototype.remove.apply(this, arguments);
} else {
Backform.MultiSelectAjaxControl.prototype.remove.apply(this, arguments);
}
}
}),
deps: ['index'], node: 'column',
model: pgBrowser.Node.Model.extend({
defaults: {
column: undefined
},
validate: function() {
return null;
}
}),
transform : function(data){
var res = [];
if (data && _.isArray(data)) {
_.each(data, function(d) {
res.push({label: d.label, value: d.label, image:'icon-column'});
})
}
return res;
},
select2:{allowClear:false},
disabled: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update columns of existing index constraint.
if (!m.isNew()) {
return true;
}
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
return false;
} else {
var col = m.get('columns');
col.reset();
return true;
}
}
},{
id: 'spcname', label: gettext('Tablespace'),
type: 'text', group: gettext('Definition'),
control: 'node-list-by-name', node: 'tablespace',
deps: ['index'],
select2:{allowClear:false},
filter: function(m) {
// Don't show pg_global tablespace in selection.
if (m.label == "pg_global") return false;
else return true;
},
disabled: function(m) {
// Disable if index is selected.
m = m.top || m;
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
return false;
} else {
setTimeout(function(){
m.set('spcname', '');
},10);
return true;
}
}
},{
id: 'index', label: gettext('Index'),
type: 'text', group: gettext('Definition'),
control: Backform.NodeListByNameControl.extend({
initialize:function() {
if (_.isUndefined(this.model.top)) {
Backform.NodeListByNameControl.prototype.initialize.apply(this,arguments);
} else {
Backform.Control.prototype.initialize.apply(this,arguments);
}
}
}),
select2:{allowClear:true}, node: 'index',
disabled: function(m) {
// If we are in table edit mode then disable it
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
return true;
}
// We can't update index of existing index constraint.
return !m.isNew();
},
// We will not show this field in Create Table mode
visible: function(m) {
return !_.isUndefined(m.top.node_info['table']);
}
},{
id: 'fillfactor', label: gettext('Fill factor'), deps: ['index'],
type: 'int', group: gettext('Definition'), allowNull: true,
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
return false;
} else {
setTimeout(function(){
m.set('fillfactor', null);
},10);
return true;
}
}
},{
id: 'condeferrable', label: gettext('Deferrable?'),
type: 'switch', group: gettext('Definition'), deps: ['index'],
disabled: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update condeferrable of existing index constraint.
if (!m.isNew()) {
return true;
}
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
return false;
} else {
setTimeout(function(){
if(m.get('condeferrable'))
m.set('condeferrable', false);
},10);
return true;
}
}
},{
id: 'condeferred', label: gettext('Deferred?'),
type: 'switch', group: gettext('Definition'),
deps: ['condeferrable'],
disabled: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update condeferred of existing index constraint.
if (!m.isNew()) {
return true;
}
// Disable if condeferred is false or unselected.
if(m.get('condeferrable') == true) {
return false;
} else {
setTimeout(function(){
if(m.get('condeferred'))
m.set('condeferred', false);
},10);
return true;
}
}
}
],
validate: function() {
this.errorModel.clear();
// Clear parent's error as well
if (_.has(this, 'top')) {
this.top.errorModel.clear();
}
var columns = this.get('columns'),
index = this.get('index');
if ((_.isUndefined(index) || String(index).replace(/^\s+|\s+$/g, '') == '') &&
(_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) {
var msg = gettext('Please specify columns for %(node)s', {node: '{{ node_label }}'});
this.errorModel.set('columns', msg);
return msg;
}
return null;
}
})
});
}
return pgBrowser.Nodes['{{node_type}}'];
});

View File

@ -1,7 +1,7 @@
define('pgadmin.node.constraints', [
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin',
'pgadmin.browser', 'pgadmin.browser.collection', 'pgadmin.node.unique_constraint',
'pgadmin.node.check_constraints', 'pgadmin.node.foreign_key',
'pgadmin.node.check_constraint', 'pgadmin.node.foreign_key',
'pgadmin.node.exclusion_constraint', 'pgadmin.node.primary_key'
], function(gettext, $, _, S, pgAdmin, pgBrowser) {

View File

@ -127,6 +127,14 @@ class IndexesModule(CollectionNodeModule):
"""
return False
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = IndexesModule(__name__)

View File

@ -121,6 +121,14 @@ class RuleModule(CollectionNodeModule):
return snippets
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
# Create blueprint of RuleModule.
blueprint = RuleModule(__name__)

View File

@ -114,6 +114,14 @@ class TriggerModule(CollectionNodeModule):
"""
return False
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
@property
def csssnippets(self):
"""

View File

@ -100,6 +100,15 @@ class ResourceGroupModule(CollectionNodeModule):
return servers.ServerModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = ResourceGroupModule(__name__)

View File

@ -74,6 +74,14 @@ class RoleModule(CollectionNodeModule):
return snippets
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
blueprint = RoleModule(__name__)

View File

@ -42,7 +42,7 @@ define('pgadmin.node.server', [
});
pgAdmin.Browser.Nodes['server'] = pgAdmin.Browser.Node.extend({
parent_type: 'server-group',
parent_type: 'server_group',
type: 'server',
dialogHelp: url_for('help.static', {'filename': 'server_dialog.html'}),
label: gettext('Server'),
@ -61,7 +61,7 @@ define('pgadmin.node.server', [
this.initialized = true;
pgBrowser.add_menus([{
name: 'create_server_on_sg', node: 'server-group', module: this,
name: 'create_server_on_sg', node: 'server_group', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 1, label: gettext('Server...'),
data: {action: 'create'}, icon: 'wcTabIcon icon-server'
@ -632,7 +632,7 @@ define('pgadmin.node.server', [
var isNew = (_.size(attrs) === 0);
if (isNew) {
this.set({'gid': args.node_info['server-group']._id});
this.set({'gid': args.node_info['server_group']._id});
}
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
},
@ -643,7 +643,7 @@ define('pgadmin.node.server', [
mode: ['properties', 'edit', 'create']
},{
id: 'gid', label: gettext('Server group'), type: 'int',
control: 'node-list-by-id', node: 'server-group',
control: 'node-list-by-id', node: 'server_group',
mode: ['create', 'edit'], select2: {allowClear: false}
},{
id: 'server_type', label: gettext('Server type'), type: 'options',

View File

@ -46,6 +46,14 @@ class TablespaceModule(CollectionNodeModule):
"""
return servers.ServerModule.NODE_TYPE
@property
def module_use_template_javascript(self):
"""
Returns whether Jinja2 template is used for generating the javascript
module.
"""
return False
@property
def node_inode(self):
return False

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

View File

@ -3,10 +3,10 @@ define('pgadmin.node.server_group', [
'backbone', 'pgadmin.browser', 'pgadmin.browser.node'
], function(gettext, url_for, $, _, pgAdmin, Backbone) {
if (!pgAdmin.Browser.Nodes['server-group']) {
pgAdmin.Browser.Nodes['server-group'] = pgAdmin.Browser.Node.extend({
if (!pgAdmin.Browser.Nodes['server_group']) {
pgAdmin.Browser.Nodes['server_group'] = pgAdmin.Browser.Node.extend({
parent_type: null,
type: 'server-group',
type: 'server_group',
dialogHelp: url_for('help.static', {'filename': 'server_group_dialog.html'}),
label: gettext('Server Group'),
width: '350px',
@ -20,10 +20,10 @@ define('pgadmin.node.server_group', [
this.initialized = true;
pgAdmin.Browser.add_menus([{
name: 'create_server_group', node: 'server-group', module: this,
name: 'create_server_group', node: 'server_group', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
category: 'create', priority: 1, label: gettext('Server Group...'),
data: {'action': 'create'}, icon: 'wcTabIcon icon-server-group'
data: {'action': 'create'}, icon: 'wcTabIcon icon-server_group'
}]);
},
model: pgAdmin.Browser.Node.Model.extend({
@ -78,5 +78,5 @@ define('pgadmin.node.server_group', [
});
}
return pgAdmin.Browser.Nodes['server-group'];
return pgAdmin.Browser.Nodes['server_group'];
});

View File

@ -20,7 +20,7 @@ class SgNodeTestCase(BaseTestGenerator):
scenarios = [
# Fetching the default url for server group node
('Check Server Group Node', dict(url='/browser/server-group/obj/'))
('Check Server Group Node', dict(url='/browser/server_group/obj/'))
]
def runTest(self):

View File

@ -12,7 +12,7 @@ define(
gettext, url_for, require, $, _, S, Bootstrap, pgAdmin, Alertify,
codemirror, checkNodeVisibility
) {
window.jQuery = window.$ = $;
// Some scripts do export their object in the window only.
// Generally the one, which do no have AMD support.
var wcDocker = window.wcDocker;

View File

@ -126,21 +126,23 @@ define(
}
// show query tool only in context menu of supported nodes.
if (_.indexOf(pgAdmin.unsupported_nodes, self.type) == -1) {
pgAdmin.Browser.add_menus([{
name: 'show_query_tool', node: self.type, module: self,
applies: ['context'], callback: 'show_query_tool',
priority: 998, label: gettext('Query Tool...'),
icon: 'fa fa-bolt',
enable: function(itemData, item, data) {
if (itemData._type == 'database' && itemData.allowConn)
return true;
else if(itemData._type != 'database')
return true;
else
return false;
}
}]);
if (true) {
if (_.indexOf(pgAdmin.unsupported_nodes, self.type) == -1) {
pgAdmin.Browser.add_menus([{
name: 'show_query_tool', node: self.type, module: self,
applies: ['context'], callback: 'show_query_tool',
priority: 998, label: gettext('Query Tool...'),
icon: 'fa fa-bolt',
enable: function(itemData, item, data) {
if (itemData._type == 'database' && itemData.allowConn)
return true;
else if(itemData._type != 'database')
return true;
else
return false;
}
}]);
}
}
// This will add options of scripts eg:'CREATE Script'
@ -173,7 +175,7 @@ define(
///////
check_user_permission: function(itemData, item, data) {
// Do not display CREATE script on server group and server node
if (itemData._type == 'server-group' || itemData._type == 'server') {
if (itemData._type == 'server_group' || itemData._type == 'server') {
return false;
}
@ -499,6 +501,7 @@ define(
);
b.removeChild(el);
// delete(el);
return p;
};
@ -992,6 +995,8 @@ define(
if (view) {
// Release the view
view.remove({data: true, internal: true, silent: true});
// Deallocate the view
// delete view;
view = null;
// Reset the data object
j.data('obj-view', null);
@ -1174,6 +1179,7 @@ define(
if (view) {
// Release the view
view.remove({data: true, internal: true, silent: true});
// Deallocate the view
view = null;
// Reset the data object
j.data('obj-view', null);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
define('app', [
'babel-polyfill','pgadmin', 'browser_node', 'tools.datagrid'
'babel-polyfill', 'pgadmin', 'bundled_browser', 'pgadmin.datagrid'
], function() {
var initializeModules = function(Object) {
for (var key in Object) {
@ -20,4 +20,4 @@ define('app', [
// create menus after all modules are initialized.
pgAdmin.Browser.create_menus();
});
});

View File

@ -1,5 +1,5 @@
define('browser_node',[
define('bundled_browser',[
'pgadmin.browser'
], function(pgBrowser) {
pgBrowser.init();
});
});

View File

@ -14,6 +14,6 @@ import 'codemirror/addon/search/jump-to-line';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/comment/comment'
import 'pgadmin.sqlfoldcode';
import '../js/codemirror/addon/fold/pgadmin-sqlfoldcode';
export default CodeMirror;

View File

@ -1,5 +1,4 @@
define(["pgadmin.browser.endpoints"], function (endpoints) {
/***
* This method behaves as a drop-in replacement for flask url_for function.
* It uses the exposed URLs file under the hood, and replace the substitions provided by the modules.

View File

@ -42,7 +42,6 @@
codemirror: "{{ url_for('static', filename='js/generated/codemirror') }}",
datagrid: "{{ url_for('static', filename='js/generated/datagrid') }}",
sqleditor: "{{ url_for('static', filename='js/generated/sqleditor') }}",
'browser_node': "{{ url_for('static', filename='js/generated/browser_node') }}",
'pgadmin.browser.utils': "{{ url_for('browser.index') }}" + "js/utils",
'pgadmin.browser.endpoints': "{{ url_for('browser.index') }}" + "js/endpoints",
'pgadmin.browser.messages': "{{ url_for('browser.index') }}" + "js/messages",

View File

@ -1,4 +1,4 @@
define('tools.datagrid', [
define('pgadmin.datagrid', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'alertify', 'pgadmin',
'bundled_codemirror',
'sources/sqleditor_utils', 'wcdocker'

View File

@ -1,7 +1,7 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror',
'backform', 'tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'backform', 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid', 'pgadmin.browser.frame'
], function(gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) {
@ -162,7 +162,7 @@ define([
_.values(
_.pick(treeInfo,
function(v, k, o) {
return (k != 'server-group');
return (k != 'server_group');
})
),
function(o) { return o.priority; }

View File

@ -1,14 +1,14 @@
define([
'babel-polyfill', 'sources/gettext', 'sources/url_for' ,'jquery', 'underscore', 'underscore.string', 'alertify',
'sources/gettext', 'sources/url_for' ,'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'sources/../bundle/codemirror', 'backform',
'tools.debugger.ui',
'pgadmin.tools.debugger.ui',
'sources/alerts/alertify_wrapper',
'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid'
], function(
babelPolyfill, gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
codemirror, Backform, debug_function_again, AlertifyWrapper
) {

View File

@ -446,7 +446,7 @@ define([
node_(node name), node_type(node type)
and pass it to collection which will fetch Object Type properties.
*/
var gid = info['server-group']._id,
var gid = info['server_group']._id,
sid = info.server._id,
did = info.database._id,
node_id = d._id,

View File

@ -1,6 +1,8 @@
define('tools.querytool', [
'babel-polyfill', 'sources/gettext','sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'backbone', 'sources/../bundle/codemirror', 'pgadmin.misc.explain',
'babel-polyfill', 'sources/gettext','sources/url_for', 'jquery',
'underscore', 'underscore.string', 'alertify',
'pgadmin', 'backbone', 'sources/../bundle/codemirror',
'pgadmin.misc.explain',
'sources/selection/grid_selector',
'sources/selection/active_cell_capture',
'sources/selection/clipboard',
@ -16,7 +18,7 @@ define('tools.querytool', [
'sources/alerts/alertify_wrapper',
'sources/sqleditor/keyboard_shortcuts',
'sources/../bundle/slickgrid',
'misc.file_manager',
'pgadmin.file_manager',
'backgrid.sizeable.columns',
'slick.pgadmin.formatters',
'slick.pgadmin.editors',
@ -30,12 +32,12 @@ define('tools.querytool', [
/* Return back, this has been called more than once */
if (pgAdmin.SqlEditor)
return pgAdmin.SqlEditor;
var CodeMirror = codemirror.default;
// Some scripts do export their object in the window only.
// Generally the one, which do no have AMD support.
var wcDocker = window.wcDocker,
pgBrowser = pgAdmin.Browser,
CodeMirror = codemirror.default,
Slick = window.Slick;
var is_query_running = false;

View File

@ -100,9 +100,9 @@ module.exports = {
entry: {
'app.bundle': sourceDir + '/bundle/app.js',
codemirror: sourceDir + '/bundle/codemirror.js',
sqleditor: './pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js',
debugger_direct: './pgadmin/tools/debugger/templates/debugger/js/direct.js',
file_utils: './pgadmin/misc/file_manager/templates/file_manager/js/utility.js',
sqleditor: './pgadmin/tools/sqleditor/static/js/sqleditor.js',
debugger_direct: './pgadmin/tools/debugger/static/js/direct.js',
file_utils: './pgadmin/misc/file_manager/static/js/utility.js',
pgadmin_css: './pgadmin/static/scss/pgadmin.scss',
style_css: './pgadmin/static/css/style.css',
},
@ -117,15 +117,7 @@ module.exports = {
// Templates files which contains python code needs to load dynamically
// Such files specified in externals are loaded at first and defined in
// the start of generated bundle within define(['libname'],fn) etc.
externals: {
'pgadmin.browser.messages': 'pgadmin.browser.messages',
'pgadmin.browser.utils': 'pgadmin.browser.utils',
'pgadmin.browser.endpoints': 'pgadmin.browser.endpoints',
'pgadmin.server.supported_servers': 'pgadmin.server.supported_servers',
'pgadmin.user_management.current_user': 'pgadmin.user_management.current_user',
'pgadmin.node.unique_key': 'pgadmin.node.unique_key',
'translations': 'translations',
},
externals: webpackShimConfig.externals,
module: {
// References:
// Module and Rules: https://webpack.js.org/configuration/module/
@ -155,15 +147,15 @@ module.exports = {
query: webpackShimConfig,
include: path.join(__dirname, '/pgadmin/browser'),
}, {
test: require.resolve('./pgadmin/tools/datagrid/templates/datagrid/js/datagrid'),
test: require.resolve('./pgadmin/tools/datagrid/static/js/datagrid'),
use: {
loader: 'imports-loader?' +
'pgadmin.dashboard' +
',pgadmin.tools.user_management' +
',misc.statistics' +
',misc.depends' +
',misc.sql' +
',misc.bgprocess' +
',pgadmin.browser.object_statistics' +
',pgadmin.browser.object_depends' +
',pgadmin.browser.object_sql' +
',pgadmin.browser.bgprocess' +
',pgadmin.node.server_group' +
',pgadmin.node.server' +
',pgadmin.node.database' +
@ -221,15 +213,15 @@ module.exports = {
loader: 'imports-loader?' +
'pgadmin.about' +
',pgadmin.preferences' +
',misc.file_manager' +
',pgadmin.file_manager' +
',pgadmin.settings' +
',tools.backup' +
',tools.restore' +
',tools.grant_wizard' +
',tools.maintenance' +
',tools.import_export' +
',tools.debugger' +
',tools.direct',
',pgadmin.tools.backup' +
',pgadmin.tools.restore' +
',pgadmin.tools.grant_wizard' +
',pgadmin.tools.maintenance' +
',pgadmin.tools.import_export' +
',pgadmin.tools.debugger.controller' +
',pgadmin.tools.debugger.direct',
},
}, {
test: require.resolve('snapsvg'),

View File

@ -116,9 +116,8 @@ var webpackShimConfig = {
// Map module id to file path used in 'define(['baseurl', 'misc']). It is
// used by webpack while creating bundle
resolveAlias: {
'baseurl': path.join(__dirname, './pgadmin'),
'misc': path.join(__dirname, './pgadmin/static/bundle/misc'),
'browser_node': path.join(__dirname, './pgadmin/static/bundle/browser'),
'bundled_codemirror': path.join(__dirname, './pgadmin/static/bundle/codemirror'),
'bundled_browser': path.join(__dirname, './pgadmin/static/bundle/browser'),
'sources': path.join(__dirname, './pgadmin/static/js'),
'pgadmin': path.join(__dirname, './pgadmin/static/js/pgadmin'),
'tools.translations': path.join(__dirname, './pgadmin/tools/templates/js/translations'),
@ -156,112 +155,114 @@ var webpackShimConfig = {
'backgrid.filter': path.join(__dirname, './node_modules/backgrid-filter/backgrid-filter'),
'backgrid.sizeable.columns': path.join(__dirname, './node_modules/backgrid-sizeable-columns/backgrid-sizeable-columns'),
'backgrid.select.all': path.join(__dirname, './node_modules/backgrid-select-all/backgrid-select-all'),
'pgadmin.alertifyjs': path.join(__dirname, './pgadmin/static/js/alertify.pgadmin.defaults'),
'pgadmin.backform': path.join(__dirname, './pgadmin/static/js/backform.pgadmin'),
'pgadmin.backgrid': path.join(__dirname, './pgadmin/static/js/backgrid.pgadmin'),
'pgadmin.misc.explain': path.join(__dirname, './pgadmin/misc/templates/explain/js/explain'),
'pgadmin.settings': path.join(__dirname, './pgadmin/settings/templates/settings/settings'),
'pgadmin.preferences': path.join(__dirname, './pgadmin/preferences/templates/preferences/preferences'),
'pgadmin.dashboard': path.join(__dirname, './pgadmin/dashboard/templates/dashboard/js/dashboard'),
'bundled_codemirror': path.join(__dirname, './pgadmin/static/bundle/codemirror'),
'pgadmin.sqlfoldcode': path.join(__dirname, './pgadmin/static/js/codemirror/addon/fold/pgadmin-sqlfoldcode'),
'pgadmin.about': path.join(__dirname, './pgadmin/about/templates/about/about'),
//tools JS
'tools.backup': path.join(__dirname, './pgadmin/tools/backup/templates/backup/js/backup'),
'tools.restore': path.join(__dirname, './pgadmin/tools/restore/templates/restore/js/restore'),
'pgadmin.browser.wizard': path.join(__dirname, './pgadmin/browser/static/js/wizard'),
'tools.grant_wizard': path.join(__dirname, './pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard'),
'tools.datagrid': path.join(__dirname, './pgadmin/tools/datagrid/templates/datagrid/js/datagrid'),
'tools.querytool': path.join(__dirname, './pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor'),
'tools.maintenance': path.join(__dirname, './pgadmin/tools/maintenance/templates/maintenance/js/maintenance'),
'tools.import_export': path.join(__dirname, './pgadmin/tools/import_export/templates/import_export/js/import_export'),
'tools.debugger.ui': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/debugger_ui'),
'tools.debugger': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/debugger'),
'tools.direct': path.join(__dirname, './pgadmin/tools/debugger/templates/debugger/js/direct'),
// Misc JS
'misc.bgprocess': path.join(__dirname, './pgadmin/misc/bgprocess/static/js/bgprocess'),
'misc.file_manager': path.join(__dirname, './pgadmin/misc/file_manager/templates/file_manager/js/file_manager'),
'misc.file_utility': path.join(__dirname, './pgadmin/misc/file_manager/templates/file_manager/js/utility'),
'misc.statistics': path.join(__dirname, './pgadmin/misc/statistics/static/js/statistics'),
'misc.depends': path.join(__dirname, './pgadmin/misc/depends/static/js/depends'),
'misc.sql': path.join(__dirname, './pgadmin/misc/sql/static/js/sql'),
// Browser Plugins JS
'pgadmin.browser': path.join(__dirname, './pgadmin/browser/templates/browser/js/browser'),
'pgadmin.browser.error': path.join(__dirname, './pgadmin/browser/templates/browser/js/error'),
'pgadmin.browser.utils': path.join(__dirname, './pgadmin/browser/templates/browser/js/utils'),
'pgadmin.browser.server.privilege': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/privilege'),
'pgadmin.browser.server.variable': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/variable'),
'pgadmin.browser.collection': path.join(__dirname, './pgadmin/browser/templates/browser/js/collection'),
'pgadmin.browser.node': path.join(__dirname, './pgadmin/browser/templates/browser/js/node'),
'pgadmin.browser.node.ui': path.join(__dirname, './pgadmin/browser/static/js/node.ui'),
'pgadmin.browser.datamodel': path.join(__dirname, './pgadmin/browser/static/js/datamodel'),
'pgadmin.browser.menu': path.join(__dirname, './pgadmin/browser/static/js/menu'),
'pgadmin.browser.panel': path.join(__dirname, './pgadmin/browser/static/js/panel'),
'pgadmin.browser.frame': path.join(__dirname, './pgadmin/browser/static/js/frame'),
'pgadmin.tools.user_management': path.join(__dirname, './pgadmin/tools/user_management/templates/user_management/js/user_management'),
'slick.pgadmin.editors': path.join(__dirname, './pgadmin/static/js/slickgrid/slick.pgadmin.editors'),
'slick.pgadmin.formatters': path.join(__dirname, './pgadmin/static/js/slickgrid/slick.pgadmin.formatters'),
// Browser Nodes JS
'pgadmin.node.server_group': path.join(__dirname, './pgadmin/browser/server_groups/static/js/server-group'),
'pgadmin.node.server': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/server'),
'pgadmin.node.database': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/static/js/database'),
'pgadmin.node.role': path.join(__dirname, './pgadmin/browser/server_groups/servers/roles/templates/role/js/role'),
'pgadmin.node.tablespace': path.join(__dirname, './pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces'),
'pgadmin.node.resource_group': path.join(__dirname, './pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups'),
'pgadmin.node.cast': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/casts/static/js/cast'),
'pgadmin.node.event_trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger'),
'pgadmin.node.extension': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension'),
'pgadmin.node.foreign_data_wrapper': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper'),
'pgadmin.node.language': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/languages/static/js/language'),
'pgadmin.node.schema': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema'),
'pgadmin.node.catalog': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog'),
'pgadmin.node.catalog_object': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object'),
'pgadmin.node.collation': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation'),
'pgadmin.node.domain': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain'),
'pgadmin.node.domain_constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints'),
'pgadmin.node.foreign_table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign-table'),
'pgadmin.node.fts_configuration': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration'),
'pgadmin.node.fts_dictionary': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary'),
'pgadmin.node.fts_parser': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/static/js/fts_parser'),
'pgadmin.node.fts_template': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template'),
'pgadmin.node.function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function'),
'pgadmin.node.procedure': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure'),
'pgadmin.node.trigger_function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function'),
'pgadmin.node.package': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package'),
'pgadmin.node.sequence': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence'),
'pgadmin.node.synonym': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym'),
'pgadmin.node.table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table'),
'pgadmin.browser.table.partition.utils': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils'),
'pgadmin.node.type': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type'),
'pgadmin.node.view': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view'),
'pgadmin.node.mview': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview'),
'pgadmin.node.rule': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules'),
'pgadmin.node.index': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index'),
'pgadmin.node.trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger'),
'pgadmin.node.column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column'),
'pgadmin.node.constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints'),
'pgadmin.node.check_constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint'),
'pgadmin.node.exclusion_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint'),
'pgadmin.node.foreign_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key'),
'pgadmin.node.primary_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key'),
'pgadmin.node.unique_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint'),
'pgadmin.node.catalog_object_column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column'),
'pgadmin.node.edbfunc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc'),
'pgadmin.node.edbproc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc'),
'pgadmin.node.edbvar': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar'),
// pgAgent jobs JS
'pgadmin.node.pga_job': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job'),
'pgadmin.node.pga_schedule': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule'),
'pgadmin.tools.maintenance': path.join(__dirname, './pgadmin/tools/maintenance/static/js/maintenance'),
'pgadmin.node.pga_jobstep': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep'),
'pgadmin.sqleditor': path.join(__dirname, './pgadmin/tools/sqleditor/static/js/sqleditor'),
'pgadmin.node.foreign_server': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/static/js/foreign_server'),
'pgadmin.node.domain': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain'),
'pgadmin.tools.user_management': path.join(__dirname, './pgadmin/tools/user_management/static/js/user_management'),
'pgadmin.browser': path.join(__dirname, './pgadmin/browser/static/js/browser'),
'pgadmin.browser.object_statistics': path.join(__dirname, './pgadmin/misc/statistics/static/js/statistics'),
'pgadmin.node.constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/static/js/constraints'),
'pgadmin.browser.table.partition.utils': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/partition.utils'),
'pgadmin.node.catalog': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/catalog'),
'pgadmin.node.role': path.join(__dirname, './pgadmin/browser/server_groups/servers/roles/static/js/role'),
'pgadmin.node.check_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/static/js/check_constraint'),
'translations': '/tools/translations',
'pgadmin.node.user_mapping': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/static/js/user_mapping'),
'pgadmin.browser.messages': '/browser/js/messages',
'pgadmin.node.collation': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/collations/static/js/collation'),
'pgadmin.browser.endpoints': '/browser/js/endpoints',
'pgadmin.node.table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table'),
'pgadmin.node.tablespace': path.join(__dirname, './pgadmin/browser/server_groups/servers/tablespaces/static/js/tablespace'),
'pgadmin.node.server': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/server'),
'pgadmin.node.package': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/static/js/package'),
'pgadmin.browser.menu': path.join(__dirname, './pgadmin/browser/static/js/menu'),
'pgadmin.browser.node.ui': path.join(__dirname, './pgadmin/browser/static/js/node.ui'),
'pgadmin.node.rule': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/static/js/rule'),
'pgadmin.node.server_group': path.join(__dirname, './pgadmin/browser/server_groups/static/js/server_group'),
'pgadmin.tools.backup': path.join(__dirname, './pgadmin/tools/backup/static/js/backup'),
'pgadmin.node.fts_configuration': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/static/js/fts_configuration'),
'pgadmin.node.event_trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/event_triggers/static/js/event_trigger'),
'pgadmin.browser.bgprocess': path.join(__dirname, './pgadmin/misc/bgprocess/static/js/bgprocess'),
'pgadmin.node.pga_job': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job'),
'pgadmin.node.function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/function'),
'pgadmin.file_utility': path.join(__dirname, './pgadmin/misc/file_manager/static/js/utility'),
'pgadmin.browser.object_depends': path.join(__dirname, './pgadmin/misc/depends/static/js/depends'),
'pgadmin.node.edbfunc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/static/js/edbfunc'),
'pgadmin.node.sequence': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/sequences/static/js/sequence'),
'pgadmin.node.edbproc': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/static/js/edbproc'),
'pgadmin.browser.object_sql': path.join(__dirname, './pgadmin/misc/sql/static/js/sql'),
'pgadmin.preferences': path.join(__dirname, './pgadmin/preferences/static/js/preferences'),
'pgadmin.node.domain_constraints': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/static/js/domain_constraints'),
'slick.pgadmin.formatters': path.join(__dirname, './pgadmin/tools/../static/js/slickgrid/slick.pgadmin.formatters'),
'pgadmin.node.catalog_object': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/static/js/catalog_object'),
'pgadmin.dashboard': path.join(__dirname, './pgadmin/dashboard/static/js/dashboard'),
'pgadmin.node.foreign_data_wrapper': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/static/js/foreign_data_wrapper'),
'pgadmin.node.foreign_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key'),
'pgadmin.browser.server.variable': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/variable'),
'pgadmin.tools.grant_wizard': path.join(__dirname, './pgadmin/tools/grant_wizard/static/js/grant_wizard'),
'pgadmin.browser.datamodel': path.join(__dirname, './pgadmin/browser/static/js/datamodel'),
'pgadmin.tools.restore': path.join(__dirname, './pgadmin/tools/restore/static/js/restore'),
'pgadmin.node.procedure': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/procedure'),
'pgadmin.browser.server.privilege': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/privilege'),
'pgadmin.node.resource_group': path.join(__dirname, './pgadmin/browser/server_groups/servers/resource_groups/static/js/resource_group'),
'pgadmin.node.exclusion_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/static/js/exclusion_constraint'),
'pgadmin.node.primary_key': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/primary_key'),
'pgadmin.tools.debugger.direct': path.join(__dirname, './pgadmin/tools/debugger/static/js/direct'),
'pgadmin.settings': path.join(__dirname, './pgadmin/settings/static/js/settings'),
'pgadmin.node.schema': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/static/js/schema'),
'pgadmin.browser.error': path.join(__dirname, './pgadmin/browser/static/js/error'),
'pgadmin.tools.import_export': path.join(__dirname, './pgadmin/tools/import_export/static/js/import_export'),
'pgadmin.node.view': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/view'),
'pgadmin.tools.debugger.ui': path.join(__dirname, './pgadmin/tools/debugger/static/js/debugger_ui'),
'pgadmin.node.pga_schedule': path.join(__dirname, './pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule'),
'pgadmin.node.catalog_object_column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column'),
'pgadmin.browser.collection': path.join(__dirname, './pgadmin/browser/static/js/collection'),
'pgadmin.browser.node': path.join(__dirname, './pgadmin/browser/static/js/node'),
'pgadmin.misc.explain': path.join(__dirname, './pgadmin/misc/static/explain/js/explain'),
'pgadmin.node.synonym': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/synonyms/static/js/synonym'),
'pgadmin.node.extension': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension'),
'pgadmin.node.unique_constraint': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/static/js/unique_constraint'),
'pgadmin.node.database': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/static/js/database'),
'pgadmin.node.edbvar': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/static/js/edbvar'),
'pgadmin.node.trigger': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger'),
'pgadmin.browser.wizard': path.join(__dirname, './pgadmin/browser/static/js/wizard'),
'pgadmin.server.supported_servers': '/browser/server/supported_servers',
'pgadmin.node.partition': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/partitions/static/js/partition'),
'pgadmin.node.fts_template': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/static/js/fts_template'),
'pgadmin.node.cast': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/casts/static/js/cast'),
'pgadmin.tools.debugger.controller': path.join(__dirname, './pgadmin/tools/debugger/static/js/debugger'),
'pgadmin.node.fts_parser': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/static/js/fts_parser'),
'pgadmin.browser.utils': '/browser/js/utils',
'pgadmin.about': path.join(__dirname, './pgadmin/about/static/js/about'),
'slick.pgadmin.editors': path.join(__dirname, './pgadmin/tools/../static/js/slickgrid/slick.pgadmin.editors'),
'pgadmin.node.column': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/column/static/js/column'),
'pgadmin.node.foreign_table': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/static/js/foreign_table'),
'pgadmin.node.fts_dictionary': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/static/js/fts_dictionary'),
'pgadmin.datagrid': path.join(__dirname, './pgadmin/tools/datagrid/static/js/datagrid'),
'pgadmin.node.trigger_function': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/functions/static/js/trigger_function'),
'pgadmin.user_management.current_user': '/user_management/current_user',
'pgadmin.node.index': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/static/js/index'),
'pgadmin.browser.frame': path.join(__dirname, './pgadmin/browser/static/js/frame'),
'pgadmin.node.type': path.join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas/types/static/js/type'),
'pgadmin.file_manager': path.join(__dirname, './pgadmin/misc/file_manager/static/js/file_manager'),
},
externals: [
'pgadmin.user_management.current_user',
'translations',
'pgadmin.browser.endpoints',
'pgadmin.browser.messages',
'pgadmin.browser.utils',
'pgadmin.server.supported_servers',
],
// Define list of pgAdmin common libraries to bundle them separately
// into commons JS from app.bundle.js
pgLibs: [
@ -269,8 +270,8 @@ var webpackShimConfig = {
'pgadmin.browser.server.variable', 'pgadmin.browser.collection', 'pgadmin.browser.node.ui',
'pgadmin.browser.datamodel', 'pgadmin.browser.menu', 'pgadmin.browser.panel', 'pgadmin',
'pgadmin.browser.frame', 'slick.pgadmin.editors', 'slick.pgadmin.formatters',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser', 'misc.file_manager',
'misc.file_utility', 'sources/alerts/alertify_wrapper', 'pgadmin.browser.node',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser', 'pgadmin.file_manager',
'pgadmin.file_utility', 'sources/alerts/alertify_wrapper', 'pgadmin.browser.node',
'pgadmin.alertifyjs', 'pgadmin.settings', 'pgadmin.preferences', 'pgadmin.sqlfoldcode',
],
// Checks whether JS module is npm module or not