Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSbGy-0007Kc-DI for pgadmin-hackers@arkaria.postgresql.org; Tue, 12 Jun 2018 04:51:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSbGw-00077T-AS for pgadmin-hackers@arkaria.postgresql.org; Tue, 12 Jun 2018 04:51:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSbGw-00076s-59 for pgadmin-hackers@lists.postgresql.org; Tue, 12 Jun 2018 04:51:10 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fSbGr-0008JG-Dc for pgadmin-hackers@postgresql.org; Tue, 12 Jun 2018 04:51:09 +0000 Received: by mail-lf0-x235.google.com with SMTP id n3-v6so33911269lfe.12 for ; Mon, 11 Jun 2018 21:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LQ+11Mv0Bo6zaQCdd9rOB58AE27Go5mCSqDvRZjJcYc=; b=gmWOX/pkzC3q2DYduzS/eBct4O7cA99icPHa+o8kOJHY70N59KU2teJKl4iyfcM1xZ 65xty4AOV5ZaILWuo/2izyLBH0gBEnlu9f+nrBKiSvYcVGINPKNXHsUydLJeem2goCpt iqe1maLoaZb7F5b+6O7vhaJquEYDtwrouj7JVc1jEVaHta1AGPx/SRbA0io53y47+Yq5 cl02TZeYOmuDQNx6jB3gxeI9nuOSUrmTxImcicy37IpG03V7IkgBUHlpQauYnlyf/YjS A6Du47G1CDWYZY+gkIKb70ixHhdWicc/urp+nlUfpEHd1PkcPpgOJvGOuVJLcPfLDFZd MVLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LQ+11Mv0Bo6zaQCdd9rOB58AE27Go5mCSqDvRZjJcYc=; b=cc7yOcirfmdPuadAbRhJ1QjXpfdn0eaZkPOSXVDyRZrAKCl8l14h+JMVbAIlqHfbJM PYekAE8JpV+hckK6bQuoNVVViBVJej8PP3O4IG1C0UB4/qtby/zkjPT3eImQsFXmBA33 Xf5i7hY020who4BX6h2EIwos4na1uEhtyKJI2tme9EB0wZJkEQYBAYw6mYZMW69BsLLm tNBfLlPPuLsc4ZSCN1FnzMBq6u6M/371jqxA6zO7WuQDQY1VcWY+I/tIDQga5sjpQoUX 9zP3OkuNzzrm/d7s3NXG5blrJJJTr/GHzgOj3ul2FjBg/lQnGVQ4b0yPnFgodv6/w5zj 83Jw== X-Gm-Message-State: APt69E1hRWE3FxTmYO4PL9923qBjY3PFGEA25Xu4JsMP9X7wfILlIbMu BAZ84MG4Rs6hdwfr5bd5ZZHXa0cPiRHDfW1gZ9ir0Q== X-Google-Smtp-Source: ADUXVKJ9wKoXbPHnDi2AmPTYaepaPCT3mI5CLsKu7q+w+WroAgvsddRoq/JjmVKC4Ui3n0CEVlR0gULxtCLLGgAqGUI= X-Received: by 2002:a19:f71a:: with SMTP id z26-v6mr992191lfe.137.1528779063721; Mon, 11 Jun 2018 21:51:03 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:7a02:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 21:51:03 -0700 (PDT) In-Reply-To: References: From: Aditya Toshniwal Date: Tue, 12 Jun 2018 10:21:03 +0530 Message-ID: Subject: Re: RM#3294 - User need to reset the layout to see the changed preferences parameters To: Harshal Dhumal Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000089856056e6a9d63" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000089856056e6a9d63 Content-Type: text/plain; charset="UTF-8" Hi Harshal, On Mon, Jun 11, 2018 at 6:37 PM, Harshal Dhumal < harshal.dhumal@enterprisedb.com> wrote: > On Mon, Jun 11, 2018 at 6:02 PM, Aditya Toshniwal enterprisedb.com> wrote: > >> Hi Hackers, >> >> This is regarding RM3294 which I am working on, where user needs to reset >> the layout to see the changed preferences parameters. I am able to >> implement it, and have used the following approach: >> 1) when preference changed, fire a custom event - prefChangedEvent >> > We can also fire preference specific event instead of generic event. > I have just sent the overall flow and not the detailed. I am going to make it general event with data as modules whose preferences are changed. > And we can generate event name from preference itself like > *:::* > eg.:* browser:display:show_system_objects:update* > This will require lot many if clauses and with so many preferences I think we should do it at module level. > > >> 2) listent to prefChangedEvent wherever preferences should be reflected >> in realtime. >> 3) In the event handler, make the changes as per the module. >> 4) So whenever the preferences are changed, the event fires, the listener >> executes the event handler and changes are done. >> >> Benefit of this approach is no polling. But, there is a problem here. >> It is not possible to fire event in another tab/new browser window. For >> example, query tool can be open in another tab. And thus, changes are not >> reflected there. There are solutions available like updating the >> localStorage of the browser but those are not reliable and does not work >> properly on different browsers. >> > To communicate between browser tabs we can use cookie polling on client > side it self (at least it will avoid polling over http). > The main tab will update only preference specific cookie when preference > is updated and other tabs will poll required cookies (not all) > with specific interval (1 second can be configurable). > Polling is a solution but I think it should be the last option. http polls will not be required anyway as we have preference cache in the browser object. > > >> >> Request you to kindly suggest if you any better idea. >> >> Thanks and Regards, >> Aditya Toshniwal >> Software Engineer | EnterpriseDB Software Solutions | Pune >> "Don't Complain about Heat, Plant a tree" >> > > --000000000000089856056e6a9d63 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Harshal,

