Overhaul the query history tab to allow browsing of the history and full query text. Fixes #2282

Patch by Joao and the team at Pivotal.
This commit is contained in:
Joao Pedro De Almeida Pereira
2017-06-27 10:55:57 -04:00
committed by Dave Page
parent e413186d23
commit 7f55412059
63 changed files with 10645 additions and 8977 deletions

View File

@@ -973,14 +973,9 @@ define([
render_history_grid: function() {
var self = this;
// Remove any existing grid first
if (self.history_grid) {
self.history_grid.remove();
}
self.history_collection = new HistoryBundle.HistoryCollection([]);
self.history_collection = new HistoryBundle.historyCollection([]);
let queryHistoryElement = reactComponents.React.createElement(
var queryHistoryElement = reactComponents.React.createElement(
reactComponents.QueryHistory, {historyCollection: self.history_collection});
reactComponents.render(queryHistoryElement, $('#history_grid')[0]);
},
@@ -1771,6 +1766,7 @@ define([
},
error: function(e) {
// Enable/Disable query tool button only if is_query_tool is true.
self.resetQueryHistoryObject(self);
self.trigger('pgadmin-sqleditor:loading-icon:hide');
if (self.is_query_tool) {
self.disable_tool_buttons(false);
@@ -1856,7 +1852,6 @@ define([
// Show message in message and history tab in case of query tool
self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time);
self.update_msg_history(true, "", false);
var msg1 = S(gettext("Total query runtime: %s.")).sprintf(self.total_time).value();
var msg2 = S(gettext("%s rows affected.")).sprintf(self.rows_affected).value();
@@ -1867,6 +1862,7 @@ define([
var _msg = msg1 + '\n' + msg2;
self.update_msg_history(true, _msg, false);
// If there is additional messages from server then add it to message
if(!_.isNull(data.additional_messages) &&
!_.isUndefined(data.additional_messages)) {
@@ -2030,6 +2026,10 @@ define([
}
},
resetQueryHistoryObject: function (history) {
history.total_time = '-';
},
// This function is used to raise appropriate message.
update_msg_history: function(status, msg, clear_grid) {
var self = this;