Display basic query info when execution completes in the query tool. Fixes #1507

pull/3/head
Dave Page 2016-07-27 11:36:13 +01:00
parent 06e881570a
commit f4f8273994
4 changed files with 32 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -50,8 +50,10 @@ Expand the **SQL Editor** node to specify your preferences for the SQL Editor to
.. image:: images/preferences_sql_display.png
Use the *Display* dialog to specify your preferences for the SQL Editor display. Specify a value in the *Items per page in grid* to instruct the *SQL Editor* on how many rows to display per page.
The default is *50*.
Use the *Display* dialog to specify your preferences for the SQL Editor display.
* Specify a value in the *Items per page in grid* field to instruct the *SQL Editor* on how many rows to display per page. The default is *50*.
* Use the *Query info notifier timeout* to control the behaviour of the notifier that is displayed when query execution completes. A value of *-1* will disable the notifier, and a value of 0 will display it until clicked. If a positive value above zero is specified, the notifier will be displayed for the specified number of seconds. The default is *5*.
.. image:: images/preferences_sql_explain_options.png

View File

@ -81,6 +81,17 @@ class SqlEditorModule(PgAdminModule):
'Value should be between 50 and 2000.')
)
self.info_notifier_timeout = self.preference.register(
'display', 'info_notifier_timeout',
gettext("Query info notifier timeout"), 'integer', 5,
category_label=gettext('Display'),
min_val=-1,
max_val=999999,
help_str=gettext('The length of time to display the query info notifier after execution has completed. '
'A value of -1 disables the notifier and a value of 0 displays it until clicked. '
'Values greater than 1 display the notifier for the number of seconds specified.')
)
self.explain_verbose = self.preference.register(
'Explain Options', 'explain_verbose',
gettext("Verbose"), 'boolean', False,
@ -222,7 +233,8 @@ def start_view_data(trans_id):
'filter_applied': filter_applied,
'limit': limit, 'can_edit': can_edit,
'can_filter': can_filter, 'sql': sql,
'items_per_page': blueprint.items_per_page.get()
'items_per_page': blueprint.items_per_page.get(),
'info_notifier_timeout': blueprint.info_notifier_timeout.get()
}
)
@ -324,7 +336,8 @@ def start_query_tool(trans_id):
data={
'status': status, 'result': result,
'can_edit': can_edit, 'can_filter': can_filter,
'items_per_page': blueprint.items_per_page.get()
'items_per_page': blueprint.items_per_page.get(),
'info_notifier_timeout': blueprint.info_notifier_timeout.get()
}
)

View File

@ -1179,7 +1179,8 @@ define(
self.can_edit = res.data.can_edit;
self.can_filter = res.data.can_filter;
self.items_per_page = res.data.items_per_page;
self.gridView.items_per_page = self.items_per_page
self.gridView.items_per_page = self.items_per_page;
self.info_notifier_timeout = res.data.info_notifier_timeout;
// Set the sql query to the SQL panel
self.gridView.query_tool_obj.setValue(res.data.sql);
@ -1423,8 +1424,15 @@ 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 message = 'Total query runtime: ' + self.total_time + '\n' + self.rows_affected + ' rows retrieved.';
$('.sql-editor-message').text(message);
var msg1 = S('{{ _('Total query runtime: %s.') }}').sprintf(self.total_time).value();
var msg2 = S('{{ _('%s rows retrieved.') }}').sprintf(self.rows_affected).value();
// Display the notifier if the timeout is set to >= 0
if (self.info_notifier_timeout >= 0) {
alertify.success(msg1 + '<br />' + msg2, self.info_notifier_timeout);
}
$('.sql-editor-message').text(msg1 + '\n' + msg2);
/* Add the data to the collection and render the grid.
* In case of Explain draw the graph on explain panel
@ -2510,7 +2518,8 @@ define(
self.can_edit = res.data.can_edit;
self.can_filter = res.data.can_filter;
self.items_per_page = res.data.items_per_page;
self.gridView.items_per_page = self.items_per_page
self.gridView.items_per_page = self.items_per_page;
self.info_notifier_timeout = res.data.info_notifier_timeout;
// If status is True then poll the result.
self._poll();