Fix the SonarQube issues and issues reported during testing. #3319
parent
22fd919220
commit
67c18cb082
|
|
@ -279,7 +279,7 @@ def save_application_state():
|
|||
tool_data = fernet.encrypt(json.dumps(data['tool_data']).encode())
|
||||
connection_info = data['connection_info'] \
|
||||
if 'connection_info' in data else None
|
||||
if ('open_file_name' in connection_info and
|
||||
if (connection_info and 'open_file_name' in connection_info and
|
||||
connection_info['open_file_name']):
|
||||
file_path = get_complete_file_path(connection_info['open_file_name'])
|
||||
connection_info['last_saved_file_hash'] = (
|
||||
|
|
@ -342,7 +342,7 @@ def get_application_state():
|
|||
res = []
|
||||
for row in result:
|
||||
connection_info = row.connection_info
|
||||
if ('open_file_name' in connection_info and
|
||||
if (connection_info and 'open_file_name' in connection_info and
|
||||
connection_info['open_file_name']):
|
||||
file_path = get_complete_file_path(
|
||||
connection_info['open_file_name'])
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import React from 'react';
|
|||
import gettext from 'sources/gettext';
|
||||
import { LAYOUT_EVENTS } from './helpers/Layout';
|
||||
import { styled } from '@mui/material/styles';
|
||||
import { Box } from '@mui/material';
|
||||
import { FormHelperText } from '@mui/material';
|
||||
import { FormHelperText, Box } from '@mui/material';
|
||||
import HTMLReactParse from 'html-react-parser';
|
||||
|
||||
const StyledBox = styled(Box)(({theme}) => ({
|
||||
|
|
@ -34,6 +33,4 @@ ToolErrorView.propTypes = {
|
|||
error: PropTypes.string,
|
||||
panelId: PropTypes.string,
|
||||
panelDocker: PropTypes.object,
|
||||
pgAdmin: PropTypes.object,
|
||||
toolName: PropTypes.string,
|
||||
};
|
||||
|
|
@ -61,7 +61,8 @@ export default function ToolView({dockerObj}) {
|
|||
let handler = pgAdmin.Browser.getDockerHandler?.(panelId, dockerObj);
|
||||
const deregisterRemove = handler.docker.eventBus.registerListener(LAYOUT_EVENTS.REMOVE, (closePanelId)=>{
|
||||
deleteToolData(panelId, closePanelId);
|
||||
deregisterRemove();
|
||||
if(panelId == closePanelId){
|
||||
deregisterRemove();}
|
||||
});
|
||||
|
||||
handler.focus();
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ import { ResultGridComponent } from './ResultGridComponent';
|
|||
import { openSocket, socketApiGet } from '../../../../../static/js/socket_instance';
|
||||
import { parseApiError } from '../../../../../static/js/api_instance';
|
||||
import { usePgAdmin } from '../../../../../static/js/PgAdminProvider';
|
||||
import { useApplicationState } from '../../../../../settings/static/ApplicationStateProvider';
|
||||
import { getToolData } from '../../../../../settings/static/ApplicationStateProvider';
|
||||
import { useApplicationState, getToolData } from '../../../../../settings/static/ApplicationStateProvider';
|
||||
|
||||
function generateFinalScript(script_array, scriptHeader, script_body) {
|
||||
_.each(Object.keys(script_array).reverse(), function (s) {
|
||||
|
|
|
|||
|
|
@ -348,14 +348,12 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
|
|||
if(qtState.params.file_deleted == 'false' && qtState.params.is_editor_dirty == 'false'){
|
||||
// call load file from disk as no fil changes
|
||||
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE, qtState.params.open_file_name, qtState.params?.storage);
|
||||
}else{
|
||||
if(qtState.params.file_deleted != 'true'){
|
||||
if(qtState.params.external_file_changes == 'true'){
|
||||
loadSqlFromLocalStorage = false;
|
||||
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.WARN_RELOAD_FILE, qtState.params.open_file_name, sqlId);
|
||||
}else{
|
||||
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, qtState.params.open_file_name, true);
|
||||
}
|
||||
}else if(qtState.params.file_deleted != 'true'){
|
||||
if(qtState.params.external_file_changes == 'true'){
|
||||
loadSqlFromLocalStorage = false;
|
||||
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.WARN_RELOAD_FILE, qtState.params.open_file_name, sqlId);
|
||||
}else{
|
||||
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.LOAD_FILE_DONE, qtState.params.open_file_name, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,8 @@ import usePreferences from '../../../../../../preferences/static/js/store';
|
|||
import { getTitle } from '../../sqleditor_title';
|
||||
import PropTypes from 'prop-types';
|
||||
import { MODAL_DIALOGS } from '../QueryToolConstants';
|
||||
import { useApplicationState } from '../../../../../../settings/static/ApplicationStateProvider';
|
||||
import { useApplicationState, getToolData } from '../../../../../../settings/static/ApplicationStateProvider';
|
||||
import { useDelayDebounce } from '../../../../../../static/js/custom_hooks';
|
||||
import { getToolData } from '../../../../../../settings/static/ApplicationStateProvider';
|
||||
|
||||
|
||||
async function registerAutocomplete(editor, api, transId) {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,22 @@ class NavMenuLocators:
|
|||
|
||||
maintenance_obj_css = "li[data-label='Maintenance...']"
|
||||
|
||||
query_tool_menu_css = "li[data-label='Query Tool']"
|
||||
|
||||
show_system_objects_pref_label_xpath = \
|
||||
"//label[contains(text(), 'Show system objects?')]"
|
||||
|
||||
maximize_pref_dialogue_css = "button[data-label='Maximize']"
|
||||
|
||||
specified_pref_node_exp_status = \
|
||||
"//*[@id='treeContainer']//div//span[text()='{0}']"
|
||||
|
||||
specified_preference_tree_node = \
|
||||
"//*[@id='treeContainer']//div//span[text()='{0}']" \
|
||||
|
||||
specified_sub_node_of_pref_tree_node = \
|
||||
"//*[@id='treeContainer']//div//span[text()='{1}']"
|
||||
|
||||
insert_bracket_pair_switch_btn = \
|
||||
("//div[label[text()='Insert bracket pairs?']]/"
|
||||
"following-sibling::div//input")
|
||||
|
|
|
|||
|
|
@ -154,12 +154,13 @@ class PgadminPage:
|
|||
"button[data-label='Tools']"))
|
||||
WebDriverWait(self.driver, 3).until(
|
||||
EC.visibility_of_element_located(
|
||||
(By.CSS_SELECTOR, "li[data-label='Query Tool']")))
|
||||
ActionChains(self.driver).move_to_element(
|
||||
(By.CSS_SELECTOR, NavMenuLocators.query_tool_menu_css)))
|
||||
(ActionChains(self.driver).move_to_element(
|
||||
self.driver.find_element(
|
||||
By.CSS_SELECTOR, "li[data-label='Query Tool']")).perform()
|
||||
By.CSS_SELECTOR, NavMenuLocators.query_tool_menu_css))
|
||||
.perform())
|
||||
self.click_element(self.find_by_css_selector(
|
||||
"li[data-label='Query Tool']"))
|
||||
NavMenuLocators.query_tool_menu_css))
|
||||
|
||||
self.driver.switch_to.default_content()
|
||||
WebDriverWait(self.driver, 10).until(
|
||||
|
|
|
|||
Loading…
Reference in New Issue