Fixed SonarQube issues

This commit is contained in:
Akshay Joshi
2021-02-15 17:31:20 +05:30
parent 44cc7a308a
commit 3fc0cc3e92
10 changed files with 15 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>pgAdmin 4</title> <title>pgAdmin 4</title>
<style> <style>

View File

@@ -286,7 +286,7 @@ splashWindow.on('loaded', function() {
startDesktopMode(); startDesktopMode();
}) })
.catch((errCode) => { .catch((errCode) => {
if (fixedPortCheck && errCode == 'EADDRINUSE') { if (errCode == 'EADDRINUSE') {
alert('The specified fixed port is already in use. Please provide any other valid port.'); alert('The specified fixed port is already in use. Please provide any other valid port.');
} else { } else {
alert(errCode); alert(errCode);

View File

@@ -111,8 +111,7 @@ else:
# Flask default. # Flask default.
app.PGADMIN_RUNTIME = False app.PGADMIN_RUNTIME = False
app.logger.debug( app.logger.debug(
'Server mode: %s, config server mode: %s', 'Config server mode: %s', config.SERVER_MODE
SERVER_MODE, config.SERVER_MODE
) )
config.EFFECTIVE_SERVER_PORT = None config.EFFECTIVE_SERVER_PORT = None
if 'PGADMIN_INT_PORT' in os.environ: if 'PGADMIN_INT_PORT' in os.environ:

View File

@@ -129,7 +129,7 @@ class AuthSourceManager():
self.current_source = source self.current_source = source
@property @property
def get_current_source(self, source): def get_current_source(self):
return self.current_source return self.current_source
def set_source(self, source): def set_source(self, source):
@@ -174,13 +174,11 @@ class AuthSourceManager():
# OR When kerberos authentication failed while accessing pgadmin, # OR When kerberos authentication failed while accessing pgadmin,
# we need to break the loop as no need to authenticate further # we need to break the loop as no need to authenticate further
# even if the authentication sources set to multiple # even if the authentication sources set to multiple
if not status: if not status and (hasattr(msg, 'status') and
if (hasattr(msg, 'status') and msg.status == '401 UNAUTHORIZED') or \
msg.status == '401 UNAUTHORIZED') or\ (source.get_source_name() == KERBEROS and
(source.get_source_name() == request.method == 'GET'):
KERBEROS and break
request.method == 'GET'):
break
if status: if status:
self.set_source(source) self.set_source(source)

View File

@@ -290,9 +290,8 @@ class SchemaView(PGChildNodeView):
# Privileges # Privileges
for aclcol in acls: for aclcol in acls:
if specific is not None: if specific is not None and aclcol not in specific:
if aclcol not in specific: continue
continue
if aclcol in data: if aclcol in data:
allowedacl = acls[aclcol] allowedacl = acls[aclcol]
if modified: if modified:

View File

@@ -77,9 +77,8 @@
.menu-groups-a{ .menu-groups-a{
display:flex !important; display:flex !important;
flex-direction:column; flex-direction:column;
padding: 6px;
color: $dropdown-link-color;
padding: 6px 16px; padding: 6px 16px;
color: $dropdown-link-color;
} }
.menu-groups-a span{ .menu-groups-a span{

View File

@@ -561,7 +561,6 @@ def sql(trans_id, sgid, sid, did):
@login_required @login_required
def tables(trans_id, sgid, sid, did): def tables(trans_id, sgid, sid, did):
helper = ERDHelper(trans_id, sid, did) helper = ERDHelper(trans_id, sid, did)
conn = _get_connection(sid, did, trans_id)
status, tables = helper.get_all_tables() status, tables = helper.get_all_tables()
if not status: if not status:

View File

@@ -11,7 +11,6 @@ import React, { useEffect, useState } from 'react';
import Tippy from '@tippyjs/react'; import Tippy from '@tippyjs/react';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { TableNodeModel } from '../nodes/TableNode';
import CustomPropTypes from 'sources/custom_prop_types'; import CustomPropTypes from 'sources/custom_prop_types';
/* The note component of ERD. It uses tippy to create the floating note */ /* The note component of ERD. It uses tippy to create the floating note */

View File

@@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
/* This is used to change publicPath of webpack at runtime for loading chunks */ /* This is used to change publicPath of webpack at runtime for loading chunks */
/* eslint-disable */ /* eslint-disable */
__webpack_public_path__ = window.resourceBasePath; let __webpack_public_path__ = window.resourceBasePath;
/* eslint-enable */ /* eslint-enable */
import {launchDataGrid} from 'tools/datagrid/static/js/show_query_tool'; import {launchDataGrid} from 'tools/datagrid/static/js/show_query_tool';

View File

@@ -438,8 +438,9 @@ def change_owner():
data={} data={}
) )
except Exception as e: except Exception as e:
msg = 'Unable to update shared server owner' + _(str(e))
return internal_server_error( return internal_server_error(
errormsg='Unable to update shared server owner') errormsg=msg)
@blueprint.route( @blueprint.route(