From af6ff20020fce5dcc7dad15e0ec1e231ead6c1c5 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Fri, 7 Jan 2022 19:58:19 +0530 Subject: [PATCH] Fixed SonarQube issues. --- .../publications/static/js/publication.ui.js | 4 ++-- .../browser/static/js/utility_view.jsx | 19 ++++--------------- web/pgadmin/static/js/SchemaView/index.jsx | 2 +- web/pgadmin/static/js/tree/tree_nodes.ts | 1 - .../static/scss/_jsoneditor.overrides.scss | 2 -- web/pgadmin/static/scss/_pgadmin.style.scss | 3 +-- .../static/scss/_pgadmin4-tree.overrides.scss | 4 +--- 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js index ab8a8a656..501babcb1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/publications/static/js/publication.ui.js @@ -34,7 +34,7 @@ export class DefaultWithSchema extends BaseUISchema { id: 'evnt_truncate', label: gettext('TRUNCATE'), type: 'switch', group: gettext('With'), visible: function() { - if(!_.isUndefined(this.node_info['node_info']) && !_.isUndefined(this.node_info['node_info']) + if(!_.isUndefined(this.node_info['node_info']) && !_.isUndefined(this.node_info['node_info'].version) && this.node_info['node_info'].version >= 110000) return true; @@ -45,7 +45,7 @@ export class DefaultWithSchema extends BaseUISchema { id: 'publish_via_partition_root', label: gettext('Publish via root?'), type: 'switch', group: gettext('With'), visible: function() { - if(!_.isUndefined(this.node_info['node_info']) && !_.isUndefined(this.node_info['node_info']) + if(!_.isUndefined(this.node_info['node_info']) && !_.isUndefined(this.node_info['node_info'].version) && this.node_info['node_info'].version >= 130000) return true; diff --git a/web/pgadmin/browser/static/js/utility_view.jsx b/web/pgadmin/browser/static/js/utility_view.jsx index b9c92111d..70533a068 100644 --- a/web/pgadmin/browser/static/js/utility_view.jsx +++ b/web/pgadmin/browser/static/js/utility_view.jsx @@ -46,26 +46,16 @@ export function getUtilityView(schema, treeNodeInfo, actionType, formType, conta }); /* Callback for help button */ - const onHelp = (isSqlHelp=false, isNew=false)=>{ + const onHelp = (isSqlHelp=false)=>{ if(isSqlHelp) { let server = treeNodeInfo.server; - let url = pgAdmin.Browser.utils.pg_help_path; + let help_url = pgAdmin.Browser.utils.pg_help_path; let fullUrl = ''; if (server.server_type == 'ppas') { fullUrl = getEPASHelpUrl(server.version); } else { - if (sqlHelpUrl == '') { - fullUrl = getHelpUrl(url, sqlHelpUrl, server.version); - } else if (sqlHelpUrl != '') { - fullUrl = getHelpUrl(url, sqlHelpUrl, server.version); - } else { - if (isNew) { - fullUrl = getHelpUrl(url, sqlHelpUrl, server.version); - } else { - fullUrl = getHelpUrl(url, sqlHelpUrl, server.version); - } - } + fullUrl = getHelpUrl(help_url, sqlHelpUrl, server.version); } window.open(fullUrl, 'postgres_help'); @@ -97,8 +87,7 @@ export function getUtilityView(schema, treeNodeInfo, actionType, formType, conta onSave={onSaveClick} onClose={()=>containerPanel.close()} onHelp={onHelp} - onDataChange={()=>{ - }} + onDataChange={()=>{}} confirmOnCloseReset={confirmOnReset} hasSQL={false} disableSqlHelp={sqlHelpUrl == undefined || sqlHelpUrl == ''} diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx index fe9f6e29e..e86cccb6e 100644 --- a/web/pgadmin/static/js/SchemaView/index.jsx +++ b/web/pgadmin/static/js/SchemaView/index.jsx @@ -505,7 +505,7 @@ function SchemaDialogView({ if(!getInitData) { throw new Error('getInitData must be passed for edit'); } - getInitData && getInitData().then((data)=>{firstEleRef.current; + getInitData && getInitData().then((data)=>{ data = data || {}; /* Set the origData to incoming data, useful for comparing and reset */ schema.origData = prepareData(data || {}); diff --git a/web/pgadmin/static/js/tree/tree_nodes.ts b/web/pgadmin/static/js/tree/tree_nodes.ts index 16e937554..50e775ecf 100644 --- a/web/pgadmin/static/js/tree/tree_nodes.ts +++ b/web/pgadmin/static/js/tree/tree_nodes.ts @@ -132,7 +132,6 @@ export class ManageTreeNodes { } } throw new Error("Node Load Error..."); - return []; } let treeData = null; diff --git a/web/pgadmin/static/scss/_jsoneditor.overrides.scss b/web/pgadmin/static/scss/_jsoneditor.overrides.scss index 097aa6b9e..b572b5508 100644 --- a/web/pgadmin/static/scss/_jsoneditor.overrides.scss +++ b/web/pgadmin/static/scss/_jsoneditor.overrides.scss @@ -18,7 +18,6 @@ font-size: $navbar-font-size !important; line-height: $line-height-base !important; background-image:none !important; - font-weight: 600 !important; border-radius: $border-radius; border-color:$color-gray; opacity: 1; @@ -100,7 +99,6 @@ font-size: $font-size-base !important; line-height: $line-height-base !important; background-image:none !important; - font-weight: 600 !important; border-radius: $border-radius; border-color:$color-gray; opacity: 1; diff --git a/web/pgadmin/static/scss/_pgadmin.style.scss b/web/pgadmin/static/scss/_pgadmin.style.scss index 45c33f19f..e75fa7261 100644 --- a/web/pgadmin/static/scss/_pgadmin.style.scss +++ b/web/pgadmin/static/scss/_pgadmin.style.scss @@ -1107,7 +1107,6 @@ textarea { ::-webkit-scrollbar-thumb { border: 0.25rem solid transparent; border-radius: $border-radius*2; - background-color: rgba($scrollbar-base-color, 0.7); background: rgba($scrollbar-base-color, 0.7) !important; background-clip: content-box !important; } @@ -1115,7 +1114,7 @@ textarea { ::-webkit-scrollbar-thumb:hover { border: 0.25rem solid transparent; background-color: $scrollbar-base-color !important; - ackground-clip: content-box !important; + background-clip: content-box !important; } diff --git a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss index 0623f693c..d75ddca42 100644 --- a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss +++ b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss @@ -70,7 +70,7 @@ } i { display: inline-block; - font: normal normal normal 18px/1 "default-icons"; + font: normal 18px/1 "default-icons"; font-size: 18px; text-align: center; height: 21px !important; @@ -104,7 +104,6 @@ transform: none !important; } &.loading:before { - background-position: 6px center !important; font-weight: 900; font-size: 0.6rem; line-height: 2; @@ -136,7 +135,6 @@ font: inherit; flex-grow: 1; user-select: none; - cursor: default; color: $tree-text-fg !important; margin-left: 3px; cursor: pointer !important;