public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pradip Parkale <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM6398]: Detaching query editor panel gives a blank white panel.
Date: Thu, 24 Jun 2021 21:16:29 +0530
Message-ID: <CAJ9T6Sv5CrVWBSm=BSJmH5rD5n0VG3Yr4n_vyg4KOWqzV_cadQ@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDe0Wq9cNE5qMEJQXoTHuVW_fPS-78PJhGRNyoV8xQujtg@mail.gmail.com>
References: <CAJ9T6St7o5QTO1R2KSsvZAviCw0jK0u6MWsgUAtRzpkDQQpA+A@mail.gmail.com>
<CANxoLDe9U1a6oOxJ+xy6cBHyghmCKgMpv6X7fqj9knSUU4FjBw@mail.gmail.com>
<CAJ9T6SsW9VB+J8UAbMXtpapuA_Dx8qX25BOdTLrkq=O+zCbVqw@mail.gmail.com>
<CANxoLDe0Wq9cNE5qMEJQXoTHuVW_fPS-78PJhGRNyoV8xQujtg@mail.gmail.com>
Hi Akshay,
Please find the updated patch. I have moved the function into the utility
file now.
On Thu, Jun 24, 2021 at 7:56 PM Akshay Joshi <[email protected]>
wrote:
> Hi Pradip
>
> I have seen that we have duplicated code for resize_the_queryTool,
> resize_the_erdtool, resize_the_psql, and in debugger_ui.js file. I would
> suggest making a common function somewhere in the utils and call that
> function. In the future, if we need to change the code we will have to
> change it in four different places.
>
> Please resend the patch after fixing the above issue.
>
> On Thu, Jun 24, 2021 at 7:00 PM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>> Please find attached for debugger and ERD tool which was missing in
>> my previous patch.
>>
>> On Wed, Jun 23, 2021 at 11:50 AM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Thanks, the patch applied.
>>>
>>> On Wed, Jun 16, 2021 at 11:29 PM Pradip Parkale <
>>> [email protected]> wrote:
>>>
>>>> Hi Hackers,
>>>>
>>>> Please find the attached patch for #6398.Detaching query editor panel
>>>> gives a blank white panel.
>>>>
>>>>
>>>> --
>>>> Thanks & Regards,
>>>> Pradip Parkale
>>>> Software Engineer | EnterpriseDB Corporation
>>>>
>>>
>>>
>>> --
>>> *Thanks & Regards*
>>> *Akshay Joshi*
>>> *pgAdmin Hacker | Principal Software Architect*
>>> *EDB Postgres <http://edbpostgres.com>*
>>>
>>> *Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] 6398_v3.patch (9.2K, 3-6398_v3.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/frame.js b/web/pgadmin/browser/static/js/frame.js
index 0d3b91273..dc4ec5527 100644
--- a/web/pgadmin/browser/static/js/frame.js
+++ b/web/pgadmin/browser/static/js/frame.js
@@ -18,7 +18,7 @@ define([
pgAdmin.Browser.Frame = function(options) {
var defaults = [
'name', 'title', 'width', 'height', 'showTitle', 'isCloseable',
- 'isPrivate', 'url', 'icon', 'onCreate',
+ 'isPrivate', 'url', 'icon', 'onCreate', 'isLayoutMember',
];
_.extend(this, _.pick(options, defaults));
};
@@ -32,6 +32,7 @@ define([
isClosable: true,
isRenamable: false,
isPrivate: false,
+ isLayoutMember: false,
url: '',
icon: '',
panel: null,
@@ -43,6 +44,7 @@ define([
docker.registerPanelType(this.name, {
title: that.title,
isPrivate: that.isPrivate,
+ isLayoutMember: that.isLayoutMember,
onCreate: function(myPanel) {
$(myPanel).data('pgAdminName', that.name);
myPanel.initSize(that.width, that.height);
diff --git a/web/pgadmin/static/js/utils.js b/web/pgadmin/static/js/utils.js
index 79b0bcefe..c84b7487b 100644
--- a/web/pgadmin/static/js/utils.js
+++ b/web/pgadmin/static/js/utils.js
@@ -11,6 +11,9 @@ import _ from 'underscore';
import { getTreeNodeHierarchyFromIdentifier } from 'sources/tree/pgadmin_tree_node';
import $ from 'jquery';
import gettext from 'sources/gettext';
+import 'wcdocker';
+
+var wcDocker = window.wcDocker;
export function parseShortcutValue(obj) {
var shortcut = '';
@@ -408,3 +411,29 @@ function checkBinaryPathExists(binaryPathArray, selectedServerVersion) {
return (serverSpecificPathExist | foundDefaultPath);
}
+
+export function registerDetachEvent(panel){
+ panel.on(wcDocker.EVENT.DETACHED, function() {
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').attr({
+ style: 'z-index: 1200'
+ });
+ });
+ panel.on(wcDocker.EVENT.ORDER_CHANGED, function() {
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').attr({
+ style: 'z-index: 1200'
+ });
+ });
+ panel.on(wcDocker.EVENT.ORDER_CHANGED, function() {
+ var docker = this.docker(this._panel);
+ var dockerPos = docker.$container.offset();
+ var pos = this.$container.offset();
+ var width = this.$container.width();
+ var height = this.$container.height();
+
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').css('top', pos.top - dockerPos.top);
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').css('left', pos.left - dockerPos.left);
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').css('width', width);
+ $((this.$container)[0].ownerDocument).find('.wcIFrameFloating').find('.wcIFrameFloating').css('height', height);
+ });
+
+}
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index 80ce35680..5d88831e6 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -213,19 +213,6 @@ define('pgadmin.datagrid', [
showQueryTool.showQueryTool(this, pgBrowser, alertify, url, aciTreeIdentifier, transId);
},
- resize_the_queryTool: function(){
- var docker = this.docker(this._panel);
- var dockerPos = docker.$container.offset();
- var pos = this.$container.offset();
- var width = this.$container.width();
- var height = this.$container.height();
-
- $(wcDocker).find('.wcIFrameFloating').css('top', pos.top - dockerPos.top);
- $(wcDocker).find('.wcIFrameFloating').css('left', pos.left - dockerPos.left);
- $(wcDocker).find('.wcIFrameFloating').css('width', width);
- $(wcDocker).find('.wcIFrameFloating').css('height', height);
- },
-
launch_grid: function(trans_id, panel_url, is_query_tool, panel_title, sURL=null, sql_filter=null) {
let queryToolForm = `
@@ -283,19 +270,7 @@ define('pgadmin.datagrid', [
});
});
- queryToolPanel.on(wcDocker.EVENT.DETACHED, function() {
- $(wcDocker).find('.wcIFrameFloating').attr({
- style: 'z-index: 1200'
- });
- });
-
- queryToolPanel.on(wcDocker.EVENT.ORDER_CHANGED, function() {
- $(wcDocker).find('.wcIFrameFloating').attr({
- style: 'z-index: 1200'
- });
- });
-
- queryToolPanel.on(wcDocker.EVENT.ORDER_CHANGED, this.resize_the_queryTool);
+ commonUtils.registerDetachEvent(queryToolPanel);
// Listen on the panelRename event.
queryToolPanel.on(wcDocker.EVENT.RENAME, function(panel_data) {
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
index 5b6041d5b..43ee2f3f6 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
@@ -10,11 +10,11 @@
define([
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser',
- 'pgadmin.backgrid', 'sources/window', 'pgadmin.tools.debugger.utils',
+ 'pgadmin.backgrid', 'sources/window', 'pgadmin.tools.debugger.utils','sources/utils',
'wcdocker',
], function(
gettext, url_for, $, _, Backbone, Alertify, pgAdmin, pgBrowser, Backgrid,
- pgWindow, debuggerUtils,
+ pgWindow, debuggerUtils, commonUtils,
) {
var wcDocker = window.wcDocker;
@@ -796,7 +796,7 @@ define([
method: 'DELETE',
});
});
-
+ commonUtils.registerDetachEvent(panel);
// Panel Rename event
panel.on(wcDocker.EVENT.RENAME, function(panel_data) {
Alertify.prompt('', panel_data.$titleText[0].textContent,
diff --git a/web/pgadmin/tools/erd/static/js/erd_module.js b/web/pgadmin/tools/erd/static/js/erd_module.js
index 1e414e43f..61327214f 100644
--- a/web/pgadmin/tools/erd/static/js/erd_module.js
+++ b/web/pgadmin/tools/erd/static/js/erd_module.js
@@ -10,7 +10,7 @@
import Alertify from 'pgadmin.alertifyjs';
import {getTreeNodeHierarchyFromIdentifier} from 'sources/tree/pgadmin_tree_node';
import {getPanelTitle} from 'tools/datagrid/static/js/datagrid_panel_title';
-import {getRandomInt} from 'sources/utils';
+import {getRandomInt, registerDetachEvent} from 'sources/utils';
export function setPanelTitle(erdToolPanel, panelTitle) {
@@ -165,7 +165,8 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, pgBrowser
method: 'DELETE',
});
});
-
+ // Register detach event.
+ registerDetachEvent(erdToolPanel);
var openErdToolURL = function(j) {
// add spinner element
let $spinner_el =
diff --git a/web/pgadmin/tools/psql/static/js/psql_module.js b/web/pgadmin/tools/psql/static/js/psql_module.js
index 54b2d79c8..fc8e98261 100644
--- a/web/pgadmin/tools/psql/static/js/psql_module.js
+++ b/web/pgadmin/tools/psql/static/js/psql_module.js
@@ -15,7 +15,7 @@ import Alertify from 'pgadmin.alertifyjs';
import {enable} from 'pgadmin.browser.toolbar';
import clipboard from 'sources/selection/clipboard';
import 'wcdocker';
-import {getRandomInt, hasBinariesConfiguration} from 'sources/utils';
+import {getRandomInt, hasBinariesConfiguration, registerDetachEvent} from 'sources/utils';
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
import pgWindow from 'sources/window';
@@ -181,19 +181,7 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
var propertiesPanel = pgBrowser.docker.findPanels('properties');
var psqlToolPanel = pgBrowser.docker.addPanel('frm_psqltool', wcDocker.DOCK.STACKED, propertiesPanel[0]);
- psqlToolPanel.on(wcDocker.EVENT.DETACHED, function() {
- $(wcDocker).find('.wcIFrameFloating').attr({
- style: 'z-index: 1200'
- });
- });
-
- psqlToolPanel.on(wcDocker.EVENT.ORDER_CHANGED, function() {
- $(wcDocker).find('.wcIFrameFloating').attr({
- style: 'z-index: 1200'
- });
- });
-
- psqlToolPanel.on(wcDocker.EVENT.ORDER_CHANGED, this.resize_the_psql);
+ registerDetachEvent(psqlToolPanel);
// Set panel title and icon
setPanelTitle(psqlToolPanel, panelTitle);
@@ -231,18 +219,6 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
}
},
- resize_the_psql: function(){
- var docker = this.docker(this._panel);
- var dockerPos = docker.$container.offset();
- var pos = this.$container.offset();
- var width = this.$container.width();
- var height = this.$container.height();
-
- $(wcDocker).find('.wcIFrameFloating').css('top', pos.top - dockerPos.top);
- $(wcDocker).find('.wcIFrameFloating').css('left', pos.left - dockerPos.left);
- $(wcDocker).find('.wcIFrameFloating').css('width', width);
- $(wcDocker).find('.wcIFrameFloating').css('height', height);
- },
getPanelUrls: function(transId, panelTitle, parentData) {
let openUrl = url_for('psql.panel', {
trans_id: transId,
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [pgAdmin][RM6398]: Detaching query editor panel gives a blank white panel.
In-Reply-To: <CAJ9T6Sv5CrVWBSm=BSJmH5rD5n0VG3Yr4n_vyg4KOWqzV_cadQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox