Update all Python and JS dependencies. Fixes #4019

This commit is contained in:
Khushboo Vashi
2019-03-14 15:11:16 +00:00
committed by Dave Page
parent c7b29d35ae
commit e4417229aa
133 changed files with 8649 additions and 8569 deletions

View File

@@ -12,7 +12,7 @@ define('pgadmin.node.cast', [
'underscore.string', 'sources/pgadmin', 'pgadmin.browser',
'pgadmin.alertifyjs', 'pgadmin.backform', 'pgadmin.browser.collection',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, Backform) {
// Extend the collection class for cast
// Extend the collection class for cast
if (!pgBrowser.Nodes['coll-cast']) {
pgAdmin.Browser.Nodes['coll-cast'] =
pgAdmin.Browser.Collection.extend({
@@ -23,7 +23,7 @@ define('pgadmin.node.cast', [
});
}
// Extend the node class for cast
// Extend the node class for cast
if (!pgBrowser.Nodes['cast']) {
pgAdmin.Browser.Nodes['cast'] = pgAdmin.Browser.Node.extend({
parent_type: 'database',
@@ -38,13 +38,13 @@ define('pgadmin.node.cast', [
hasDepends: true,
Init: function() {
// Avoid multiple registration of menus
// Avoid multiple registration of menus
if (this.initialized)
return;
this.initialized = true;
// Add context menus for cast
// Add context menus for cast
pgBrowser.add_menus([{
name: 'create_cast_on_database', node: 'database', module: this,
applies: ['object', 'context'], callback: 'show_obj_properties',
@@ -65,7 +65,7 @@ define('pgadmin.node.cast', [
},
// Define the backform model for cast node
// Define the backform model for cast node
model: pgAdmin.Browser.Node.Model.extend({
idAttribute: 'oid',
defaults: {
@@ -79,7 +79,7 @@ define('pgadmin.node.cast', [
description: undefined, // Comment on the cast
},
// Define the schema for cast
// Define the schema for cast
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
editable: false, type: 'text', disabled: true, cellHeaderClasses: 'width_percent_50',
@@ -99,7 +99,7 @@ define('pgadmin.node.cast', [
return rows;
},
/*
/*
* Control is extended to create cast name from source type and destination type
* once their values are changed
*/
@@ -107,10 +107,10 @@ define('pgadmin.node.cast', [
onChange: function() {
Backform.NodeAjaxOptionsControl.prototype.onChange.apply(
this, arguments
);
this, arguments
);
/*
/*
* On source type change, check if both source type and
* target type are set, if yes then fetch values from both
* controls and generate cast name
@@ -121,12 +121,12 @@ define('pgadmin.node.cast', [
trgtype != undefined && trgtype != '')
this.model.set('name', srctype+'->'+trgtype);
else
this.model.unset('name');
this.model.unset('name');
},
}),
},
/*
/*
* Text control for viewing source type in properties and
* edit mode only
*/
@@ -145,7 +145,7 @@ define('pgadmin.node.cast', [
return rows;
},
/*
/*
* Control is extended to create cast name from source type and destination type
* once their values are changed
*/
@@ -153,10 +153,10 @@ define('pgadmin.node.cast', [
onChange: function() {
Backform.NodeAjaxOptionsControl.prototype.onChange.apply(
this, arguments
);
this, arguments
);
/*
/*
* on target type change, check if both source type and
* target type are set, if yes then fetch values from both
* controls and generate cast name
@@ -167,11 +167,11 @@ define('pgadmin.node.cast', [
trgtype != undefined && trgtype != '')
this.model.set('name', srcType+'->'+trgtype);
else
this.model.unset('name');
this.model.unset('name');
},
}),
},
/*
/*
* Text control for viewing target type in properties and
* edit mode only
*/
@@ -180,7 +180,7 @@ define('pgadmin.node.cast', [
group: gettext('Definition'), disabled: true, mode:['properties','edit'],
},
/*
/*
* Proname field is dependent on source type and target type.
* On source and target type changed event,
* associated functions will be fetch using ajax call
@@ -197,13 +197,13 @@ define('pgadmin.node.cast', [
if(srcTyp != undefined && srcTyp != '' &&
trgtyp != undefined && trgtyp != '')
{
{
var node = control.field.get('schema_node'),
_url = node.generate_url.apply(
node, [
null, 'get_functions', control.field.get('node_data'), false,
control.field.get('node_info'),
]);
node, [
null, 'get_functions', control.field.get('node_data'), false,
control.field.get('node_info'),
]);
$.ajax({
type: 'POST',
timeout: 30000,
@@ -212,15 +212,15 @@ define('pgadmin.node.cast', [
async: false,
data: {'srctyp' : srcTyp, 'trgtyp' : trgtyp},
})
// On success return function list from server
.done(function(result) {
res = result.data;
return res;
})
// On failure show error appropriate error message to user
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
});
// On success return function list from server
.done(function(result) {
res = result.data;
return res;
})
// On failure show error appropriate error message to user
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
});
}
return res;
},

View File

@@ -21,18 +21,18 @@ define('pgadmin.node.foreign_server', [
fsrvvalue: undefined,
},
// Defining schema for the Options model
// Defining schema for the Options model
schema: [
{id: 'fsrvoption', label: gettext('Options'), type:'text', cellHeaderClasses:'width_percent_50', group: null, editable: true},
{id: 'fsrvvalue', label: gettext('Value'), type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true},
{id: 'fsrvoption', label: gettext('Options'), type:'text', cellHeaderClasses:'width_percent_50', group: null, editable: true},
{id: 'fsrvvalue', label: gettext('Value'), type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true},
],
/* validate function is used to validate the input given by
/* validate function is used to validate the input given by
* the user. In case of error, message will be displayed on
* the browser for the respective control.
*/
validate: function() {
// Validation for the option name
// Validation for the option name
if (_.isUndefined(this.get('fsrvoption')) ||
_.isNull(this.get('fsrvoption')) ||
String(this.get('fsrvoption')).replace(/^\s+|\s+$/g, '') == '') {

View File

@@ -13,7 +13,7 @@ define('pgadmin.node.user_mapping', [
'pgadmin.backform', 'pgadmin.browser.collection',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform) {
// Extend the browser's node model class to create a Options model
// Extend the browser's node model class to create a Options model
var OptionsModel = pgAdmin.Browser.Node.Model.extend({
idAttribute: 'umoption',
defaults: {
@@ -21,7 +21,7 @@ define('pgadmin.node.user_mapping', [
umvalue: undefined,
},
// Defining schema for the Options model
// Defining schema for the Options model
schema: [{
id: 'umoption', label: gettext('Options'), type:'text',
cellHeaderClasses:'width_percent_50', group: null, editable: true,
@@ -30,12 +30,12 @@ define('pgadmin.node.user_mapping', [
cellHeaderClasses:'width_percent_50', group:null, editable: true,
}],
/* validate function is used to validate the input given by
/* validate function is used to validate the input given by
* the user. In case of error, message will be displayed on
* the browser for the respective control.
*/
validate: function() {
// Validation for the option value
// Validation for the option value
if (_.isUndefined(this.get('umoption')) ||
_.isNull(this.get('umoption')) ||
String(this.get('umoption')).replace(/^\s+|\s+$/g, '') == '') {

View File

@@ -13,14 +13,14 @@ define('pgadmin.node.foreign_data_wrapper', [
'pgadmin.browser.collection', 'pgadmin.browser.server.privilege',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform) {
// Extend the browser's node model class to create a Options model
// Extend the browser's node model class to create a Options model
var OptionsModel = pgBrowser.Node.Model.extend({
idAttribute: 'fdwoption',
defaults: {
fdwoption: undefined,
fdwvalue: undefined,
},
// Defining schema for the Options model
// Defining schema for the Options model
schema: [{
id: 'fdwoption', label: gettext('Option'), type:'text',
cellHeaderClasses:'width_percent_50', editable: true,
@@ -28,12 +28,12 @@ define('pgadmin.node.foreign_data_wrapper', [
id: 'fdwvalue', label: gettext('Value'), type: 'text',
cellHeaderClasses:'width_percent_50', group:null, editable: true,
}],
/* validate function is used to validate the input given by
/* validate function is used to validate the input given by
* the user. In case of error, message will be displayed on
* the browser for the respective control.
*/
validate: function() {
// Validation for the option name
// Validation for the option name
if (_.isUndefined(this.get('fdwoption')) ||
_.isNull(this.get('fdwoption')) ||
String(this.get('fdwoption')).replace(/^\s+|\s+$/g, '') == '') {
@@ -170,7 +170,7 @@ define('pgadmin.node.foreign_data_wrapper', [
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
}],
/* validate function is used to validate the input given by
/* validate function is used to validate the input given by
* the user. In case of error, message will be displayed on
* the browser for the respective control.
*/

View File

@@ -13,7 +13,7 @@ define('pgadmin.node.collation', [
'pgadmin.node.schema.dir/child', 'pgadmin.node.schema.dir/schema_child_tree_node',
'pgadmin.browser.collection',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, schemaChild,
schemaChildTreeNode) {
schemaChildTreeNode) {
if (!pgBrowser.Nodes['coll-collation']) {
pgAdmin.Browser.Nodes['coll-collation'] =

View File

@@ -209,10 +209,10 @@ define('pgadmin.node.domain', [
_.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 length is allowed for selected type
if(o.length)
{
// set the values in model
{
// set the values in model
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});
@@ -236,10 +236,10 @@ define('pgadmin.node.domain', [
_.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 precession is allowed for selected type
if(o.precision)
{
// set the values in model
{
// 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});
@@ -269,7 +269,7 @@ define('pgadmin.node.domain', [
model: ConstraintModel, canAdd: true, canDelete: true,
canEdit: false, columns: ['conname','consrc', 'convalidated'],
},
pgBrowser.SecurityGroupSchema,
pgBrowser.SecurityGroupSchema,
{
id: 'seclabels', label: gettext('Security labels'),
model: pgBrowser.SecLabelModel, type: 'collection',
@@ -301,7 +301,7 @@ define('pgadmin.node.domain', [
if (!m.isNew()) {
var server = this.node_info.server;
if (server.version < 90200)
{
{
return false;
}
}

View File

@@ -96,7 +96,7 @@ define('pgadmin.node.foreign_table', [
type: 'int', deps: ['datatype'],
disabled: function(m) {
var val = m.get('typlen');
// We will store type from selected from combobox
// We will store type from selected from combobox
if(!(_.isUndefined(m.get('inheritedid'))
|| _.isNull(m.get('inheritedid'))
|| _.isUndefined(m.get('inheritedfrom'))
@@ -115,14 +115,14 @@ define('pgadmin.node.foreign_table', [
if(m.type_options) {
m.set('is_tlength', false, {silent: true});
// iterating over all the types
// iterating over all the types
_.each(m.type_options, function(o) {
// if type from selected from combobox matches in options
// if type from selected from combobox matches in options
if ( of_type == o.value ) {
// if length is allowed for selected type
// if length is allowed for selected type
if(o.length)
{
// set the values in model
{
// set the values in model
has_length = true;
m.set('is_tlength', true, {silent: true});
m.set('min_val', o.min_val, {silent: true});
@@ -171,15 +171,15 @@ define('pgadmin.node.foreign_table', [
if(m.type_options) {
m.set('is_precision', false, {silent: true});
// iterating over all the types
// iterating over all the types
_.each(m.type_options, function(o) {
// if type from selected from combobox matches in options
// if type from selected from combobox matches in options
if ( of_type == o.value ) {
// if precession is allowed for selected type
// if precession is allowed for selected type
if(o.precision)
{
{
has_precision = true;
// set the values in model
// 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});
@@ -263,7 +263,7 @@ define('pgadmin.node.foreign_table', [
}
if (_.isUndefined(this.get('datatype')) || String(this.get('datatype'))
.replace(/^\s+|\s+$/g, '') == '') {
.replace(/^\s+|\s+$/g, '') == '') {
errmsg = gettext('Column Datatype cannot be empty.');
this.errorModel.set('datatype', errmsg);
} else {
@@ -345,10 +345,10 @@ define('pgadmin.node.foreign_table', [
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,
]),
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');
@@ -363,17 +363,17 @@ define('pgadmin.node.foreign_table', [
url: full_url,
data: data,
})
.done(function(res) {
.done(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);
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
})
.fail(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'
@@ -444,7 +444,7 @@ define('pgadmin.node.foreign_table', [
}
if (_.isUndefined(this.get('consrc')) || String(this.get('consrc'))
.replace(/^\s+|\s+$/g, '') == '') {
.replace(/^\s+|\s+$/g, '') == '') {
err['consrc'] = gettext('Constraint Check cannot be empty.');
errmsg = errmsg || err['consrc'];
}
@@ -631,8 +631,8 @@ define('pgadmin.node.foreign_table', [
mode: ['properties'], min_version: 90200,
}, pgBrowser.SecurityGroupSchema, {
id: 'acl', label: gettext('Privileges'), model: pgAdmin
.Browser.Node.PrivilegeRoleModel.extend(
{privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'],
.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',
@@ -657,7 +657,7 @@ define('pgadmin.node.foreign_table', [
}
if (_.isUndefined(this.get('basensp')) || String(this.get('basensp'))
.replace(/^\s+|\s+$/g, '') == '') {
.replace(/^\s+|\s+$/g, '') == '') {
err['basensp'] = gettext('Schema cannot be empty.');
errmsg = errmsg || err['basensp'];
}

View File

@@ -24,7 +24,7 @@ define('pgadmin.node.fts_configuration', [
dictname: undefined,
},
keys: ['token'],
// Define the schema for the token/dictionary list
// Define the schema for the token/dictionary list
schema: [{
id: 'token', label: gettext('Token'), type:'text', group: null,
cellHeaderClasses:'width_percent_50',
@@ -34,9 +34,9 @@ define('pgadmin.node.fts_configuration', [
cellHeaderClasses:'width_percent_50', editable: true,
cell:Backgrid.Extension.MultiSelectAjaxCell, url: 'dictionaries',
}],
// Validation for token and dictionary list
// Validation for token and dictionary list
validate: function() {
// Clear any existing errors.
// Clear any existing errors.
var msg;
this.errorModel.clear();
var token = this.get('token');
@@ -61,14 +61,14 @@ define('pgadmin.node.fts_configuration', [
},
});
// Customized control for token control
// Customized control for token control
var TokenControl = Backform.TokenControl =
Backform.UniqueColCollectionControl.extend({
initialize: function() {
Backform.UniqueColCollectionControl.prototype.initialize.apply(
this, arguments
);
this, arguments
);
var self = this,
headerSchema = [{
@@ -82,7 +82,7 @@ define('pgadmin.node.fts_configuration', [
Backform.NodeAjaxOptionsControl.prototype.initialize.apply(
this,
arguments
);
);
var self = this,
url = self.field.get('url') || self.defaults.url,
m = self.model.top || self.model;
@@ -122,20 +122,20 @@ define('pgadmin.node.fts_configuration', [
async: false,
url: full_url,
})
.done(function(res) {
/*
.done(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
);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
data = cache_node.cache(url,
node_info,
cache_level,
res.data
);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
@@ -169,16 +169,16 @@ define('pgadmin.node.fts_configuration', [
// Grid columns backgrid
gridCols = ['token', 'dictname'];
// Creating model for header control which is used to add new tokens
// Creating model for header control which is used to add new tokens
self.headerData = new (Backbone.Model.extend({
defaults: headerDefaults,
schema: headerSchema,
}))({});
// Creating view from header schema in tokens control
// Creating view from header schema in tokens control
var headerGroups = Backform.generateViewSchema(
self.field.get('node_info'), self.headerData, 'create',
self.field.get('schema_node'), self.field.get('node_data')
self.field.get('node_info'), self.headerData, 'create',
self.field.get('schema_node'), self.field.get('node_data')
),
fields = [];
@@ -187,13 +187,13 @@ define('pgadmin.node.fts_configuration', [
});
self.headerFields = new Backform.Fields(fields);
// creating grid using grid columns
// creating grid using grid columns
self.gridSchema = Backform.generateGridColumnsFromModel(
self.field.get('node_info'), self.field.get('model'),
'edit', gridCols, self.field.get('schema_node')
);
);
// Providing behaviour control functions to header and grid control
// Providing behaviour control functions to header and grid control
self.controls = [];
self.listenTo(self.headerData, 'change', self.headerDataChanged);
self.listenTo(self.headerData, 'select2', self.headerDataChanged);
@@ -201,7 +201,7 @@ define('pgadmin.node.fts_configuration', [
self.listenTo(self.collection, 'remove', self.onAddorRemoveTokens);
},
// Template for creating header view
// Template for creating header view
generateHeader: function(data) {
var header = [
'<div class="subnode-header-form">',
@@ -234,19 +234,19 @@ define('pgadmin.node.fts_configuration', [
});
$header.find('div[header="' + field.get('name') + '"]').append(
control.render().$el
);
control.render().$el
);
control.$el.find('.control-label').remove();
controls.push(control);
});
// We should not show add button in properties mode
// We should not show add button in properties mode
if (data.mode == 'properties') {
$header.find('button.add').remove();
}
// Disable add button in token control in create mode
// Disable add button in token control in create mode
if(data.mode == 'create') {
$header.find('button.add').attr('disabled', true);
}
@@ -255,13 +255,13 @@ define('pgadmin.node.fts_configuration', [
return $header;
},
// Providing event handler for add button in header
// Providing event handler for add button in header
events: _.extend(
{}, Backform.UniqueColCollectionControl.prototype.events,
{'click button.add': 'addTokens'}
),
{}, Backform.UniqueColCollectionControl.prototype.events,
{'click button.add': 'addTokens'}
),
// Show token/dictionary grid
// Show token/dictionary grid
showGridControl: function(data) {
var self = this,
@@ -269,14 +269,14 @@ define('pgadmin.node.fts_configuration', [
$gridBody = $('<div></div>', {
class:'pgadmin-control-group backgrid form-group col-12 object subnode',
}).append(
titleTmpl({label: data.label})
titleTmpl({label: data.label})
);
$gridBody.append(self.generateHeader(data));
var gridColumns = _.clone(this.gridSchema.columns);
// Insert Delete Cell into Grid
// Insert Delete Cell into Grid
if (data.disabled == false && data.canDelete) {
gridColumns.unshift({
name: 'pg-backform-delete', label: '',
@@ -289,7 +289,7 @@ define('pgadmin.node.fts_configuration', [
self.grid.remove();
self.grid.null;
}
// Initialize a new Grid instance
// Initialize a new Grid instance
var grid = self.grid = new Backgrid.Grid({
columns: gridColumns,
collection: self.collection,
@@ -299,21 +299,21 @@ define('pgadmin.node.fts_configuration', [
$gridBody.append(self.$grid);
// Find selected dictionaries in grid and show it all together
// Find selected dictionaries in grid and show it all together
setTimeout(function() {
self.headerData.set({
'token': self.$header.find(
'div[header="token"] select'
'div[header="token"] select'
).val(),
}, {silent:true}
);
}, 10);
// Render node grid
// Render node grid
return $gridBody;
},
// When user change the header control to add a new token
// When user change the header control to add a new token
headerDataChanged: function() {
var self = this,
data = this.headerData.toJSON(),
@@ -326,7 +326,7 @@ define('pgadmin.node.fts_configuration', [
self.$header.find('button.add').prop('disabled', inSelected);
},
// Get called when user click on add button header
// Get called when user click on add button header
addTokens: function(ev) {
ev.preventDefault();
var self = this,
@@ -338,14 +338,14 @@ define('pgadmin.node.fts_configuration', [
var coll = self.model.get(self.field.get('name')),
m = new (self.field.get('model'))(
self.headerData.toJSON(), {
silent: true, top: self.model.top,
collection: coll, handler: coll,
}),
self.headerData.toJSON(), {
silent: true, top: self.model.top,
collection: coll, handler: coll,
}),
checkVars = ['token'],
idx = -1;
// Find if token exists in grid
// Find if token exists in grid
self.collection.each(function(m) {
_.each(checkVars, function(v) {
var val = m.get(v);
@@ -357,7 +357,7 @@ define('pgadmin.node.fts_configuration', [
// remove 'm' if duplicate value found.
// remove 'm' if duplicate value found.
if (idx == -1) {
coll.add(m);
idx = coll.indexOf(m);
@@ -365,18 +365,18 @@ define('pgadmin.node.fts_configuration', [
self.$grid.find('.new').removeClass('new');
var newRow = self.grid.body.rows[idx].$el;
newRow.addClass('new');
//$(newRow).pgMakeVisible('table-bordered');
//$(newRow).pgMakeVisible('table-bordered');
$(newRow).pgMakeVisible('backform-tab');
return false;
},
// When user delete token/dictionary entry from grid
// When user delete token/dictionary entry from grid
onAddorRemoveTokens: function() {
var self = this;
/*
/*
* Wait for collection to be updated before checking for the button to
* be enabled, or not.
*/
@@ -386,7 +386,7 @@ define('pgadmin.node.fts_configuration', [
}, 10);
},
// When control is about to destroy
// When control is about to destroy
remove: function() {
/*
* Stop listening the events registered by this control.
@@ -395,13 +395,13 @@ define('pgadmin.node.fts_configuration', [
this.listenTo(this.headerData, 'select2', this.headerDataChanged);
this.listenTo(this.collection, 'remove', this.onAddorRemoveTokens);
// Remove header controls.
// Remove header controls.
_.each(this.controls, function(control) {
control.remove();
});
TokenControl.__super__.remove.apply(this, arguments);
// Remove the header model
// Remove the header model
delete (this.headerData);
},
@@ -551,7 +551,7 @@ define('pgadmin.node.fts_configuration', [
var copy_config_or_parser = !(parser === '' ||
_.isUndefined(parser) ||
_.isNull(parser)) ?
this.get('prsname') : this.get('copy_config');
this.get('prsname') : this.get('copy_config');
var schema = this.get('schema');
// Clear the existing error model

View File

@@ -14,7 +14,7 @@ define('pgadmin.node.fts_dictionary', [
'pgadmin.browser.collection',
], function(
gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, schemaChild,
schemaChildTreeNode
schemaChildTreeNode
) {
// Extend the browser's node model class to create a option/value pair
@@ -23,7 +23,7 @@ define('pgadmin.node.fts_dictionary', [
options: undefined,
value: undefined,
},
// Define the schema for the Options
// Define the schema for the Options
schema: [
{
id: 'option', label: gettext('Option'), type:'text', group: null,

View File

@@ -59,10 +59,10 @@ define('pgadmin.node.function', [
id: 'argmode', label: gettext('Mode'), type: 'options',
control: 'node-ajax-options', cellHeaderClasses:'width_percent_20',
options:[
{'label': 'IN', 'value': 'IN'},
{'label': 'OUT', 'value': 'OUT'},
{'label': 'INOUT', 'value': 'INOUT'},
{'label': 'VARIADIC', 'value': 'VARIADIC'},
{'label': 'IN', 'value': 'IN'},
{'label': 'OUT', 'value': 'OUT'},
{'label': 'INOUT', 'value': 'INOUT'},
{'label': 'VARIADIC', 'value': 'VARIADIC'},
], editable: function(m) {
var node_info = this.get('node_info');
if(node_info && 'catalog' in node_info) {

View File

@@ -15,7 +15,7 @@ define('pgadmin.node.procedure', [
'pgadmin.node.schema.dir/schema_child_tree_node',
'pgadmin.browser.collection', 'pgadmin.browser.server.privilege',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify, Function,
schemaChild, schemaChildTreeNode) {
schemaChild, schemaChildTreeNode) {
if (!pgBrowser.Nodes['coll-procedure']) {
pgAdmin.Browser.Nodes['coll-procedure'] =
@@ -83,7 +83,7 @@ define('pgadmin.node.procedure', [
// Procedures supported only in PPAS and PG >= 11
return (
'server' in node_hierarchy && (
node_hierarchy['server'].server_type == 'ppas' ||
node_hierarchy['server'].server_type == 'ppas' ||
(node_hierarchy['server'].server_type == 'pg' &&
node_hierarchy['server'].version >= 110000)
)

View File

@@ -13,7 +13,7 @@ define('pgadmin.node.package', [
'pgadmin.node.schema.dir/child', 'pgadmin.node.schema.dir/schema_child_tree_node',
'pgadmin.browser.collection',
], function(gettext, url_for, $, _, pgAdmin, pgBrowser, Backform, schemaChild,
schemaChildTreeNode) {
schemaChildTreeNode) {
// Extend the browser's collection class for package collection
if (!pgBrowser.Nodes['coll-package']) {
@@ -67,7 +67,7 @@ define('pgadmin.node.package', [
},
canCreate: function(itemData, item, data) {
//If check is false then , we will allow create menu
//If check is false then , we will allow create menu
if (data && data.check == false)
return true;
@@ -77,11 +77,11 @@ define('pgadmin.node.package', [
if (server && server.server_type === 'pg')
return false;
// If it is catalog then don't allow user to create package
// If it is catalog then don't allow user to create package
if (treeData['catalog'] != undefined)
return false;
// by default we want to allow create menu
// by default we want to allow create menu
return true;
},
// Define the model for package node.

View File

@@ -14,7 +14,7 @@ define('pgadmin.node.sequence', [
'pgadmin.browser.collection',
], function(
gettext, url_for, $, _, S, pgAdmin, pgBrowser, Backform, schemaChild,
schemaChildTreeNode
schemaChildTreeNode
) {
// Extend the browser's collection class for sequence collection

View File

@@ -36,20 +36,20 @@ define('pgadmin.node.schema', [
data;
m.trigger('pgadmin-view:fetching', m, self.field);
// fetch default values for autovacuum fields
// fetch default values for autovacuum fields
$.ajax({
async: false,
url: full_url,
})
.done(function (res) {
data = res;
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
});
.done(function (res) {
data = res;
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
});
m.trigger('pgadmin-view:fetched', m, self.field);
// Add fetched models into collection
// Add fetched models into collection
if (data && _.isArray(data)) {
m.get(self.field.get('name')).reset(data, {silent: true});
}
@@ -60,7 +60,7 @@ define('pgadmin.node.schema', [
var self = this,
attributes = self.field.attributes;
// remove grid
// remove grid
if(self.grid) {
self.grid.remove();
delete self.grid;
@@ -74,17 +74,17 @@ define('pgadmin.node.schema', [
' <label class="control-label col-sm-4"><%-label%></label>',
'</div>'].join('\n')),
gridBody = $('<div class="pgadmin-control-group backgrid form-group col-12 object subnode"></div>').append(
gridHeader(attributes)
);
gridHeader(attributes)
);
// Initialize a new Grid instance
// Initialize a new Grid instance
var grid = self.grid = new Backgrid.Grid({
columns: self.grid_columns,
collection: self.model.get(self.field.get('name')),
className: 'backgrid table-bordered table-noouter-border table-hover',
});
// render grid
// render grid
self.$el.append($(gridBody).append(grid.render().$el));
return self;
@@ -127,7 +127,7 @@ define('pgadmin.node.schema', [
},
});
// Extend the browser's collection class for VacuumSettingsModel
// Extend the browser's collection class for VacuumSettingsModel
Backform.VacuumSettingsSchema = [{
id: 'spacer_ctrl', group: gettext('Table'), mode: ['edit', 'create'], type: 'spacer',
},{
@@ -373,7 +373,7 @@ define('pgadmin.node.schema', [
},{
id: 'nspacl', label: gettext('Privileges'),
model: pgBrowser.Node.PrivilegeRoleModel.extend(
{privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'],
{privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'],
editable: false, type: 'collection', group: gettext('Security'),
mode: ['edit', 'create'],
canAdd: true, canDelete: true, control: 'unique-col-collection',

View File

@@ -13,7 +13,7 @@ define('pgadmin.node.synonym', [
'pgadmin.node.schema.dir/child', 'pgadmin.node.schema.dir/schema_child_tree_node',
'pgadmin.browser.collection',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, alertify,
schemaChild, schemaChildTreeNode) {
schemaChild, schemaChildTreeNode) {
if (!pgBrowser.Nodes['coll-synonym']) {
pgAdmin.Browser.Nodes['coll-synonym'] =
@@ -110,13 +110,13 @@ define('pgadmin.node.synonym', [
select2: { width: '50%', allowClear: false },
options: function() {
return [
{label: gettext('Function'), value: 'f'},
{label: gettext('Package'), value: 'P'},
{label: gettext('Procedure'), value: 'p'},
{label: gettext('Public Synonym'), value: 's'},
{label: gettext('Sequence'), value: 'S'},
{label: gettext('Table'), value: 'r'},
{label: gettext('View'), value: 'v'},
{label: gettext('Function'), value: 'f'},
{label: gettext('Package'), value: 'P'},
{label: gettext('Procedure'), value: 'p'},
{label: gettext('Public Synonym'), value: 's'},
{label: gettext('Sequence'), value: 'S'},
{label: gettext('Table'), value: 'r'},
{label: gettext('View'), value: 'v'},
];
},
control: 'select2',
@@ -169,14 +169,14 @@ define('pgadmin.node.synonym', [
data: {'trgTyp' : trgTyp, 'trgSchema' : trgSchema},
})
// On success return function list from server
.done(function(result) {
res = result.data;
return res;
})
.done(function(result) {
res = result.data;
return res;
})
// On failure show error appropriate error message to user
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
});
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
});
return res;
},
},{
@@ -228,7 +228,7 @@ define('pgadmin.node.synonym', [
},
}),
canCreate: function(itemData, item, data) {
//If check is false then , we will allow create menu
//If check is false then , we will allow create menu
if (data && data.check == false)
return true;
@@ -238,11 +238,11 @@ define('pgadmin.node.synonym', [
if (server && server.server_type === 'pg')
return false;
// If it is catalog then don't allow user to create synonyms
// If it is catalog then don't allow user to create synonyms
if (treeData['catalog'] != undefined)
return false;
// by default we do not want to allow create menu
// by default we do not want to allow create menu
return true;
},
});

View File

@@ -28,7 +28,7 @@ define('pgadmin.node.column', [
});
}
// This Node model will be used for variable control for column
// This Node model will be used for variable control for column
var VariablesModel = Backform.VariablesModel = pgBrowser.Node.Model.extend({
idAttribute: 'name',
defaults: {
@@ -39,7 +39,7 @@ define('pgadmin.node.column', [
id: 'name', label: gettext('Name'), cell: 'select2',
type: 'text', disabled: false, node: 'column',
options: [['n_distinct', 'n_distinct'],
['n_distinct_inherited','n_distinct_inherited']],
['n_distinct_inherited','n_distinct_inherited']],
select2: {placeholder: 'Select variable'},
cellHeaderClasses:'width_percent_50',
},{
@@ -338,7 +338,7 @@ define('pgadmin.node.column', [
_.each(m.datatypes, function(o) {
if ( of_type == o.value ) {
if(o.length)
{
{
m.set('min_val', o.min_val, {silent: true});
m.set('max_val', o.max_val, {silent: true});
flag = false;
@@ -355,7 +355,7 @@ define('pgadmin.node.column', [
return flag;
},
editable: function(m) {
// inheritedfrom has value then we should disable it
// inheritedfrom has value then we should disable it
if(!_.isUndefined(m.get('inheritedfrom'))) {
return false;
}
@@ -409,7 +409,7 @@ define('pgadmin.node.column', [
return flag;
},
editable: function(m) {
// inheritedfrom has value then we should disable it
// inheritedfrom has value then we should disable it
if(!_.isUndefined(m.get('inheritedfrom'))) {
return false;
}
@@ -449,7 +449,7 @@ define('pgadmin.node.column', [
_.each(m.datatypes, function(o) {
if ( of_type == o.value ) {
if(o.is_collatable)
{
{
flag = false;
}
}
@@ -661,25 +661,25 @@ define('pgadmin.node.column', [
editable_check_for_table: function(arg) {
if (arg instanceof Backbone.Collection) {
return !arg.model.prototype.inSchemaWithColumnCheck.apply(
this, [arg.top]
);
this, [arg.top]
);
} else {
return !arg.inSchemaWithColumnCheck.apply(
this, [arg]
);
this, [arg]
);
}
},
}),
// Below function will enable right click menu for creating column
canCreate: function(itemData, item, data) {
// If check is false then , we will allow create menu
// 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 = [];
// To iterate over tree to check parent node
// To iterate over tree to check parent node
while (i) {
// If it is schema then allow user to create table
// If it is schema then allow user to create table
if (_.indexOf(['schema'], d._type) > -1) {
return true;
}
@@ -693,7 +693,7 @@ define('pgadmin.node.column', [
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 node is under catalog then do not allow 'create' menu
if (_.indexOf(parents, 'catalog') > -1 ||
_.indexOf(parents, 'coll-view') > -1 ||
_.indexOf(parents, 'coll-mview') > -1 ||

View File

@@ -71,21 +71,21 @@ define('pgadmin.node.check_constraint', [
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-check_constraint';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-check_constraint';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
return false;
},
@@ -127,10 +127,10 @@ define('pgadmin.node.check_constraint', [
id: 'consrc', label: gettext('Check'), type: 'multiline', cell:
'string', group: gettext('Definition'), mode: ['properties',
'create', 'edit'], disabled: function(m) {
return ((_.has(m, 'handler') &&
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
}, editable: false,
}, editable: false,
},{
id: 'connoinherit', label: gettext('No inherit?'), type:
'switch', cell: 'boolean', group: gettext('Definition'), mode:
@@ -204,21 +204,21 @@ define('pgadmin.node.check_constraint', [
}),
// Below function will enable right click menu for creating check constraint.
canCreate: function(itemData, item, data) {
// If check is false then , we will allow create menu
// 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 = [];
// To iterate over tree to check parent node
// To iterate over tree to check parent node
while (i) {
// If it is schema then allow user to c reate table
// If it is schema then allow user to c reate table
if (_.indexOf(['schema'], d._type) > -1)
return true;
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 node is under catalog then do not allow 'create' menu
if (_.indexOf(parents, 'catalog') > -1) {
return false;
} else {

View File

@@ -48,7 +48,7 @@ define('pgadmin.node.exclusion_constraint', [
!_.isUndefined(m.collection.handler) &&
!_.isUndefined(m.collection.handler.get('amname')) &&
m.collection.handler.get('amname') != 'btree') {
// Disable if access method is not btree
// Disable if access method is not btree
return false;
}
return true;
@@ -67,7 +67,7 @@ define('pgadmin.node.exclusion_constraint', [
if (url && (indextype == 'btree' || _.isUndefined(indextype) ||
_.isNull(indextype) || indextype == '')) {
// Set sort_order and nulls to true if access method is btree
// Set sort_order and nulls to true if access method is btree
setTimeout(function() {
m.set('order', true);
m.set('nulls_order', true);
@@ -77,10 +77,10 @@ define('pgadmin.node.exclusion_constraint', [
eventHandler = m.top || m,
node_info = this.column.get('node_info'),
full_url = node.generate_url.apply(
node, [
null, url, this.column.get('node_data'),
this.column.get('url_with_id') || false, node_info,
]),
node, [
null, url, this.column.get('node_data'),
this.column.get('url_with_id') || false, node_info,
]),
data = [];
indextype = 'btree';
@@ -92,13 +92,13 @@ define('pgadmin.node.exclusion_constraint', [
data : {indextype:indextype},
url: full_url,
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
});
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
});
eventHandler.trigger('pgadmin:view:fetched', m, self.column);
}
} else {
@@ -193,13 +193,13 @@ define('pgadmin.node.exclusion_constraint', [
data : {col_type:col_type},
url: full_url,
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
});
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
});
eventHandler.trigger('pgadmin:view:fetched', m, self.column);
}
}
@@ -333,13 +333,13 @@ define('pgadmin.node.exclusion_constraint', [
_.each(rows, function(r) {
if (filter(r)) {
var l = (_.isFunction(node['node_label']) ?
(node['node_label']).apply(node, [r, that.model, that]) :
(node['node_label']).apply(node, [r, that.model, that]) :
r.label),
image = (_.isFunction(node['node_image']) ?
(node['node_image']).apply(
node, [r, that.model, that]
) :
(node['node_image'] || ('icon-' + node.type)));
(node['node_image'] || ('icon-' + node.type)));
res.push({
'value': r.label,
'image': image,
@@ -374,9 +374,9 @@ define('pgadmin.node.exclusion_constraint', [
}))({});
var headerGroups = Backform.generateViewSchema(
self.field.get('node_info'), self.headerData, 'create',
node, self.field.get('node_data')
),
self.field.get('node_info'), self.headerData, 'create',
node, self.field.get('node_data')
),
fields = [];
_.each(headerGroups, function(o) {
@@ -981,8 +981,8 @@ define('pgadmin.node.exclusion_constraint', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -1024,16 +1024,16 @@ define('pgadmin.node.exclusion_constraint', [
}),
canCreate: function(itemData, item, data) {
// If check is false then , we will allow create menu
// 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
// To iterate over tree to check parent node
while (i) {
// If table is partitioned table then return false
// 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) {
@@ -1041,14 +1041,14 @@ define('pgadmin.node.exclusion_constraint', [
}
}
// If it is schema then allow user to create table
// If it is schema then allow user to create table
if (_.indexOf(['schema'], d._type) > -1)
return !is_immediate_parent_table_partitioned;
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 node is under catalog then do not allow 'create' menu
if (_.indexOf(parents, 'catalog') > -1) {
return false;
} else {

View File

@@ -27,8 +27,8 @@ define('pgadmin.node.foreign_key', [
return opt.text;
} else {
return $(
'<span><span class="wcTabIcon ' + optimage + '"/>' + opt.text + '</span>'
);
'<span><span class="wcTabIcon ' + optimage + '"/>' + opt.text + '</span>'
);
}
},
headerSelectControlTemplate = _.template([
@@ -224,15 +224,15 @@ define('pgadmin.node.foreign_key', [
data : {tid:tid},
url: full_url,
})
.done(function(res) {
data = res.data;
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
.done(function(res) {
data = res.data;
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
/*
/*
* Transform the data
*/
var transform = this.field.get('transform') || self.defaults.transform;
@@ -285,9 +285,9 @@ define('pgadmin.node.foreign_key', [
}))({});
var headerGroups = Backform.generateViewSchema(
self.field.get('node_info'), self.headerData, 'create',
node, self.field.get('node_data')
),
self.field.get('node_info'), self.headerData, 'create',
node, self.field.get('node_data')
),
fields = [];
_.each(headerGroups, function(o) {
@@ -486,7 +486,7 @@ define('pgadmin.node.foreign_key', [
}
var m = new (self.field.get('model'))(
self.headerData.toJSON()),
self.headerData.toJSON()),
coll = self.model.get(self.field.get('name'));
coll.add(m);
@@ -567,12 +567,12 @@ define('pgadmin.node.foreign_key', [
data : {cols:JSON.stringify(cols)},
url: full_url,
})
.done(function(res) {
coveringindex = res.data;
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
.done(function(res) {
coveringindex = res.data;
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
}
@@ -662,21 +662,21 @@ define('pgadmin.node.foreign_key', [
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-foreign_key';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-foreign_key';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
return false;
},
@@ -981,19 +981,19 @@ define('pgadmin.node.foreign_key', [
},
}),
canAdd: function(m) {
// We can't update columns of existing foreign key.
// We can't update columns of existing foreign key.
return m.isNew();
}, canDelete: true,
control: ForeignKeyColumnControl,
model: ForeignKeyColumnModel,
disabled: function(m) {
// If we are in table edit mode then
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
// 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 columns of existing foreign key.
// We can't update columns of existing foreign key.
return !m.isNew();
},
},{
@@ -1001,19 +1001,19 @@ define('pgadmin.node.foreign_key', [
type:'select2', group: gettext('Action'), mode: ['edit','create'],
select2:{width:'50%', allowClear: false},
options: [
{label: 'NO ACTION', value: 'a'},
{label: 'RESTRICT', value: 'r'},
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
{label: 'NO ACTION', value: 'a'},
{label: 'RESTRICT', value: 'r'},
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
],disabled: function(m) {
// If we are in table edit mode then
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
// 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 confupdtype of existing foreign key.
// We can't update confupdtype of existing foreign key.
return !m.isNew();
},
},{
@@ -1021,19 +1021,19 @@ define('pgadmin.node.foreign_key', [
type:'select2', group: gettext('Action'), mode: ['edit','create'],
select2:{width:'50%', allowClear: false},
options: [
{label: 'NO ACTION', value: 'a'},
{label: 'RESTRICT', value: 'r'},
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
{label: 'NO ACTION', value: 'a'},
{label: 'RESTRICT', value: 'r'},
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
],disabled: function(m) {
// If we are in table edit mode then
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
// 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 confdeltype of existing foreign key.
// We can't update confdeltype of existing foreign key.
return !m.isNew();
},
},
@@ -1064,7 +1064,7 @@ define('pgadmin.node.foreign_key', [
}),
canCreate: function(itemData, item, data) {
// If check is false then , we will allow create menu
// If check is false then , we will allow create menu
if (data && data.check == false)
return true;
@@ -1073,9 +1073,9 @@ define('pgadmin.node.foreign_key', [
is_immediate_parent_table_partitioned = false,
s_version = this.getTreeNodeHierarchy(i).server.version;
// To iterate over tree to check parent node
// To iterate over tree to check parent node
while (i) {
// If table is partitioned table then return false
// 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 && s_version < 110000) {
@@ -1083,14 +1083,14 @@ define('pgadmin.node.foreign_key', [
}
}
// If it is schema then allow user to c reate table
// If it is schema then allow user to c reate table
if (_.indexOf(['schema'], d._type) > -1)
return !is_immediate_parent_table_partitioned;
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 node is under catalog then do not allow 'create' menu
if (_.indexOf(parents, 'catalog') > -1) {
return false;
} else {

View File

@@ -314,7 +314,7 @@ define('pgadmin.node.primary_key', [
this.stopListening(this.model, 'change:' + name, this.render);
/*
/*
* Iterate through all the values, and find out how many are already
* present in the collection.
*/
@@ -329,7 +329,7 @@ define('pgadmin.node.primary_key', [
}
});
/*
/*
* Adding new values
*/
@@ -344,7 +344,7 @@ define('pgadmin.node.primary_key', [
collection.add(m);
});
/*
/*
* Removing unwanted!
*/
_.each(removed, function(v) {
@@ -391,8 +391,8 @@ define('pgadmin.node.primary_key', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -488,8 +488,8 @@ define('pgadmin.node.primary_key', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -580,8 +580,8 @@ define('pgadmin.node.primary_key', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -609,8 +609,8 @@ define('pgadmin.node.primary_key', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}

View File

@@ -300,7 +300,7 @@ define('pgadmin.node.unique_constraint', [
this.stopListening(this.model, 'change:' + name, this.render);
/*
/*
* Iterate through all the values, and find out how many are already
* present in the collection.
*/
@@ -315,7 +315,7 @@ define('pgadmin.node.unique_constraint', [
}
});
/*
/*
* Adding new values
*/
@@ -330,7 +330,7 @@ define('pgadmin.node.unique_constraint', [
collection.add(m);
});
/*
/*
* Removing unwanted!
*/
_.each(removed, function(v) {
@@ -377,8 +377,8 @@ define('pgadmin.node.unique_constraint', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -474,8 +474,8 @@ define('pgadmin.node.unique_constraint', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -566,8 +566,8 @@ define('pgadmin.node.unique_constraint', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
@@ -595,8 +595,8 @@ define('pgadmin.node.unique_constraint', [
// 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
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}

View File

@@ -205,8 +205,8 @@ define('pgadmin.node.index', [
_.isNull(parent_model.get('amname')) ||
String(parent_model.get('amname')).replace(/^\s+|\s+$/g, '') == '' ||
parent_model.get('amname') === 'btree') {
// We need to set nulls to true if sort_order is set to desc
// nulls first is default for desc
// We need to set nulls to true if sort_order is set to desc
// nulls first is default for desc
if(m.get('sort_order') == true && m.previous('sort_order') == false) {
setTimeout(function() { m.set('nulls', true); }, 10);
}

View File

@@ -108,12 +108,12 @@ function(
info || {} : this.getTreeNodeHierarchy(item);
return S('table/%s/%s/%s/%s/%s/%s').sprintf(
encodeURIComponent(type), encodeURIComponent(info['server_group']._id),
encodeURIComponent(info['server']._id),
encodeURIComponent(info['database']._id),
encodeURIComponent(info['partition'].schema_id),
encodeURIComponent(info['partition']._id)
).value();
encodeURIComponent(type), encodeURIComponent(info['server_group']._id),
encodeURIComponent(info['server']._id),
encodeURIComponent(info['database']._id),
encodeURIComponent(info['partition'].schema_id),
encodeURIComponent(info['partition']._id)
).value();
},
canDrop: SchemaChildTreeNode.isTreeItemOfChildOfSchema,
canDropCascade: SchemaChildTreeNode.isTreeItemOfChildOfSchema,
@@ -146,21 +146,21 @@ function(
data: params,
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
},
/* Truncate table */
truncate_table: function(args) {
@@ -194,25 +194,25 @@ function(
data: params,
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
}},
function() {}
);
@@ -237,25 +237,25 @@ function(
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
}
},
function() {}
@@ -280,26 +280,26 @@ function(
url: obj.generate_url(i, 'detach' , d, true),
type:'PUT',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
var n = t.next(i);
if (!n || !n.length) {
n = t.prev(i);
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
var n = t.next(i);
if (!n || !n.length) {
n = t.parent(i);
t.setInode(n, true);
n = t.prev(i);
if (!n || !n.length) {
n = t.parent(i);
t.setInode(n, true);
}
}
t.remove(i);
if (n.length) {
t.select(n);
}
}
t.remove(i);
if (n.length) {
t.select(n);
}
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
}
},
function() {}
@@ -343,8 +343,8 @@ function(
initialize: function(attrs, args) {
if (_.size(attrs) === 0) {
var userInfo = pgBrowser.serverInfo[
args.node_info.server._id
].user,
args.node_info.server._id
].user,
schemaInfo = args.node_info.schema;
this.set({
@@ -486,11 +486,11 @@ function(
if (primary_key_column_exist.length == 0) {
var primary_key_column = new (primary_key_column_coll.model)(
{column: column_name}, { silent: true,
top: self.model,
collection: primary_key_coll,
handler: primary_key_coll,
});
{column: column_name}, { silent: true,
top: self.model,
collection: primary_key_coll,
handler: primary_key_coll,
});
primary_key_column_coll.add(primary_key_column);
}
@@ -574,7 +574,7 @@ function(
return true;
},
canAddRow: function(m) {
// User can only add one primary key
// User can only add one primary key
var columns = m.get('columns');
return (m.get('primary_key') &&
@@ -602,7 +602,7 @@ function(
},
columns : ['name', 'columns'],
canAddRow: function(m) {
// User can only add if there is at least one column with name.
// User can only add if there is at least one column with name.
var columns = m.get('columns');
return _.some(columns.pluck('name'));
},
@@ -637,7 +637,7 @@ function(
return true;
},
canAddRow: function(m) {
// User can only add if there is at least one column with name.
// User can only add if there is at least one column with name.
var columns = m.get('columns');
return _.some(columns.pluck('name'));
},
@@ -662,7 +662,7 @@ function(
return true;
},
canAddRow: function(m) {
// User can only add if there is at least one column with name.
// User can only add if there is at least one column with name.
var columns = m.get('columns');
return _.some(columns.pluck('name'));
},
@@ -679,7 +679,7 @@ function(
return data;
},
control: Backform.NodeAjaxOptionsControl.extend({
// When of_types changes we need to clear columns collection
// When of_types changes we need to clear columns collection
onChange: function() {
Backform.NodeAjaxOptionsControl.prototype.onChange.apply(this, arguments);
var self = this,
@@ -693,7 +693,7 @@ function(
var msg = gettext('Changing of table type will clear columns collection.');
Alertify.confirm(msg, function (e) {
if (e) {
// User clicks Ok, lets clear columns collection
// User clicks Ok, lets clear columns collection
column_collection.reset();
} else {
return this;
@@ -703,11 +703,11 @@ function(
column_collection.reset();
}
// Run Ajax now to fetch columns
// Run Ajax now to fetch columns
if (!_.isUndefined(tbl_name) && tbl_name !== '') {
arg = { 'tname': tbl_name };
data = self.model.fetch_columns_ajax.apply(self, [arg]);
// Add into column collection
// Add into column collection
column_collection.set(data, { merge:false,remove:false });
}
},
@@ -878,27 +878,27 @@ function(
// Make ajax call to get the tables to be attached
$.ajax({
url: node.generate_url.apply(
node, [
null, 'get_attach_tables', this.field.get('node_data'),
true, node_info,
]),
node, [
null, 'get_attach_tables', this.field.get('node_data'),
true, node_info,
]),
type: 'GET',
async: false,
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error fetching tables to be attached'));
});
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error fetching tables to be attached'));
});
}
},
}
@@ -1143,11 +1143,11 @@ function(
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,
]
),
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');
@@ -1160,12 +1160,12 @@ function(
url: full_url,
data: arg,
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
data = (data && data.data) || [];
return data;

View File

@@ -97,12 +97,12 @@ define('pgadmin.node.table_partition_utils', [
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
// 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) {
Backgrid.Extension.Select2DepCell.prototype.initialize.apply(this, arguments);
// Do not listen for any event(s) for existing constraint.
// 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);
@@ -121,7 +121,7 @@ define('pgadmin.node.table_partition_utils', [
}, 50);
},
custom_options: function() {
// We will add all the columns entered by user in table model
// We will add all the columns entered by user in table model
var columns = this.model.top.get('columns'),
typename = this.model.top.get('typname'),
of_types_tables = this.model.top.of_types_tables,
@@ -132,26 +132,26 @@ define('pgadmin.node.table_partition_utils', [
var col = m.get('name');
if(!_.isUndefined(col) && !_.isNull(col)) {
added_columns_from_tables.push(
{label: col, value: col, image:'icon-column'}
);
{label: col, value: col, image:'icon-column'}
);
}
});
} else if (!_.isUndefined(typename) && !_.isNull(typename)
&& !_.isUndefined(of_types_tables) && of_types_tables.length > 0) {
// Iterate through all the of_type tables
// Iterate through all the of_type tables
_.each(of_types_tables, function(type) {
if (type.label == typename) {
// Iterate all the columns of selected "OF TYPE".
// Iterate all the columns of selected "OF TYPE".
_.each(type.oftype_columns, function(col) {
added_columns_from_tables.push(
{label: col.name, value: col.name, image:'icon-column'}
);
{label: col.name, value: col.name, image:'icon-column'}
);
});
}
});
}
// Set the values in to options so that user can select
// Set the values in to options so that user can select
this.column.set('options', added_columns_from_tables);
},
remove: function() {

View File

@@ -175,25 +175,25 @@ define('pgadmin.node.table', [
data: params,
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
}
}, function() {}
);
@@ -218,25 +218,25 @@ define('pgadmin.node.table', [
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
}
},
function() {}
@@ -256,20 +256,20 @@ define('pgadmin.node.table', [
url: obj.generate_url(i, 'count_rows' , d, true),
type:'GET',
})
.done(function(res) {
Alertify.success(res.info);
d.rows_cnt = res.data.total_rows;
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function(res) {
Alertify.success(res.info);
d.rows_cnt = res.data.total_rows;
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
},
model: pgBrowser.Node.Model.extend({
@@ -309,8 +309,8 @@ define('pgadmin.node.table', [
initialize: function(attrs, args) {
if (_.size(attrs) === 0) {
var userInfo = pgBrowser.serverInfo[
args.node_info.server._id
].user,
args.node_info.server._id
].user,
schemaInfo = args.node_info.schema;
this.set({
@@ -739,22 +739,22 @@ define('pgadmin.node.table', [
msg = gettext('Changing \'Of type\' will remove column definitions.');
Alertify.confirm(
title, msg, function () {
// User clicks Ok, lets clear columns collection
column_collection.remove(
column_collection.filter(function() { return true; })
);
},
function() {
setTimeout(function() {
self.model.set('typname', null);
}, 10);
}
);
title, msg, function () {
// User clicks Ok, lets clear columns collection
column_collection.remove(
column_collection.filter(function() { return true; })
);
},
function() {
setTimeout(function() {
self.model.set('typname', null);
}, 10);
}
);
} else if (!_.isUndefined(tbl_name) && tbl_name === '') {
column_collection.remove(
column_collection.filter(function() { return true; })
);
column_collection.filter(function() { return true; })
);
}
// Run Ajax now to fetch columns
@@ -903,7 +903,7 @@ define('pgadmin.node.table', [
if (m.get('partition_type') && m.get('partition_type') == 'list')
max_row_count = 1;
/* If columns are not specified by the user then it may be
/* If columns are not specified by the user then it may be
* possible that he/she selected 'OF TYPE', so we should check
* for that as well.
*/
@@ -1011,19 +1011,19 @@ define('pgadmin.node.table', [
type: 'GET',
async: false,
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
}
},
}
@@ -1291,12 +1291,12 @@ define('pgadmin.node.table', [
url: full_url,
data: arg,
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
data = (data && data.data) || [];
return data;

View File

@@ -111,25 +111,25 @@ define('pgadmin.node.trigger', [
data: {'enable' : true},
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
},
/* Disable trigger */
disable_trigger: function(args) {
@@ -149,25 +149,25 @@ define('pgadmin.node.trigger', [
data: {'enable' : false},
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger-bad';
t.addIcon(i, {icon: data.icon});
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger-bad';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error, gettext('Disable trigger failed'));
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error, gettext('Disable trigger failed'));
t.unload(i);
});
});
},
},
canDrop: SchemaChildTreeNode.isTreeItemOfChildOfSchema,
@@ -199,7 +199,7 @@ define('pgadmin.node.trigger', [
if (_.has(m, 'node_info') && _.has(m.node_info, 'table') &&
_.has(m.node_info.table, 'is_partitioned') &&
m.node_info.table.is_partitioned && m.node_info.server.version < 110000
)
)
{
setTimeout(function(){
m.set('is_row_trigger', false);
@@ -214,7 +214,7 @@ define('pgadmin.node.trigger', [
if(!m.inSchemaWithModelCheck.apply(this, [m])) {
if(!_.isUndefined(is_constraint_trigger) &&
is_constraint_trigger === true) {
// change it's model value
// change it's model value
setTimeout(function() { m.set('is_row_trigger', true); }, 10);
return true;
} else {
@@ -263,7 +263,7 @@ define('pgadmin.node.trigger', [
is_constraint_trigger === true) {
return false;
} else {
// If value is already set then reset it to false
// If value is already set then reset it to false
if(m.get('tgdeferrable')) {
setTimeout(function() { m.set('tgdeferrable', false); }, 10);
}
@@ -287,11 +287,11 @@ define('pgadmin.node.trigger', [
tgdeferrable) {
return false;
} else {
// If value is already set then reset it to false
// If value is already set then reset it to false
if(m.get('tginitdeferred')) {
setTimeout(function() { m.set('tginitdeferred', false); }, 10);
}
// If constraint trigger is set then do not disable
// If constraint trigger is set then do not disable
return m.get('is_constraint_trigger') ? false : true;
}
} else {
@@ -318,7 +318,7 @@ define('pgadmin.node.trigger', [
if(server_type === 'ppas' &&
!_.isUndefined(tfunction) &&
tfunction === 'Inline EDB-SPL') {
// Disable and clear its value
// Disable and clear its value
m.set('tgargs', undefined);
return true;
} else {
@@ -334,8 +334,8 @@ define('pgadmin.node.trigger', [
mode: ['create','edit', 'properties'], group: gettext('Events'),
options: function(control) {
var table_options = [
{label: 'BEFORE', value: 'BEFORE'},
{label: 'AFTER', value: 'AFTER'}],
{label: 'BEFORE', value: 'BEFORE'},
{label: 'AFTER', value: 'AFTER'}],
view_options = [
{label: 'BEFORE', value: 'BEFORE'},
{label: 'AFTER', value: 'AFTER'},

View File

@@ -435,12 +435,12 @@ define('pgadmin.node.type', [
cache: false,
data: {'typname' : l_typname},
})
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error', self.model, self.field);
});
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error', self.model, self.field);
});
//
}
return result;
@@ -503,13 +503,13 @@ define('pgadmin.node.type', [
cache: false,
data: {'name' : name},
})
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
});
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
});
}
return result;
},
@@ -528,24 +528,24 @@ define('pgadmin.node.type', [
!_.isUndefined(l_opcname) && l_opcname != '') {
var node = this.field.get('schema_node'),
_url = node.generate_url.apply(
node, [
null, 'get_stypediff',
this.field.get('node_data'), false,
this.field.get('node_info'),
]);
node, [
null, 'get_stypediff',
this.field.get('node_data'), false,
this.field.get('node_info'),
]);
$.ajax({
async: false,
url: _url,
cache: false,
data: {'typname' : l_typname, 'opcname': l_opcname},
})
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
});
});
}
return result;
},

View File

@@ -267,20 +267,20 @@ define('pgadmin.node.mview', [
data: {'concurrent': args.concurrent, 'with_data': args.with_data},
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(gettext('View refreshed successfully'));
}
else {
Alertify.alert(
gettext('Error refreshing view'),
.done(function(res) {
if (res.success == 1) {
Alertify.success(gettext('View refreshed successfully'));
}
else {
Alertify.alert(
gettext('Error refreshing view'),
res.data.result
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error refreshing view'));
});
);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error refreshing view'));
});
},
is_version_supported: function(data, item) {

View File

@@ -62,7 +62,7 @@ define('pgadmin.node.view', [
this.initialized = true;
/**
/**
Add "create view" menu option into context and object menu
for the following nodes:
coll-view, view and schema.

View File

@@ -197,33 +197,33 @@ define('pgadmin.node.database', [
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
})
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
data.icon = 'icon-database-not-connected';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
setTimeout(function() {
t.select(prv_i);
}, 10);
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
data.icon = 'icon-database-not-connected';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
setTimeout(function() {
t.select(prv_i);
}, 10);
} else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
} else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
t.unload(i);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
},
function() { return true; });

View File

@@ -186,11 +186,11 @@ define('pgadmin.node.pga_job', [
})
// 'pgagent.pga_job' table updated with current time to run the job
// now.
.done(function() { t.unload(i); })
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function() { t.unload(i); })
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
return false;
},

View File

@@ -209,11 +209,11 @@ define('pgadmin.node.role', [
return opt.text;
} else {
var d = _.extend(
{}, data, {
'opttext': _.escape(opt.text),
'optimage': optimage,
'checkbox': true,
}),
{}, data, {
'opttext': _.escape(opt.text),
'optimage': optimage,
'checkbox': true,
}),
j = $(self.selectionTemplate(d));
// Update the checkbox lazy
@@ -255,7 +255,7 @@ define('pgadmin.node.role', [
this.stopListening(this.model, 'change:' + name, this.render);
/*
/*
* Iterate through all the values, and find out how many are already
* present in the collection.
*/
@@ -270,14 +270,14 @@ define('pgadmin.node.role', [
}
});
/*
/*
* Adding new values
*/
_.each(vals, function(v) {
collection.add({role: v});
});
/*
/*
* Removing unwanted!
*/
_.each(removed, function(v) {

View File

@@ -133,8 +133,8 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
// it is not loaded yet
node_info = (_.has(model.top, 'node_info')
&& !_.isUndefined(model.top.node_info)) ?
model.top.node_info :
model.handler.top.node_info,
model.top.node_info :
model.handler.top.node_info,
curr_user = node_info.server.user.name;
model.collection.each(function(m) {
@@ -282,11 +282,11 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
this.attributes['privileges']) {
var anyPrivSelected = false;
this.attributes['privileges'].each(
function(p) {
if (p.get('privilege')) {
anyPrivSelected = true;
}
});
function(p) {
if (p.get('privilege')) {
anyPrivSelected = true;
}
});
if (!anyPrivSelected) {
msg = gettext('At least one privilege should be selected.');
@@ -473,7 +473,7 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
*/
$allPrivileges.prop('checked', false);
$elGrant.prop('checked', false),
$allGrants.prop('checked', false);
$allGrants.prop('checked', false);
$elGrant.prop('disabled', true);
$allGrants.prop('disabled', true);
}
@@ -546,8 +546,8 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
if (type == 'with_grant') {
$allGrants = $tbl.find(
'input[name=with_grant][privilege!=\'ALL\']:checked'
);
'input[name=with_grant][privilege!=\'ALL\']:checked'
);
if ($allGrants.length == collection.models.length) {
$allGrants.prop('disabled', false);
$allGrants.prop('checked', true);
@@ -616,7 +616,7 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
coll = this.model.get(this.column.get('name'));
if (command.moveUp() || command.moveDown() || command.save()) {
// backgrid vertical navigation (Up/Down arrow key)
// backgrid vertical navigation (Up/Down arrow key)
ev.preventDefault();
ev.stopPropagation();
model.trigger('backgrid:edited', model, column, command);
@@ -752,7 +752,7 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
e.stopPropagation();
model.trigger('backgrid:edited', model, column, command);
}
// esc
// esc
else if (command.cancel()) {
// undo
e.stopPropagation();

View File

@@ -223,38 +223,38 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
d = t.itemData(i);
t.removeIcon(i);
d.connected = false;
d.icon = 'icon-server-not-connected';
t.addIcon(i, {icon: d.icon});
obj.callbacks.refresh.apply(obj, [null, i]);
if (pgBrowser.serverInfo && d._id in pgBrowser.serverInfo) {
delete pgBrowser.serverInfo[d._id];
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
d = t.itemData(i);
t.removeIcon(i);
d.connected = false;
d.icon = 'icon-server-not-connected';
t.addIcon(i, {icon: d.icon});
obj.callbacks.refresh.apply(obj, [null, i]);
if (pgBrowser.serverInfo && d._id in pgBrowser.serverInfo) {
delete pgBrowser.serverInfo[d._id];
}
pgBrowser.enable_disable_menus(i);
// Trigger server disconnect event
pgBrowser.Events.trigger(
'pgadmin:server:disconnect',
{item: i, data: d}, false
);
}
pgBrowser.enable_disable_menus(i);
// Trigger server disconnect event
pgBrowser.Events.trigger(
'pgadmin:server:disconnect',
{item: i, data: d}, false
);
}
else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
t.unload(i);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
};
if (notify) {
@@ -318,18 +318,18 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'reload', d, true),
method:'GET',
})
.done(function(res) {
if (res.data.status) {
Alertify.success(res.data.result);
}
else {
Alertify.error(res.data.result);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function(res) {
if (res.data.status) {
Alertify.success(res.data.result);
}
else {
Alertify.error(res.data.result);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
function() { return true; }
);
@@ -359,13 +359,13 @@ define('pgadmin.node.server', [
method:'POST',
data:{ 'value': JSON.stringify(value) },
})
.done(function(res) {
Alertify.success(res.data.result, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
.done(function(res) {
Alertify.success(res.data.result, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
} else {
evt.cancel = true;
Alertify.error( gettext('Please enter a valid name.'), 10);
@@ -515,27 +515,27 @@ define('pgadmin.node.server', [
method:'POST',
data:{'data': JSON.stringify(args) },
})
.done(function(res) {
if (res.success) {
.done(function(res) {
if (res.success) {
// Notify user to update pgpass file
if(is_pgpass_file_used) {
Alertify.alert(
gettext('Change Password'),
gettext('Please make sure to disconnect the server'
if(is_pgpass_file_used) {
Alertify.alert(
gettext('Change Password'),
gettext('Please make sure to disconnect the server'
+ ' and update the new password in the pgpass file'
+ ' before performing any other operation')
);
}
);
}
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
}
},
};
@@ -547,15 +547,15 @@ define('pgadmin.node.server', [
url: check_pgpass_url,
method:'GET',
})
.done(function(res) {
if (res.success && res.data.is_pgpass) {
is_pgpass_file_used = true;
}
Alertify.changeServerPassword(d).resizeTo('40%','52%');
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
.done(function(res) {
if (res.success && res.data.is_pgpass) {
is_pgpass_file_used = true;
}
Alertify.changeServerPassword(d).resizeTo('40%','52%');
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
return false;
},
@@ -576,23 +576,23 @@ define('pgadmin.node.server', [
type:'DELETE',
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
},
/* Resume WAL Replay */
@@ -611,23 +611,23 @@ define('pgadmin.node.server', [
type:'PUT',
dataType: 'json',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
});
},
/* Cleat saved database server password */
@@ -651,18 +651,18 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'clear_saved_password', d, true),
method:'PUT',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).is_password_saved=res.data.is_password_saved;
}
else {
Alertify.error(res.info);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).is_password_saved=res.data.is_password_saved;
}
else {
Alertify.error(res.info);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
},
function() { return true; }
);
@@ -691,18 +691,18 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'clear_sshtunnel_password', d, true),
method:'PUT',
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).is_tunnel_password_saved=res.data.is_tunnel_password_saved;
}
else {
Alertify.error(res.info);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).is_tunnel_password_saved=res.data.is_tunnel_password_saved;
}
else {
Alertify.error(res.info);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
},
function() { return true; }
);
@@ -1241,16 +1241,16 @@ define('pgadmin.node.server', [
url: _url,
data: $('#frmPassword').serialize(),
})
.done(function(res) {
return _onSuccess(
res, _node, _data, _tree, _item, _status
);
})
.fail(function(xhr, status, error) {
return _onFailure(
xhr, status, error, _node, _data, _tree, _item, _status
);
});
.done(function(res) {
return _onSuccess(
res, _node, _data, _tree, _item, _status
);
})
.fail(function(xhr, status, error) {
return _onFailure(
xhr, status, error, _node, _data, _tree, _item, _status
);
});
} else {
_onCancel && typeof(_onCancel) == 'function' &&
_onCancel(_tree, _item, _data, _status);

View File

@@ -11,214 +11,214 @@ define([
'sources/gettext', 'underscore', 'jquery', 'backbone', 'backform', 'backgrid', 'alertify',
'sources/pgadmin', 'pgadmin.browser.node', 'pgadmin.browser.node.ui',
],
function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode) {
function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgAdmin, pgNode) {
/*
/*
* cellFunction for variable control.
* This function returns cell class depending on vartype.
*/
var cellFunction = function(model) {
var self = this,
name = model.get('name'),
availVariables = {};
var cellFunction = function(model) {
var self = this,
name = model.get('name'),
availVariables = {};
self.collection.each(function(col) {
if (col.get('name') == 'name') {
availVariables = col.get('availVariables');
}
});
self.collection.each(function(col) {
if (col.get('name') == 'name') {
availVariables = col.get('availVariables');
}
});
var variable = name ? availVariables[name]: undefined,
value = model.get('value');
var variable = name ? availVariables[name]: undefined,
value = model.get('value');
switch(variable && variable.vartype) {
case 'bool':
/*
switch(variable && variable.vartype) {
case 'bool':
/*
* bool cell and variable cannot be stateless (i.e undefined).
* It should be either true or false.
*/
model.set('value', !!model.get('value'), {silent: true});
model.set('value', !!model.get('value'), {silent: true});
return Backgrid.Extension.SwitchCell;
case 'enum':
model.set({'value': value}, {silent:true});
var options = [],
enumVals = variable.enumvals;
return Backgrid.Extension.SwitchCell;
case 'enum':
model.set({'value': value}, {silent:true});
var options = [],
enumVals = variable.enumvals;
_.each(enumVals, function(enumVal) {
options.push([enumVal, enumVal]);
});
_.each(enumVals, function(enumVal) {
options.push([enumVal, enumVal]);
});
return Backgrid.Extension.Select2Cell.extend({optionValues: options});
case 'integer':
if (!_.isNaN(parseInt(value))) {
model.set({'value': parseInt(value)}, {silent:true});
} else {
model.set({'value': undefined}, {silent:true});
}
return Backgrid.IntegerCell;
case 'real':
if (!_.isNaN(parseFloat(value))) {
model.set({'value': parseFloat(value)}, {silent:true});
} else {
model.set({'value': undefined}, {silent:true});
}
return Backgrid.NumberCell.extend({decimals: 0});
case 'string':
return Backgrid.StringCell;
default:
return Backgrid.Extension.Select2Cell.extend({optionValues: options});
case 'integer':
if (!_.isNaN(parseInt(value))) {
model.set({'value': parseInt(value)}, {silent:true});
} else {
model.set({'value': undefined}, {silent:true});
return Backgrid.Cell;
}
};
return Backgrid.IntegerCell;
case 'real':
if (!_.isNaN(parseFloat(value))) {
model.set({'value': parseFloat(value)}, {silent:true});
} else {
model.set({'value': undefined}, {silent:true});
}
return Backgrid.NumberCell.extend({decimals: 0});
case 'string':
return Backgrid.StringCell;
default:
model.set({'value': undefined}, {silent:true});
return Backgrid.Cell;
}
};
/*
/*
* This row will define behaviour or value column cell depending upon
* variable name.
*/
var VariableRow = Backgrid.Row.extend({
modelDuplicateClass: 'bg-model-duplicate',
var VariableRow = Backgrid.Row.extend({
modelDuplicateClass: 'bg-model-duplicate',
initialize: function () {
Backgrid.Row.prototype.initialize.apply(this, arguments);
var self = this;
self.model.on('change:name', function() {
setTimeout(function() {
self.columns.each(function(col) {
if (col.get('name') == 'value') {
initialize: function () {
Backgrid.Row.prototype.initialize.apply(this, arguments);
var self = this;
self.model.on('change:name', function() {
setTimeout(function() {
self.columns.each(function(col) {
if (col.get('name') == 'value') {
var idx = self.columns.indexOf(col),
cf = col.get('cellFunction'),
cell = new (cf.apply(col, [self.model]))({
column: col,
model: self.model,
}),
oldCell = self.cells[idx];
oldCell.remove();
self.cells[idx] = cell;
self.render();
}
var idx = self.columns.indexOf(col),
cf = col.get('cellFunction'),
cell = new (cf.apply(col, [self.model]))({
column: col,
model: self.model,
}),
oldCell = self.cells[idx];
oldCell.remove();
self.cells[idx] = cell;
self.render();
}
});
}, 10);
});
self.listenTo(self.model, 'pgadmin-session:model:duplicate', self.modelDuplicate);
self.listenTo(self.model, 'pgadmin-session:model:unique', self.modelUnique);
},
modelDuplicate: function() {
$(this.el).removeClass('new');
$(this.el).addClass(this.modelDuplicateClass);
},
modelUnique: function() {
$(this.el).removeClass(this.modelDuplicateClass);
},
});
}, 10);
});
self.listenTo(self.model, 'pgadmin-session:model:duplicate', self.modelDuplicate);
self.listenTo(self.model, 'pgadmin-session:model:unique', self.modelUnique);
},
modelDuplicate: function() {
$(this.el).removeClass('new');
$(this.el).addClass(this.modelDuplicateClass);
},
modelUnique: function() {
$(this.el).removeClass(this.modelDuplicateClass);
},
});
/**
});
/**
* VariableModel used to represent configuration parameters (variables tab)
* for database objects.
**/
var VariableModel = pgNode.VariableModel = pgNode.Model.extend({
keys: ['name'],
defaults: {
name: undefined,
value: undefined,
role: null,
database: null,
},
schema: [
{
id: 'name', label: gettext('Name'), type:'text', cellHeaderClasses: 'width_percent_30',
editable: function(m) {
return (m instanceof Backbone.Collection) ? true : m.isNew();
},
cell: Backgrid.Extension.NodeAjaxOptionsCell.extend({
initialize: function() {
Backgrid.Extension.NodeAjaxOptionsCell.prototype.initialize.apply(this, arguments);
var VariableModel = pgNode.VariableModel = pgNode.Model.extend({
keys: ['name'],
defaults: {
name: undefined,
value: undefined,
role: null,
database: null,
},
schema: [
{
id: 'name', label: gettext('Name'), type:'text', cellHeaderClasses: 'width_percent_30',
editable: function(m) {
return (m instanceof Backbone.Collection) ? true : m.isNew();
},
cell: Backgrid.Extension.NodeAjaxOptionsCell.extend({
initialize: function() {
Backgrid.Extension.NodeAjaxOptionsCell.prototype.initialize.apply(this, arguments);
// Immediately process options as we need them before render.
// Immediately process options as we need them before render.
var opVals = _.clone(this.optionValues ||
var opVals = _.clone(this.optionValues ||
(_.isFunction(this.column.get('options')) ?
(this.column.get('options'))(this) :
this.column.get('options')));
this.column.get('options')));
this.column.set('options', opVals);
},
}),
url: 'vopts',
select2: { allowClear: false },
transform: function(vars, cell) {
var res = [],
availVariables = {};
_.each(vars, function(v) {
res.push({
'value': v.name,
'image': undefined,
'label': v.name,
});
availVariables[v.name] = v;
});
cell.column.set('availVariables', availVariables);
return res;
this.column.set('options', opVals);
},
},
{
id: 'value', label: gettext('Value'), type: 'text', editable: true,
cellFunction: cellFunction, cellHeaderClasses: 'width_percent_40',
},
{id: 'database', label: gettext('Database'), type: 'text', editable: true,
node: 'database', cell: Backgrid.Extension.NodeListByNameCell,
},
{id: 'role', label: gettext('Role'), type: 'text', editable: true,
node: 'role', cell: Backgrid.Extension.NodeListByNameCell},
],
toJSON: function() {
var d = Backbone.Model.prototype.toJSON.apply(this);
}),
url: 'vopts',
select2: { allowClear: false },
transform: function(vars, cell) {
var res = [],
availVariables = {};
// Remove not defined values from model values.
// i.e.
// role, database
if (_.isUndefined(d.database) || _.isNull(d.database)) {
delete d.database;
}
_.each(vars, function(v) {
res.push({
'value': v.name,
'image': undefined,
'label': v.name,
});
availVariables[v.name] = v;
});
if (_.isUndefined(d.role) || _.isNull(d.role)) {
delete d.role;
}
return d;
cell.column.set('availVariables', availVariables);
return res;
},
},
validate: function() {
var msg = null;
if (_.isUndefined(this.get('name')) ||
{
id: 'value', label: gettext('Value'), type: 'text', editable: true,
cellFunction: cellFunction, cellHeaderClasses: 'width_percent_40',
},
{id: 'database', label: gettext('Database'), type: 'text', editable: true,
node: 'database', cell: Backgrid.Extension.NodeListByNameCell,
},
{id: 'role', label: gettext('Role'), type: 'text', editable: true,
node: 'role', cell: Backgrid.Extension.NodeListByNameCell},
],
toJSON: function() {
var d = Backbone.Model.prototype.toJSON.apply(this);
// Remove not defined values from model values.
// i.e.
// role, database
if (_.isUndefined(d.database) || _.isNull(d.database)) {
delete d.database;
}
if (_.isUndefined(d.role) || _.isNull(d.role)) {
delete d.role;
}
return d;
},
validate: function() {
var msg = null;
if (_.isUndefined(this.get('name')) ||
_.isNull(this.get('name')) ||
String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') {
msg = gettext('Please select a parameter name.');
this.errorModel.set('name', msg);
} else if (_.isUndefined(this.get('value')) ||
msg = gettext('Please select a parameter name.');
this.errorModel.set('name', msg);
} else if (_.isUndefined(this.get('value')) ||
_.isNull(this.get('value')) ||
String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') {
msg = ('Please enter a value for the parameter.');
this.errorModel.set('value', msg);
this.errorModel.unset('name');
} else {
this.errorModel.unset('name');
this.errorModel.unset('value');
}
msg = ('Please enter a value for the parameter.');
this.errorModel.set('value', msg);
this.errorModel.unset('name');
} else {
this.errorModel.unset('name');
this.errorModel.unset('value');
}
return msg;
},
});
return msg;
},
});
/**
/**
* Variable Tab Control to set/update configuration values for database object.
*
**/
Backform.VariableCollectionControl =
Backform.VariableCollectionControl =
Backform.UniqueColCollectionControl.extend({
hasDatabase: false,
@@ -228,7 +228,7 @@ define([
var self = this,
keys = ['name'];
/*
/*
* Read from field schema whether user wants to use database and role
* fields in Variable control.
*/
@@ -247,9 +247,9 @@ define([
opts.field.set({
model: pgNode.VariableModel.extend({keys:keys}),
},
{
silent: true,
});
{
silent: true,
});
} else {
opts.field.extend({
model: pgNode.VariableModel.extend({keys:keys}),
@@ -311,18 +311,18 @@ define([
async: false,
url: full_url,
})
.done(function (res) {
data = res.data;
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
});
.done(function (res) {
data = res.data;
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
});
m.trigger('pgadmin-view:fetched', m, self.field);
if (data && _.isArray(data)) {
self.collection.reset(data, {silent: true});
}
/*
/*
* Make sure - new data will be taken care by the session management
*/
if (isTracking) {
@@ -483,5 +483,5 @@ define([
},
});
return VariableModel;
});
return VariableModel;
});

View File

@@ -290,17 +290,17 @@ define('pgadmin.node.tablespace', [
method:'PUT',
data:{'data': JSON.stringify(args) },
})
.done(function(res) {
if (res.success) {
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
.done(function(res) {
if (res.success) {
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
},
function() {
// Do nothing as user cancel the operation