On Mon, Jun 11, 2018 at 6:37 PM, Harshal Dhu= mal <harshal.dhumal@enterprisedb.com> wrote:
=
On Mon, Jun 11, 2018 at 6:02 PM, Aditya Toshniwal &l= t;ad= itya.toshniwal@enterprisedb.com> wrote:
<= /div>
Hi Hackers,

This is regarding RM3294 which I am = working on, where user needs to reset the layout to see the changed prefere= nces parameters. I am able to implement it, and have used the following app= roach:
1) when preference changed, fire a custom eve= nt - prefChangedEvent
We can also fire = preference specific event instead of generic event.
=
I have just sent the overall flow and not the detailed.= I am going to make it general event with data as modules whose preferences= are changed.=C2=A0
And we can = generate event name from preference itself like <module>:<categ= ory>:<name>:<event_type>
eg.:=C2=A0bro= wser:display:show_system_objects:update=C2=A0
This will require lot many if clauses and with so many= preferences I think we should do it at module level.
=C2=A0
2) listent to prefCha= ngedEvent wherever preferences should be reflected in realtime.
3) In the event handler, make the changes as per the module.
4) So whenever the preferences are changed, the event fi= res, the listener executes the event handler and changes are done.

Benefit of this approach is no pol= ling. But, there is a problem here.=C2=A0
It is not p= ossible to fire event in another tab/new browser window. For example, query= tool can be open in another tab. And thus, changes are not reflected there= . There are solutions available like updating the localStorage of the brows= er but those are not reliable and does not work properly on different brows= ers.
To communicate between browser tab= s we can use cookie polling on client side it self (at least it will avoid = polling over http).
The main tab will update only preference spec= ific cookie when preference is updated and other tabs will poll required co= okies (not all)
with specific interval (1 second can be configura= ble).
Polling is a solution but I = think it should be the last option. http polls will not be required anyway = as we have preference cache in the browser object.
=C2=A0

Request you to kindly suggest if you any better idea.
=

Thanks and Regards,
Aditya Toshniwal
Software Engineer |=C2=A0EnterpriseDB Software S= olutions |=C2=A0Pune
<= span style=3D"font-family:"trebuchet ms",sans-serif;font-size:x-s= mall">"Don't Complain about Heat, Plant a = tree"


--000000000000089856056e6a9d63--