Fixed some sonarqube issues.

This commit is contained in:
Akshay Joshi
2020-06-17 19:30:56 +05:30
parent df05efd7d9
commit 5ed1e1e5b6
9 changed files with 11 additions and 18 deletions

View File

@@ -98,7 +98,7 @@ define('pgadmin.node.procedure', [
), ),
canVarAdd: function() { canVarAdd: function() {
var server = this.node_info.server; var server = this.node_info.server;
return !(server.version < 90500); return server.version >= 90500;
}, },
isVisible: function() { isVisible: function() {
if (this.name == 'sysfunc') { return false; } if (this.name == 'sysfunc') { return false; }

View File

@@ -210,7 +210,7 @@ define('pgadmin.node.check_constraint', [
d = i ? t.itemData(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
return !(_.indexOf(parents, 'catalog') > -1); return (_.indexOf(parents, 'catalog') <= -1);
}, },
}); });

View File

@@ -698,7 +698,7 @@ define('pgadmin.node.exclusion_constraint', [
select2:{allowClear:false}, select2:{allowClear:false},
filter: function(m) { filter: function(m) {
// Don't show pg_global tablespace in selection. // Don't show pg_global tablespace in selection.
return !(m.label == 'pg_global'); return (m.label !== 'pg_global');
}, },
},{ },{
id: 'amname', label: gettext('Access method'), id: 'amname', label: gettext('Access method'),

View File

@@ -390,7 +390,7 @@ define('pgadmin.node.mview', [
d = data || (i && i.length == 1 ? t.itemData(i): undefined), d = data || (i && i.length == 1 ? t.itemData(i): undefined),
node = this || (d && pgAdmin.Browser.Nodes[d._type]), node = this || (d && pgAdmin.Browser.Nodes[d._type]),
info = node && node.getTreeNodeHierarchy.apply(node, [i]), info = node && node.getTreeNodeHierarchy.apply(node, [i]),
version = info.server.version; version = _.isUndefined(info) ? 0 : info.server.version;
// disable refresh concurrently if server version is 9.3 // disable refresh concurrently if server version is 9.3
return (version >= 90400); return (version >= 90400);

View File

@@ -7,9 +7,6 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
//import * as commonUtils from '../../../static/js/utils';
//import Mousetrap from 'mousetrap';
define([ define([
'sources/gettext', 'jquery', 'underscore', 'sources/pgadmin', 'sources/gettext', 'jquery', 'underscore', 'sources/pgadmin',
'backbone', 'alertify', 'backform', 'backgrid', 'sources/browser/generate_url', 'backbone', 'alertify', 'backform', 'backgrid', 'sources/browser/generate_url',
@@ -357,7 +354,7 @@ define([
msg = undefined, msg = undefined,
title = undefined; title = undefined;
if (sel_node.type && sel_node.type == 'coll-constraints') { if (sel_node && sel_node.type && sel_node.type == 'coll-constraints') {
// In order to identify the constraint type, the type should be passed to the server // In order to identify the constraint type, the type should be passed to the server
sel_rows = sel_row_models.map(row => ({id: row.get('oid'), _type: row.get('_type')})); sel_rows = sel_row_models.map(row => ({id: row.get('oid'), _type: row.get('_type')}));
} }
@@ -372,6 +369,9 @@ define([
return; return;
} }
if (!sel_node)
return;
if (type === 'dropCascade') { if (type === 'dropCascade') {
url = sel_node.generate_url(sel_item, 'delete'); url = sel_node.generate_url(sel_item, 'delete');
msg = gettext('Are you sure you want to drop all the selected objects and all the objects that depend on them?'); msg = gettext('Are you sure you want to drop all the selected objects and all the objects that depend on them?');

View File

@@ -490,7 +490,7 @@ define('pgadmin.dashboard', [
}); });
} }
} else { } else {
Object.keys(new_data).map((label, label_ind) => { Object.keys(new_data).forEach((label, label_ind) => {
// Push new values onto the existing data structure // Push new values onto the existing data structure
// If this is a counter stat, we need to subtract the previous value // If this is a counter stat, we need to subtract the previous value
if (!counter) { if (!counter) {
@@ -508,8 +508,6 @@ define('pgadmin.dashboard', [
for (var time_ind = 0; time_ind < dataset[label_ind]['data'].length; time_ind++) { for (var time_ind = 0; time_ind < dataset[label_ind]['data'].length; time_ind++) {
dataset[label_ind]['data'][time_ind][0] = time_ind; dataset[label_ind]['data'][time_ind][0] = time_ind;
} }
return;
}); });
counter_prev_data = new_data; counter_prev_data = new_data;
} }

View File

@@ -110,11 +110,6 @@
border:1px solid $color-primary; border:1px solid $color-primary;
} }
.alt-fileinput {
display: inline;
wrap: no-wrap;
}
.file_listing #contents.grid li { .file_listing #contents.grid li {
display: block; display: block;
float: left; float: left;

View File

@@ -980,7 +980,7 @@ table.table-empty-rows{
padding-bottom: 1.0rem; padding-bottom: 1.0rem;
} }
& .panel-body { & .panel-body {
padding-botttom: 0.8rem; padding-bottom: 0.8rem;
} }
& .btn-change-pass { & .btn-change-pass {

View File

@@ -165,7 +165,7 @@
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none; -khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;
ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
cursor: default; cursor: default;
} }