mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-27 00:36:52 -06:00
Fixed SonarQube issues.
This commit is contained in:
parent
b69af1341b
commit
9c418188ee
@ -608,9 +608,6 @@ define('pgadmin.browser', [
|
||||
cancel_callback=()=>{/*This is intentional (SonarQube)*/}) {
|
||||
let data=null, self = this;
|
||||
|
||||
// data = JSON.stringify({
|
||||
// 'password': password,
|
||||
// });
|
||||
data = {
|
||||
'password': password,
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ export default function MasterPasswordContent({ closeModal, onResetPassowrd, onO
|
||||
}} >
|
||||
</PgIconButton>
|
||||
{isPWDPresent &&
|
||||
<DefaultButton data-test="reset-masterpassword" style={{ marginLeft: '0.5rem' }} startIcon={<DeleteForeverIcon />}
|
||||
<DefaultButton data-test="reset-masterpassword" style={{ marginLeft: '0.5rem' }} startIcon={<DeleteForeverIcon />}
|
||||
onClick={() => {onResetPassowrd?.();}} >
|
||||
{gettext('Reset Master Password')}
|
||||
</DefaultButton>
|
@ -17,8 +17,8 @@ import gettext from 'sources/gettext';
|
||||
|
||||
import getApiInstance from '../api_instance';
|
||||
import Notify from '../helpers/Notifier';
|
||||
import MasterPasswordContent from './MasterPassowrdContent';
|
||||
import ChangePasswordContent from './ChangePassowrdContent';
|
||||
import MasterPasswordContent from './MasterPasswordContent';
|
||||
import ChangePasswordContent from './ChangePasswordContent';
|
||||
import NamedRestoreContent from './NamedRestoreContent';
|
||||
import ChangeOwnershipContent from './ChangeOwnershipContent';
|
||||
|
||||
@ -169,7 +169,7 @@ export function checkMasterPassword(data, masterpass_callback_queue, cancel_call
|
||||
}
|
||||
|
||||
// This functions is used to show the master password dialog.
|
||||
export function showMasterPassword(isPWDPresent, errmsg=null, masterpass_callback_queue, cancel_callback) {
|
||||
export function showMasterPassword(isPWDPresent, errmsg, masterpass_callback_queue, cancel_callback) {
|
||||
const api = getApiInstance();
|
||||
let title = isPWDPresent ? gettext('Unlock Saved Passwords') : gettext('Set Master Password');
|
||||
|
||||
@ -346,4 +346,4 @@ export function showChangeOwnership() {
|
||||
},
|
||||
{ isFullScreen: false, isResizeable: true, showFullScreen: true, isFullWidth: true,
|
||||
dialogWidth: pgAdmin.Browser.stdW.md, dialogHeight: pgAdmin.Browser.stdH.md});
|
||||
}
|
||||
}
|
||||
|
@ -1069,15 +1069,10 @@ def start_debugger_listener(trans_id):
|
||||
debugger_args_values = copy.deepcopy(
|
||||
de_inst.function_data['args_value'])
|
||||
for arg in debugger_args_values:
|
||||
if arg['type'].endswith('[]'):
|
||||
if arg['value'] and arg['value'] != 'NULL':
|
||||
val_list = arg['value'][1:-1].split(',')
|
||||
debugger_args_data = []
|
||||
for _val in val_list:
|
||||
debugger_args_data.append({
|
||||
'value': _val
|
||||
})
|
||||
arg['value'] = debugger_args_data
|
||||
if arg['type'].endswith('[]') and arg['value'] and arg[
|
||||
'value'] != 'NULL':
|
||||
val_list = arg['value'][1:-1].split(',')
|
||||
arg['value'] = get_debugger_arg_val(val_list)
|
||||
|
||||
# Below are two different template to execute and start executer
|
||||
if manager.server_type != 'pg' and manager.version < 90300:
|
||||
@ -1175,6 +1170,16 @@ def start_debugger_listener(trans_id):
|
||||
return make_json_response(data={'status': status, 'result': result})
|
||||
|
||||
|
||||
def get_debugger_arg_val(val_list):
|
||||
"""Get debugger arguments is list"""
|
||||
debugger_args_data = []
|
||||
for _val in val_list:
|
||||
debugger_args_data.append({
|
||||
'value': _val
|
||||
})
|
||||
return debugger_args_data
|
||||
|
||||
|
||||
@blueprint.route(
|
||||
'/execute_query/<int:trans_id>/<query_type>', methods=['GET'],
|
||||
endpoint='execute_query'
|
||||
@ -1483,6 +1488,17 @@ def set_clear_breakpoint(trans_id, line_no, set_type):
|
||||
)
|
||||
|
||||
|
||||
def get_debugger_template_path(de_inst):
|
||||
# find the debugger version and execute the query accordingly
|
||||
dbg_version = de_inst.debugger_data['debugger_version']
|
||||
if dbg_version <= 2:
|
||||
template_path = DEBUGGER_SQL_V1_PATH
|
||||
else:
|
||||
template_path = DEBUGGER_SQL_V3_PATH
|
||||
|
||||
return template_path
|
||||
|
||||
|
||||
@blueprint.route(
|
||||
'/clear_all_breakpoint/<int:trans_id>', methods=['POST'],
|
||||
endpoint='clear_all_breakpoint'
|
||||
@ -1514,42 +1530,42 @@ def clear_all_breakpoint(trans_id):
|
||||
conn_id=de_inst.debugger_data['exe_conn_id'])
|
||||
|
||||
# find the debugger version and execute the query accordingly
|
||||
dbg_version = de_inst.debugger_data['debugger_version']
|
||||
if dbg_version <= 2:
|
||||
template_path = DEBUGGER_SQL_V1_PATH
|
||||
else:
|
||||
template_path = DEBUGGER_SQL_V3_PATH
|
||||
template_path = get_debugger_template_path(de_inst)
|
||||
|
||||
status = True
|
||||
result = ''
|
||||
if conn.connected():
|
||||
# get the data sent through post from client
|
||||
if 'breakpoint_list' in json.loads(request.data):
|
||||
line_numbers = []
|
||||
if json.loads(request.data)['breakpoint_list'] is not None and \
|
||||
json.loads(request.data)['breakpoint_list'] != '':
|
||||
line_numbers = json.loads(request.data)[
|
||||
'breakpoint_list'].split(",")
|
||||
|
||||
for line_no in line_numbers:
|
||||
sql = render_template(
|
||||
"/".join([template_path, "clear_breakpoint.sql"]),
|
||||
session_id=de_inst.debugger_data['session_id'],
|
||||
foid=de_inst.debugger_data['function_id'],
|
||||
line_number=line_no
|
||||
)
|
||||
|
||||
status, result = execute_dict_search_path(
|
||||
conn, sql, de_inst.debugger_data['search_path'])
|
||||
if not status:
|
||||
return internal_server_error(errormsg=result)
|
||||
result = result['rows']
|
||||
else:
|
||||
return make_json_response(data={'status': False})
|
||||
else:
|
||||
if not conn.connected():
|
||||
status = False
|
||||
result = SERVER_CONNECTION_CLOSED
|
||||
|
||||
return make_json_response(
|
||||
data={'status': status, 'result': result}
|
||||
)
|
||||
|
||||
if 'breakpoint_list' in json.loads(request.data):
|
||||
line_numbers = []
|
||||
if json.loads(request.data)['breakpoint_list'] is not None and \
|
||||
json.loads(request.data)['breakpoint_list'] != '':
|
||||
line_numbers = json.loads(request.data)[
|
||||
'breakpoint_list'].split(",")
|
||||
|
||||
for line_no in line_numbers:
|
||||
sql = render_template(
|
||||
"/".join([template_path, "clear_breakpoint.sql"]),
|
||||
session_id=de_inst.debugger_data['session_id'],
|
||||
foid=de_inst.debugger_data['function_id'],
|
||||
line_number=line_no
|
||||
)
|
||||
|
||||
status, result = execute_dict_search_path(
|
||||
conn, sql, de_inst.debugger_data['search_path'])
|
||||
if not status:
|
||||
return internal_server_error(errormsg=result)
|
||||
result = result['rows']
|
||||
else:
|
||||
return make_json_response(data={'status': False})
|
||||
|
||||
return make_json_response(
|
||||
data={'status': status, 'result': result}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user