Fixed some issues reported by SonarQube.

pull/41/head
Pradip Parkale 2021-03-19 11:56:12 +05:30 committed by Akshay Joshi
parent f5cc1d1c7e
commit 24dc7f4a91
4 changed files with 11 additions and 22 deletions

View File

@ -367,7 +367,6 @@ define('pgadmin.node.fts_configuration', [
self.$grid.find('.new').removeClass('new'); self.$grid.find('.new').removeClass('new');
var newRow = self.grid.body.rows[idx].$el; var newRow = self.grid.body.rows[idx].$el;
newRow.addClass('new'); newRow.addClass('new');
//$(newRow).pgMakeVisible('table-bordered');
$(newRow).pgMakeVisible('backform-tab'); $(newRow).pgMakeVisible('backform-tab');
} }

View File

@ -48,13 +48,7 @@ define('pgadmin.node.function', [
id: 'argtype', label: gettext('Data type'), cell: id: 'argtype', label: gettext('Data type'), cell:
'node-ajax-options', cellHeaderClasses: 'width_percent_30', 'node-ajax-options', cellHeaderClasses: 'width_percent_30',
control: 'node-ajax-options', type: 'text', url: 'get_types', control: 'node-ajax-options', type: 'text', url: 'get_types',
editable: function(m) { editable: 'isEditable', first_empty: true,
var node_info = this.get('node_info');
if(node_info && 'catalog' in node_info) {
return false;
}
return _.isUndefined(m.isNew) ? true : m.isNew();
}, first_empty: true,
},{ },{
id: 'argmode', label: gettext('Mode'), type: 'options', id: 'argmode', label: gettext('Mode'), type: 'options',
control: 'node-ajax-options', cellHeaderClasses:'width_percent_20', control: 'node-ajax-options', cellHeaderClasses:'width_percent_20',
@ -66,13 +60,7 @@ define('pgadmin.node.function', [
{'label': 'OUT', 'value': 'OUT'}, {'label': 'OUT', 'value': 'OUT'},
{'label': 'INOUT', 'value': 'INOUT'}, {'label': 'INOUT', 'value': 'INOUT'},
{'label': 'VARIADIC', 'value': 'VARIADIC'}, {'label': 'VARIADIC', 'value': 'VARIADIC'},
], editable: function(m) { ], editable: 'isEditable',
var node_info = this.get('node_info');
if(node_info && 'catalog' in node_info) {
return false;
}
return _.isUndefined(m.isNew) ? true : m.isNew();
},
},{ },{
id: 'argname', label: gettext('Argument name'), type: 'text', id: 'argname', label: gettext('Argument name'), type: 'text',
cell: 'string', editable: 'isInCatalog', cellHeaderClasses:'width_percent_30', cell: 'string', editable: 'isInCatalog', cellHeaderClasses:'width_percent_30',
@ -82,6 +70,13 @@ define('pgadmin.node.function', [
}, },
], ],
toJSON: Backbone.Model.prototype.toJSON, toJSON: Backbone.Model.prototype.toJSON,
isEditable: function(m) {
var node_info = this.get('node_info');
if(node_info && 'catalog' in node_info) {
return false;
}
return _.isUndefined(m.isNew) ? true : m.isNew();
},
isInCatalog: function(m){ isInCatalog: function(m){
var node_info = this.get('node_info'); var node_info = this.get('node_info');
if(node_info && 'catalog' in node_info) { if(node_info && 'catalog' in node_info) {

View File

@ -48,12 +48,7 @@ define('pgadmin.node.trigger_function', [
}, },
hasSQL: true, hasSQL: true,
showMenu: function(itemData, item) { showMenu: function(itemData, item) {
let node = pgBrowser.treeMenu.findNodeByDomElement(item); return this.canEdit(itemData, item);
if (!node || node.parentNode.getData()._type === 'trigger')
return false;
return true;
}, },
hasDepends: true, hasDepends: true,
hasStatistics: true, hasStatistics: true,

View File

@ -608,7 +608,7 @@ class Filemanager(object):
created = time.ctime(os.path.getctime(system_path)) created = time.ctime(os.path.getctime(system_path))
modified = time.ctime(os.path.getmtime(system_path)) modified = time.ctime(os.path.getmtime(system_path))
file_extension = str(splitext(system_path)) file_extension = str(splitext(system_path))
except Exception as e: except Exception:
continue continue
# set protected to 1 if no write or read permission # set protected to 1 if no write or read permission