mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-10 08:04:36 -06:00
Fixed redundant tagged issue reported by SonarQube.
This commit is contained in:
parent
5ed1e1e5b6
commit
f0490a54b7
@ -248,7 +248,7 @@ define('pgadmin.node.extension', [
|
|||||||
if (_.isUndefined(name) || _.isNull(name) ||
|
if (_.isUndefined(name) || _.isNull(name) ||
|
||||||
String(name).replace(/^\s+|\s+$/g, '') == '') {
|
String(name).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['name'] = gettext('Name cannot be empty.');
|
err['name'] = gettext('Name cannot be empty.');
|
||||||
errmsg = errmsg || err['name'];
|
errmsg = err['name'];
|
||||||
this.errorModel.set('name', errmsg);
|
this.errorModel.set('name', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ define('pgadmin.node.check_constraint', [
|
|||||||
|
|
||||||
if (_.isUndefined(this.get('consrc')) || String(this.get('consrc')).replace(/^\s+|\s+$/g, '') == '') {
|
if (_.isUndefined(this.get('consrc')) || String(this.get('consrc')).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['consrc'] = gettext('Check cannot be empty.');
|
err['consrc'] = gettext('Check cannot be empty.');
|
||||||
errmsg = errmsg || err['consrc'];
|
errmsg = err['consrc'];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.errorModel.clear().set(err);
|
this.errorModel.clear().set(err);
|
||||||
|
@ -1057,16 +1057,14 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
|||||||
|
|
||||||
for key in required_create_keys:
|
for key in required_create_keys:
|
||||||
if key in diff_dict:
|
if key in diff_dict:
|
||||||
if key == 'columns' and ((
|
if (key == 'columns' and ((
|
||||||
'added' in diff_dict[key] and
|
'added' in diff_dict[key] and
|
||||||
len(diff_dict[key]['added']) > 0
|
len(diff_dict[key]['added']) > 0
|
||||||
) or ('changed' in diff_dict[key] and
|
) or ('changed' in diff_dict[key] and
|
||||||
len(diff_dict[key]['changed']) > 0) or (
|
len(diff_dict[key]['changed']) > 0) or (
|
||||||
'deleted' in diff_dict[key] and
|
'deleted' in diff_dict[key] and
|
||||||
len(diff_dict[key]['deleted']) > 0)
|
len(diff_dict[key]['deleted']) > 0)
|
||||||
):
|
)) or key != 'columns':
|
||||||
create_req = True
|
|
||||||
elif key != 'columns':
|
|
||||||
create_req = True
|
create_req = True
|
||||||
|
|
||||||
if create_req:
|
if create_req:
|
||||||
|
@ -211,7 +211,7 @@ define('pgadmin.node.rule', [
|
|||||||
String(field_name).replace(/^\s+|\s+$/g, '') === '')
|
String(field_name).replace(/^\s+|\s+$/g, '') === '')
|
||||||
{
|
{
|
||||||
err['name'] = gettext('Please specify name.');
|
err['name'] = gettext('Please specify name.');
|
||||||
errmsg = errmsg || err['name'];
|
errmsg = err['name'];
|
||||||
this.errorModel.set('name', errmsg);
|
this.errorModel.set('name', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ define('pgadmin.node.trigger', [
|
|||||||
},
|
},
|
||||||
// Disable/Enable Transition tables
|
// Disable/Enable Transition tables
|
||||||
disableTransition: function(m) {
|
disableTransition: function(m) {
|
||||||
var flag = true,
|
var flag = false,
|
||||||
evnt = null,
|
evnt = null,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
evnt_count = 0;
|
evnt_count = 0;
|
||||||
@ -630,8 +630,7 @@ define('pgadmin.node.trigger', [
|
|||||||
// Disable New transition table if both UPDATE and INSERT events are disabled
|
// Disable New transition table if both UPDATE and INSERT events are disabled
|
||||||
if(!m.get('is_constraint_trigger') && m.get('fires') == 'AFTER' &&
|
if(!m.get('is_constraint_trigger') && m.get('fires') == 'AFTER' &&
|
||||||
(m.get('evnt_update') || m.get(evnt)) && evnt_count == 1) {
|
(m.get('evnt_update') || m.get(evnt)) && evnt_count == 1) {
|
||||||
if (m.get('evnt_update') && (_.size(m.get('columns')) >= 1 && m.get('columns')[0] != '')) flag = true;
|
flag = (m.get('evnt_update') && (_.size(m.get('columns')) >= 1 && m.get('columns')[0] != ''));
|
||||||
else flag = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flag && setTimeout(function() {
|
flag && setTimeout(function() {
|
||||||
|
@ -258,7 +258,7 @@ define('pgadmin.node.mview', [
|
|||||||
if (_.isUndefined(field_name) || _.isNull(field_name) ||
|
if (_.isUndefined(field_name) || _.isNull(field_name) ||
|
||||||
String(field_name).replace(/^\s+|\s+$/g, '') == '') {
|
String(field_name).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['name'] = gettext('Please specify name.');
|
err['name'] = gettext('Please specify name.');
|
||||||
errmsg = errmsg || err['name'];
|
errmsg = err['name'];
|
||||||
this.errorModel.set('name', errmsg);
|
this.errorModel.set('name', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}else{
|
}else{
|
||||||
@ -267,7 +267,7 @@ define('pgadmin.node.mview', [
|
|||||||
if (_.isUndefined(field_def) || _.isNull(field_def) ||
|
if (_.isUndefined(field_def) || _.isNull(field_def) ||
|
||||||
String(field_def).replace(/^\s+|\s+$/g, '') == '') {
|
String(field_def).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['definition'] = gettext('Please enter view definition.');
|
err['definition'] = gettext('Please enter view definition.');
|
||||||
errmsg = errmsg || err['definition'];
|
errmsg = err['definition'];
|
||||||
this.errorModel.set('definition', errmsg);
|
this.errorModel.set('definition', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}else{
|
}else{
|
||||||
|
@ -223,7 +223,7 @@ define('pgadmin.node.view', [
|
|||||||
if (_.isUndefined(field_name) || _.isNull(field_name) ||
|
if (_.isUndefined(field_name) || _.isNull(field_name) ||
|
||||||
String(field_name).replace(/^\s+|\s+$/g, '') == '') {
|
String(field_name).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['name'] = gettext('Please specify name.');
|
err['name'] = gettext('Please specify name.');
|
||||||
errmsg = errmsg || err['name'];
|
errmsg = err['name'];
|
||||||
this.errorModel.set('name', errmsg);
|
this.errorModel.set('name', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}else{
|
}else{
|
||||||
@ -232,7 +232,7 @@ define('pgadmin.node.view', [
|
|||||||
if (_.isUndefined(field_def) || _.isNull(field_def) ||
|
if (_.isUndefined(field_def) || _.isNull(field_def) ||
|
||||||
String(field_def).replace(/^\s+|\s+$/g, '') == '') {
|
String(field_def).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['definition'] = gettext('Please enter view code.');
|
err['definition'] = gettext('Please enter view code.');
|
||||||
errmsg = errmsg || err['definition'];
|
errmsg = err['definition'];
|
||||||
this.errorModel.set('definition', errmsg);
|
this.errorModel.set('definition', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}else{
|
}else{
|
||||||
|
@ -120,7 +120,7 @@ define('pgadmin.node.pga_jobstep', [
|
|||||||
initialize: function() {
|
initialize: function() {
|
||||||
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
pgBrowser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||||
if (this.isNew() && this.get('jstconntype')) {
|
if (this.isNew() && this.get('jstconntype')) {
|
||||||
var args = arguments && arguments.length > 1 && arguments[1];
|
var args = arguments.length > 1 && arguments[1];
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
if (!_.isUndefined(args['node_info']) ||
|
if (!_.isUndefined(args['node_info']) ||
|
||||||
|
@ -325,7 +325,7 @@ define('pgadmin.node.role', [
|
|||||||
return r.label;
|
return r.label;
|
||||||
},
|
},
|
||||||
node_image: function(r) {
|
node_image: function(r) {
|
||||||
if (r == null || r == undefined)
|
if (!r)
|
||||||
return 'icon-role';
|
return 'icon-role';
|
||||||
return (r.can_login ? 'icon-role' : 'icon-group');
|
return (r.can_login ? 'icon-role' : 'icon-group');
|
||||||
},
|
},
|
||||||
@ -546,7 +546,7 @@ define('pgadmin.node.role', [
|
|||||||
|
|
||||||
if (_.isUndefined(this.get('rolname')) || String(this.get('rolname')).replace(/^\s+|\s+$/g, '') == '') {
|
if (_.isUndefined(this.get('rolname')) || String(this.get('rolname')).replace(/^\s+|\s+$/g, '') == '') {
|
||||||
err['name'] = gettext('Name cannot be empty.');
|
err['name'] = gettext('Name cannot be empty.');
|
||||||
errmsg = errmsg || err['name'];
|
errmsg = err['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seclabels) {
|
if (seclabels) {
|
||||||
|
@ -689,7 +689,7 @@ define('pgadmin.browser', [
|
|||||||
set_master_password: function(password='', button_click=false, set_callback=()=>{}) {
|
set_master_password: function(password='', button_click=false, set_callback=()=>{}) {
|
||||||
let data=null, self = this;
|
let data=null, self = this;
|
||||||
|
|
||||||
if(password != null || password!='') {
|
if(!password) {
|
||||||
data = JSON.stringify({
|
data = JSON.stringify({
|
||||||
'password': password,
|
'password': password,
|
||||||
'button_click': button_click,
|
'button_click': button_click,
|
||||||
|
@ -888,7 +888,7 @@ define('pgadmin.browser.node', [
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Go further only if node type is a Server
|
// Go further only if node type is a Server
|
||||||
if (data && data._type && data._type == 'server') {
|
if (data._type && data._type == 'server') {
|
||||||
var element = $(item).find('span.aciTreeItem').first() || null,
|
var element = $(item).find('span.aciTreeItem').first() || null,
|
||||||
// First element will be icon and second will be colour code
|
// First element will be icon and second will be colour code
|
||||||
bgcolor = data.icon.split(' ')[1] || null,
|
bgcolor = data.icon.split(' ')[1] || null,
|
||||||
@ -1655,7 +1655,6 @@ define('pgadmin.browser.node', [
|
|||||||
|
|
||||||
if (action) {
|
if (action) {
|
||||||
if (action == 'create') {
|
if (action == 'create') {
|
||||||
onCancelFunc = closePanel;
|
|
||||||
onSaveFunc = saveNewNode;
|
onSaveFunc = saveNewNode;
|
||||||
}
|
}
|
||||||
if (action != 'properties') {
|
if (action != 'properties') {
|
||||||
|
@ -368,17 +368,15 @@ define('misc.statistics', [
|
|||||||
* We will wait for some time before fetching the statistics for the
|
* We will wait for some time before fetching the statistics for the
|
||||||
* selected node.
|
* selected node.
|
||||||
**/
|
**/
|
||||||
if (node) {
|
if (self.timeout) {
|
||||||
if (self.timeout) {
|
clearTimeout(self.timeout);
|
||||||
clearTimeout(self.timeout);
|
|
||||||
}
|
|
||||||
self.timeout = setTimeout(
|
|
||||||
function() {
|
|
||||||
self.__updateCollection.call(
|
|
||||||
self, node.generate_url(item, 'stats', data, true), node, item, data._type
|
|
||||||
);
|
|
||||||
}, 400);
|
|
||||||
}
|
}
|
||||||
|
self.timeout = setTimeout(
|
||||||
|
function() {
|
||||||
|
self.__updateCollection.call(
|
||||||
|
self, node.generate_url(item, 'stats', data, true), node, item, data._type
|
||||||
|
);
|
||||||
|
}, 400);
|
||||||
},
|
},
|
||||||
|
|
||||||
__createMultiLineStatistics: function(data, prettifyFields) {
|
__createMultiLineStatistics: function(data, prettifyFields) {
|
||||||
|
@ -3308,7 +3308,7 @@ define([
|
|||||||
|
|
||||||
var fields = this.field.get('fields');
|
var fields = this.field.get('fields');
|
||||||
|
|
||||||
if (fields == null || fields == undefined) {
|
if (!fields) {
|
||||||
throw new ReferenceError('"fields" not found in keyboard shortcut');
|
throw new ReferenceError('"fields" not found in keyboard shortcut');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ function focusDockerPanel(docker, op) {
|
|||||||
|
|
||||||
// Mod is used to cycle the op
|
// Mod is used to cycle the op
|
||||||
if (op == 'switch') {
|
if (op == 'switch') {
|
||||||
let i = 0, total_frames = docker._frameList.length;
|
let i, total_frames = docker._frameList.length;
|
||||||
|
|
||||||
for(i = 0; i < total_frames; i++) {
|
for(i = 0; i < total_frames; i++) {
|
||||||
if(focus_frame === docker._frameList[i]) break;
|
if(focus_frame === docker._frameList[i]) break;
|
||||||
@ -141,10 +141,8 @@ function focusDockerPanel(docker, op) {
|
|||||||
flash = true;
|
flash = true;
|
||||||
} else if (op == 'left') {
|
} else if (op == 'left') {
|
||||||
focus_id = getMod(focus_frame._curTab-1, focus_frame._panelList.length);
|
focus_id = getMod(focus_frame._curTab-1, focus_frame._panelList.length);
|
||||||
flash = false;
|
|
||||||
} else if (op == 'right') {
|
} else if (op == 'right') {
|
||||||
focus_id = getMod(focus_frame._curTab+1, focus_frame._panelList.length);
|
focus_id = getMod(focus_frame._curTab+1, focus_frame._panelList.length);
|
||||||
flash = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let focus_panel = focus_frame._panelList[focus_id];
|
let focus_panel = focus_frame._panelList[focus_id];
|
||||||
|
@ -142,7 +142,7 @@ define([], function() {
|
|||||||
value = +value;
|
value = +value;
|
||||||
exp = +exp;
|
exp = +exp;
|
||||||
// If the value is not a number or the exp is not an integer...
|
// If the value is not a number or the exp is not an integer...
|
||||||
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
|
if (isNaN(value) || exp % 1 !== 0) {
|
||||||
return NaN;
|
return NaN;
|
||||||
}
|
}
|
||||||
// Shift
|
// Shift
|
||||||
|
@ -671,7 +671,7 @@ import gettext from 'sources/gettext';
|
|||||||
var value = item[args.column.field];
|
var value = item[args.column.field];
|
||||||
|
|
||||||
// Check if value is null or undefined
|
// Check if value is null or undefined
|
||||||
if (value === undefined && typeof value === 'undefined') {
|
if (value === null || typeof value === 'undefined') {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
defaultValue = value;
|
defaultValue = value;
|
||||||
|
@ -104,7 +104,7 @@ let queryToolNotifications = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Render the grid
|
// Render the grid
|
||||||
if (notifications_grid && notifications_panel)
|
if (notifications_panel)
|
||||||
notifications_panel.$container.find('.sql-editor-notifications').append(notifications_grid.render().el);
|
notifications_panel.$container.find('.sql-editor-notifications').append(notifications_grid.render().el);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ export function parseFuncParams(label) {
|
|||||||
paramName = '',
|
paramName = '',
|
||||||
paramModes = ['IN', 'OUT', 'INOUT', 'VARIADIC'];
|
paramModes = ['IN', 'OUT', 'INOUT', 'VARIADIC'];
|
||||||
|
|
||||||
paramStart = i = 0;
|
i = 0;
|
||||||
while(i < paramStr.length) {
|
while(i < paramStr.length) {
|
||||||
if(paramStr[i] == '"') {
|
if(paramStr[i] == '"') {
|
||||||
/* If quotes, skip all the chars till next quote */
|
/* If quotes, skip all the chars till next quote */
|
||||||
|
@ -1562,7 +1562,7 @@ define([
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (trans_id != undefined && debug_type) {
|
} else if (trans_id != undefined) {
|
||||||
// Make ajax call to execute the and start the target for execution
|
// Make ajax call to execute the and start the target for execution
|
||||||
baseUrl = url_for('debugger.start_listener', {
|
baseUrl = url_for('debugger.start_listener', {
|
||||||
'trans_id': trans_id,
|
'trans_id': trans_id,
|
||||||
|
@ -79,7 +79,7 @@ define([
|
|||||||
node = this.get('objects').toJSON();
|
node = this.get('objects').toJSON();
|
||||||
if (_.isEmpty(node)) {
|
if (_.isEmpty(node)) {
|
||||||
err['selected'] = gettext('Please select any database object.');
|
err['selected'] = gettext('Please select any database object.');
|
||||||
errmsg = errmsg || err['selected'];
|
errmsg = err['selected'];
|
||||||
this.errorModel.set('selected', errmsg);
|
this.errorModel.set('selected', errmsg);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +247,7 @@ define([
|
|||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var node = d && pgBrowser.Nodes[d._type],
|
var node = pgBrowser.Nodes[d._type],
|
||||||
treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
|
treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
|
||||||
|
|
||||||
if (treeInfo.database._label.indexOf('=') >= 0) {
|
if (treeInfo.database._label.indexOf('=') >= 0) {
|
||||||
|
@ -2316,7 +2316,7 @@ define('tools.querytool', [
|
|||||||
})
|
})
|
||||||
.done(function(res) {
|
.done(function(res) {
|
||||||
self.gridView.query_tool_obj.refresh();
|
self.gridView.query_tool_obj.refresh();
|
||||||
if (res && res !== '') {
|
if (res) {
|
||||||
self.gridView.query_tool_obj.setValue(res);
|
self.gridView.query_tool_obj.setValue(res);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user