From d801ed5008c48c13841f7965ba7582ff6191f9bc Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Thu, 29 Nov 2018 15:47:48 +0000 Subject: [PATCH] Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them. Fixes #3619 --- docs/en_US/release_notes_3_7.rst | 1 + web/pgadmin/tools/debugger/__init__.py | 21 +++++++++++++++++++ .../tools/debugger/static/js/direct.js | 5 +++-- .../debugger/templates/debugger/direct.html | 2 +- .../tools/sqleditor/static/js/sqleditor.js | 4 ++-- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/en_US/release_notes_3_7.rst b/docs/en_US/release_notes_3_7.rst index 7fdfaa269..b581a0765 100644 --- a/docs/en_US/release_notes_3_7.rst +++ b/docs/en_US/release_notes_3_7.rst @@ -15,3 +15,4 @@ Bug fixes ********* | `Bug #3354 `_ - Fix handling of array types as inputs to the debugger. +| `Bug #3619 `_ - Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them. \ No newline at end of file diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py index 1fbf145f3..d8e8ca2fc 100644 --- a/web/pgadmin/tools/debugger/__init__.py +++ b/web/pgadmin/tools/debugger/__init__.py @@ -552,6 +552,26 @@ def direct_new(trans_id): # We need client OS information to render correct Keyboard shortcuts user_agent = UserAgent(request.headers.get('User-Agent')) + function_arguments = '(' + if 'functionData' in session: + session_function_data = session['functionData'][str(trans_id)] + if 'args_name' in session_function_data and \ + session_function_data['args_name'] is not None and \ + session_function_data['args_name'] != '': + args_name_list = session_function_data['args_name'].split(",") + args_type_list = session_function_data['args_type'].split(",") + index = 0 + for args_name in args_name_list: + function_arguments = '{}{} {}, '.format(function_arguments, + args_name, + args_type_list[index]) + index += 1 + # Remove extra comma and space from the arguments list + if len(args_name_list) > 0: + function_arguments = function_arguments[:-2] + + function_arguments += ')' + return render_template( "debugger/direct.html", _=gettext, @@ -561,6 +581,7 @@ def direct_new(trans_id): is_desktop_mode=current_app.PGADMIN_RUNTIME, is_linux=is_linux_platform, client_platform=user_agent.platform, + function_name_with_arguments=obj['function_name'] + function_arguments ) diff --git a/web/pgadmin/tools/debugger/static/js/direct.js b/web/pgadmin/tools/debugger/static/js/direct.js index 61bb7964d..bef0744bb 100644 --- a/web/pgadmin/tools/debugger/static/js/direct.js +++ b/web/pgadmin/tools/debugger/static/js/direct.js @@ -1521,7 +1521,7 @@ define([ _.extend(DirectDebug.prototype, { /* We should get the transaction id from the server during initialization here */ - init: function(trans_id, debug_type) { + init: function(trans_id, debug_type, function_name_with_arguments) { // We do not want to initialize the module multiple times. var self = this; _.bindAll(pgTools.DirectDebug, 'messages'); @@ -1540,6 +1540,7 @@ define([ this.debug_restarted = false; this.is_user_aborted_debugging = false; this.is_polling_required = true; // Flag to stop unwanted ajax calls + this.function_name_with_arguments = function_name_with_arguments; let browser = window.opener ? window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser; @@ -1699,7 +1700,7 @@ define([ intializePanels: function() { var self = this; this.registerPanel( - 'code', false, '100%', '50%', + 'code', self.function_name_with_arguments, '100%', '50%', function() { // Create the parameters panel to display the arguments of the functions diff --git a/web/pgadmin/tools/debugger/templates/debugger/direct.html b/web/pgadmin/tools/debugger/templates/debugger/direct.html index efbff876a..9d09190f0 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/direct.html +++ b/web/pgadmin/tools/debugger/templates/debugger/direct.html @@ -9,7 +9,7 @@ try { var pgDirectDebug = pgDirectDebug || pgAdmin.Tools.DirectDebug; var $ = pgDirectDebug.jquery; - pgDirectDebug.init({{ uniqueId }}, {{ debug_type }}); + pgDirectDebug.init({{ uniqueId }}, {{ debug_type }}, '{{ function_name_with_arguments }}'); window.onbeforeunload = function(ev) { $.ajax({ url: "{{ url_for('debugger.index') }}close/{{ uniqueId }}", diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index a37ff32da..941dda109 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -173,7 +173,7 @@ define('tools.querytool', [ var sql_panel = new pgAdmin.Browser.Panel({ name: 'sql_panel', - title: false, + title: gettext('Query Editor'), width: '100%', height: '20%', isCloseable: false, @@ -292,7 +292,7 @@ define('tools.querytool', [ self.explain_panel = main_docker.addPanel('explain', wcDocker.DOCK.STACKED, self.data_output_panel); self.messages_panel = main_docker.addPanel('messages', wcDocker.DOCK.STACKED, self.data_output_panel); self.notifications_panel = main_docker.addPanel('notifications', wcDocker.DOCK.STACKED, self.data_output_panel); - self.history_panel = main_docker.addPanel('history', wcDocker.DOCK.STACKED, self.data_output_panel); + self.history_panel = main_docker.addPanel('history', wcDocker.DOCK.STACKED, sql_panel_obj); self.render_history_grid(); queryToolNotifications.renderNotificationsGrid(self.notifications_panel);