Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/pgadmin/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = (
Expand Down Expand Up @@ -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'])
Expand Down
5 changes: 1 addition & 4 deletions web/pgadmin/static/js/ToolErrorView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => ({
Expand Down Expand Up @@ -34,6 +33,4 @@ ToolErrorView.propTypes = {
error: PropTypes.string,
panelId: PropTypes.string,
panelDocker: PropTypes.object,
pgAdmin: PropTypes.object,
toolName: PropTypes.string,
};
3 changes: 2 additions & 1 deletion web/pgadmin/static/js/ToolView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 16 additions & 0 deletions web/regression/feature_utils/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 5 additions & 4 deletions web/regression/feature_utils/pgadmin_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,13 @@ def open_query_tool(self):
"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(
Expand Down
Loading