Fix Query tool issues:

1. Warning/Confirm dialogs should be inside the query tool.
2. The Help button in View/Edit data should open the corresponding help page.
3. Disable execute options when query tool in transaction.
4. Grid not loading more than 10000 rows. react-data-grid issue, PR sent. Use a fork till then.
5. NOTICE messages should not be part of Notifier success popups.

Fixes #7350
This commit is contained in:
Aditya Toshniwal
2022-05-09 12:39:29 +05:30
committed by Akshay Joshi
parent 5ebc9d7d2e
commit 1135821870
8 changed files with 34 additions and 28 deletions

View File

@@ -151,6 +151,7 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) {
'rollback': true,
'filter': true,
'limit': false,
'execute-options': !queryToolCtx.params.is_query_tool,
});
const {openMenuName, toggleMenu, onMenuClose} = usePgMenuGroup();
const [checkedMenuItems, setCheckedMenuItems] = React.useState({});
@@ -306,9 +307,11 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) {
if(isInTxn()) {
setDisableButton('commit', false);
setDisableButton('rollback', false);
setDisableButton('execute-options', true);
} else {
setDisableButton('commit', true);
setDisableButton('rollback', true);
setDisableButton('execute-options', !queryToolCtx.params.is_query_tool);
}
eventBus.registerListener(QUERY_TOOL_EVENTS.WARN_TXN_CLOSE, warnTxnClose);
return ()=>{
@@ -338,7 +341,7 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) {
});
};
const onHelpClick=()=>{
let url = url_for('help.static', {'filename': 'query_tool.html'});
let url = url_for('help.static', {'filename': queryToolCtx.params.is_query_tool ? 'query_tool.html' : 'editgrid.html'});
window.open(url, 'pgadmin_help');
};
const confirmDiscard=(callback)=>{
@@ -504,7 +507,7 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) {
onClick={executeQuery} disabled={buttonsDisabled['execute']} shortcut={queryToolPref.execute_query}/>
<PgIconButton title={gettext('Execute options')} icon={<KeyboardArrowDownIcon />} splitButton
name="menu-autocommit" ref={autoCommitMenuRef} accesskey={shortcut_key(queryToolPref.btn_delete_row)}
onClick={toggleMenu} disabled={!queryToolCtx.params.is_query_tool}/>
onClick={toggleMenu} disabled={buttonsDisabled['execute-options']}/>
</PgButtonGroup>
<PgButtonGroup size="small">
<PgIconButton title={gettext('Explain')} icon={<ExplicitRoundedIcon />}

View File

@@ -618,14 +618,17 @@ export class ResultSetUtils {
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), endTime);
this.setEndTime(endTime);
let msg = gettext('Query returned successfully in %s.', this.queryRunTime());
let retMsg, tabMsg;
retMsg = tabMsg = gettext('Query returned successfully in %s.', this.queryRunTime());
if(this.hasResultsToDisplay(httpMessage.data.data)) {
msg = gettext('Successfully run. Total query runtime: %s.', this.queryRunTime())
+ '\n' + gettext('%s rows affected.', httpMessage.data.data?.rows_affected);
let msg1 = gettext('Successfully run. Total query runtime: %s.', this.queryRunTime());
let msg2 = gettext('%s rows affected.', httpMessage.data.data?.rows_affected);
retMsg = msg1 + ' ' + msg2;
tabMsg = msg1 + '\n' + msg2;
if(!_.isNull(httpMessage.data.data.additional_messages)){
msg = httpMessage.data.data.additional_messages + '\n' + msg;
tabMsg = httpMessage.data.data.additional_messages + '\n' + tabMsg;
}
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, msg);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, tabMsg);
this.setClientPK(httpMessage.data.data.client_primary_key);
let {result} = httpMessage.data.data;
let data = {
@@ -646,12 +649,12 @@ export class ResultSetUtils {
}
} else {
if (httpMessage.data.data.result) {
msg = httpMessage.data.data.result + '\n\n' + msg;
tabMsg = httpMessage.data.data.result + '\n\n' + tabMsg;
}
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, msg, true);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, tabMsg, true);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.FOCUS_PANEL, PANELS.MESSAGES);
}
return msg;
return retMsg;
}
}