Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them. Fixes #3619

pull/13/head
Akshay Joshi 2018-11-29 15:47:48 +00:00 committed by Dave Page
parent bdf9f3404f
commit d801ed5008
5 changed files with 28 additions and 5 deletions

View File

@ -15,3 +15,4 @@ Bug fixes
********* *********
| `Bug #3354 <https://redmine.postgresql.org/issues/3354>`_ - Fix handling of array types as inputs to the debugger. | `Bug #3354 <https://redmine.postgresql.org/issues/3354>`_ - Fix handling of array types as inputs to the debugger.
| `Bug #3619 <https://redmine.postgresql.org/issues/3619>`_ - Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them.

View File

@ -552,6 +552,26 @@ def direct_new(trans_id):
# We need client OS information to render correct Keyboard shortcuts # We need client OS information to render correct Keyboard shortcuts
user_agent = UserAgent(request.headers.get('User-Agent')) 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( return render_template(
"debugger/direct.html", "debugger/direct.html",
_=gettext, _=gettext,
@ -561,6 +581,7 @@ def direct_new(trans_id):
is_desktop_mode=current_app.PGADMIN_RUNTIME, is_desktop_mode=current_app.PGADMIN_RUNTIME,
is_linux=is_linux_platform, is_linux=is_linux_platform,
client_platform=user_agent.platform, client_platform=user_agent.platform,
function_name_with_arguments=obj['function_name'] + function_arguments
) )

View File

@ -1521,7 +1521,7 @@ define([
_.extend(DirectDebug.prototype, { _.extend(DirectDebug.prototype, {
/* We should get the transaction id from the server during initialization here */ /* 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. // We do not want to initialize the module multiple times.
var self = this; var self = this;
_.bindAll(pgTools.DirectDebug, 'messages'); _.bindAll(pgTools.DirectDebug, 'messages');
@ -1540,6 +1540,7 @@ define([
this.debug_restarted = false; this.debug_restarted = false;
this.is_user_aborted_debugging = false; this.is_user_aborted_debugging = false;
this.is_polling_required = true; // Flag to stop unwanted ajax calls this.is_polling_required = true; // Flag to stop unwanted ajax calls
this.function_name_with_arguments = function_name_with_arguments;
let browser = window.opener ? let browser = window.opener ?
window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser; window.opener.pgAdmin.Browser : window.top.pgAdmin.Browser;
@ -1699,7 +1700,7 @@ define([
intializePanels: function() { intializePanels: function() {
var self = this; var self = this;
this.registerPanel( this.registerPanel(
'code', false, '100%', '50%', 'code', self.function_name_with_arguments, '100%', '50%',
function() { function() {
// Create the parameters panel to display the arguments of the functions // Create the parameters panel to display the arguments of the functions

View File

@ -9,7 +9,7 @@ try {
var pgDirectDebug = pgDirectDebug || pgAdmin.Tools.DirectDebug; var pgDirectDebug = pgDirectDebug || pgAdmin.Tools.DirectDebug;
var $ = pgDirectDebug.jquery; var $ = pgDirectDebug.jquery;
pgDirectDebug.init({{ uniqueId }}, {{ debug_type }}); pgDirectDebug.init({{ uniqueId }}, {{ debug_type }}, '{{ function_name_with_arguments }}');
window.onbeforeunload = function(ev) { window.onbeforeunload = function(ev) {
$.ajax({ $.ajax({
url: "{{ url_for('debugger.index') }}close/{{ uniqueId }}", url: "{{ url_for('debugger.index') }}close/{{ uniqueId }}",

View File

@ -173,7 +173,7 @@ define('tools.querytool', [
var sql_panel = new pgAdmin.Browser.Panel({ var sql_panel = new pgAdmin.Browser.Panel({
name: 'sql_panel', name: 'sql_panel',
title: false, title: gettext('Query Editor'),
width: '100%', width: '100%',
height: '20%', height: '20%',
isCloseable: false, isCloseable: false,
@ -292,7 +292,7 @@ define('tools.querytool', [
self.explain_panel = main_docker.addPanel('explain', wcDocker.DOCK.STACKED, self.data_output_panel); 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.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.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(); self.render_history_grid();
queryToolNotifications.renderNotificationsGrid(self.notifications_panel); queryToolNotifications.renderNotificationsGrid(self.notifications_panel);