1. Fixed an issue where copy and pasting a row in the results grid doesn't set the default for boolean. Fixes #7579

2. Fixed an issue where the History tab is getting blank and showing an error after some queries are executed. Fixes #7468
3. Fixed query tool view data crash.
This commit is contained in:
Aditya Toshniwal
2022-08-22 14:33:38 +05:30
committed by Akshay Joshi
parent 56e2c9db97
commit f2cc897f2f
4 changed files with 15 additions and 7 deletions

View File

@@ -322,7 +322,8 @@ def panel(trans_id):
params['layout'] = get_setting('SQLEditor/Layout')
params['macros'] = get_user_macros()
params['is_desktop_mode'] = current_app.PGADMIN_RUNTIME
params['database_name'] = underscore_escape(params['database_name'])
if 'database_name' in params:
params['database_name'] = underscore_escape(params['database_name'])
return render_template(
"sqleditor/index.html",

View File

@@ -351,7 +351,7 @@ function QueryHistoryDetails({entry}) {
</Box>
<Box marginTop="0.5rem">
<Box>{gettext('Messages')}</Box>
<Box className={classes.fontSourceCode} fontSize="13px" whiteSpace="pre-wrap">{entry.message}</Box>
<Box className={classes.fontSourceCode} fontSize="13px" whiteSpace="pre-wrap">{_.isObject(entry.message) ? JSON.stringify(entry.message) : entry.message}</Box>
</Box>
</Box>
</>

View File

@@ -303,6 +303,7 @@ export class ResultSetUtils {
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.PUSH_NOTICE, httpMessage.data.data.notifies);
}
if (ResultSetUtils.isQueryFinished(httpMessage)) {
this.setEndTime(new Date());
msg = this.queryFinished(httpMessage, onResultsAvailable, onExplain);
} else if (ResultSetUtils.isQueryStillRunning(httpMessage)) {
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessage.data.data.transaction_status);
@@ -311,13 +312,17 @@ export class ResultSetUtils {
}
return Promise.resolve(this.pollForResult(onResultsAvailable, onExplain, onPollError));
} else if (ResultSetUtils.isConnectionToServerLostWhilePolling(httpMessage)) {
this.setEndTime(new Date());
msg = httpMessage.data.data.result;
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, msg, true);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Connection Error'), this.endTime);
} else if (ResultSetUtils.isQueryCancelled(httpMessage)) {
msg = httpMessage.data.data.result || 'Execution Cancelled!';
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, httpMessage.data.data.result || 'Execution Cancelled!', true);
this.setEndTime(new Date());
msg = httpMessage.data.data.result || gettext('Execution Cancelled!');
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, httpMessage.data.data.result || gettext('Execution Cancelled!'), true);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Execution Cancelled'), this.endTime);
}
if(this.qtPref?.query_success_notification) {
Notifier.success(msg);
@@ -567,6 +572,8 @@ export class ResultSetUtils {
columnVal = true;
} else if(columnVal == 'false') {
columnVal = false;
} else if(col.has_default_val) {
columnVal = undefined;
} else {
columnVal = null;
}
@@ -619,11 +626,9 @@ export class ResultSetUtils {
}
queryFinished(httpMessage, onResultsAvailable, onExplain) {
let endTime = new Date();
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END, true);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessage.data.data.transaction_status);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), endTime);
this.setEndTime(endTime);
this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), this.endTime);
let retMsg, tabMsg;
retMsg = tabMsg = gettext('Query returned successfully in %s.', this.queryRunTime());