mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-10-12 16:11:59 -05:00
Display basic query info when execution completes in the query tool. Fixes #1507
This commit is contained in:
1 parent
06e881570a
commit
f4f8273994
4 files changed
+32
-8
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 77 KiB |
@@ -50,8 +50,10 @@ Expand the **SQL Editor** node to specify your preferences for the SQL Editor to
|
|||||||
|
|
||||||
.. image:: images/preferences_sql_display.png
|
.. 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.
|
Use the *Display* dialog to specify your preferences for the SQL Editor display.
|
||||||
The default is *50*.
|
|
||||||
|
* 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
|
.. image:: images/preferences_sql_explain_options.png
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,17 @@ class SqlEditorModule(PgAdminModule):
|
|||||||
'Value should be between 50 and 2000.')
|
'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(
|
self.explain_verbose = self.preference.register(
|
||||||
'Explain Options', 'explain_verbose',
|
'Explain Options', 'explain_verbose',
|
||||||
gettext("Verbose"), 'boolean', False,
|
gettext("Verbose"), 'boolean', False,
|
||||||
@@ -222,7 +233,8 @@ def start_view_data(trans_id):
|
|||||||
'filter_applied': filter_applied,
|
'filter_applied': filter_applied,
|
||||||
'limit': limit, 'can_edit': can_edit,
|
'limit': limit, 'can_edit': can_edit,
|
||||||
'can_filter': can_filter, 'sql': sql,
|
'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={
|
data={
|
||||||
'status': status, 'result': result,
|
'status': status, 'result': result,
|
||||||
'can_edit': can_edit, 'can_filter': can_filter,
|
'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()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1179,7 +1179,8 @@ define(
|
|||||||
self.can_edit = res.data.can_edit;
|
self.can_edit = res.data.can_edit;
|
||||||
self.can_filter = res.data.can_filter;
|
self.can_filter = res.data.can_filter;
|
||||||
self.items_per_page = res.data.items_per_page;
|
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
|
// Set the sql query to the SQL panel
|
||||||
self.gridView.query_tool_obj.setValue(res.data.sql);
|
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
|
// 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.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time);
|
||||||
self.update_msg_history(true, "", false);
|
self.update_msg_history(true, "", false);
|
||||||
var message = 'Total query runtime: ' + self.total_time + '\n' + self.rows_affected + ' rows retrieved.';
|
var msg1 = S('{{ _('Total query runtime: %s.') }}').sprintf(self.total_time).value();
|
||||||
$('.sql-editor-message').text(message);
|
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.
|
/* Add the data to the collection and render the grid.
|
||||||
* In case of Explain draw the graph on explain panel
|
* In case of Explain draw the graph on explain panel
|
||||||
@@ -2510,7 +2518,8 @@ define(
|
|||||||
self.can_edit = res.data.can_edit;
|
self.can_edit = res.data.can_edit;
|
||||||
self.can_filter = res.data.can_filter;
|
self.can_filter = res.data.can_filter;
|
||||||
self.items_per_page = res.data.items_per_page;
|
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.
|
// If status is True then poll the result.
|
||||||
self._poll();
|
self._poll();
|
||||||
|
|||||||
Reference in new issue
Block a user