Fixed the following issues for the new query tool:

1) In Dark mode > Replace/Find dialogue forward & reverse buttons are stuck to each other.
 2) In Dark/High contrast mode > Checkbox is not visible for false value.
 3) Wrap toolbar when size goes very small.
 4) Replace functionality does not work when tried in sequence 2 times. Codemirror search is not cyclic. So, changes are made to always search from the start.
 5) Replace all does not work when tried in sequence 2 times. Same reason as above.
 6) Fix broken macros $SELECTION$ feature.
 7) Make query history SQL readonly.
 8) The Filter dialog save button should be disabled when opened.
This commit is contained in:
Aditya Toshniwal
2022-04-26 16:27:53 +05:30
committed by Akshay Joshi
parent 3d1a9624c1
commit 0795b22ae6
6 changed files with 37 additions and 18 deletions

View File

@@ -68,9 +68,13 @@ function setPanelTitle(panel, title, qtState, dirty=false) {
setQueryToolDockerTitle(panel, true, title, qtState.current_file ? true : false);
}
}
function onBeforeUnload(e) {
e.preventDefault();
e.returnValue = 'prevent';
}
export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedNodeInfo, panel, eventBusObj}) {
const containerRef = React.useRef(null);
const forceClose = React.useRef(false);
const [qtState, _setQtState] = useState({
preferences: {
browser: {}, sqleditor: {},
@@ -111,7 +115,8 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
const modal = useModal();
/* Connection status poller */
let pollTime = qtState.preferences.sqleditor.connection_status_fetch_time > 0 && !qtState.obtaining_conn ?
let pollTime = qtState.preferences.sqleditor.connection_status_fetch_time > 0
&& !qtState.obtaining_conn && qtState.preferences?.sqleditor?.connection_status ?
qtState.preferences.sqleditor.connection_status_fetch_time*1000 : -1;
/* No need to poll when the query is executing. Query poller will the txn status */
if(qtState.connection_status === CONNECTION_STATUS.TRANSACTION_STATUS_ACTIVE && qtState.connected) {
@@ -299,11 +304,8 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
/* WC docker events */
panel?.on(window.wcDocker.EVENT.CLOSING, function() {
if(!forceClose.current) {
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.WARN_SAVE_DATA_CLOSE);
} else {
panel.close();
}
window.removeEventListener('beforeunload', onBeforeUnload);
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.WARN_SAVE_DATA_CLOSE);
});
pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:select_file', (fileName)=>{
@@ -313,6 +315,8 @@ export default function QueryToolComponent({params, pgWindow, pgAdmin, selectedN
pgAdmin.Browser.Events.on('pgadmin-storage:finish_btn:create_file', (fileName)=>{
eventBus.current.fireEvent(QUERY_TOOL_EVENTS.SAVE_FILE, fileName);
}, pgAdmin);
window.addEventListener('beforeunload', onBeforeUnload);
}, []);
useEffect(()=>{