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 1fSMXb-0004fs-CF for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 13:07:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSMXZ-0004mx-KU for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 13:07:21 +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 1fSMXZ-0004lI-Dw for pgadmin-hackers@lists.postgresql.org; Mon, 11 Jun 2018 13:07:21 +0000 Received: from mail-yb0-x22f.google.com ([2607:f8b0:4002:c09::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fSMXW-0002mL-4K for pgadmin-hackers@postgresql.org; Mon, 11 Jun 2018 13:07:20 +0000 Received: by mail-yb0-x22f.google.com with SMTP id n23-v6so5395747ybg.1 for ; Mon, 11 Jun 2018 06:07:17 -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=mzsNspObgswMbjEFsidG6FbGl4RQN7rtnILUVWqb8W0=; b=CB4PgwevOt0ukHBUdI5GKcFukZ5tYBtPSMrATdzmGjTMScKYi+F5+d+qn31mxlz+4w MLYhZv9NKpf/qFpcxjYVZhN1Hn9rle6uHKV/1H9FcyQlRmtqXPYUQ0WfOfFVFA5WpkBi Dd40dnoGONxGs4eyJ+Zip1caUCA/E0XRfdNeR+zld0m983rW2ptyDIOwXZAYuCdH35sU ZQMCKGXNeN4H/XgoZ2DszOAHazOZkWEp3xWcXpP7cXWj72mv7IZiF/DvSpPOTrFP6Tvx 2sBvsklupUnwDmn9w/Z983tX2yLjycydroNfz+ouxJhvOIzfkcKF2rpCMS5FkuqsCCXO 7UEw== 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=mzsNspObgswMbjEFsidG6FbGl4RQN7rtnILUVWqb8W0=; b=H8HBt8vb9lnp/6I01TIw5lb1fcHomqhxA+OM1+p8cwKtjHolAQto+ClUxQPqEFZTnc D6rwEfuzrHtlzC5hU8SGOsVZUy8XigJ880i6T4sZLA2hEOKL4lMThZNgrkzpEacVfCgr kzpt8C+g7Xqqm1DadCSnb0HWJ/yw9PLsreJybj0V8XSXvl8cqwndDfi7FkrFudj+k1Oa fj/e1RbpM/DOFWwmSagzzCVLHelg0M9bjyl9X1fH1suBP52icl6V7bJ4PyONf47ui+5l bFZcGMOScBWMetM0bN7Yw2g3a56x5JjfWYFCHevTv3kxWUS/DM6RjkCwkpJAYWvauGmI hWqw== X-Gm-Message-State: APt69E1g8+i93B6lpAHpWZ7w8baQflwL+qZY1dRFc2EoPRxZJ37y1RHt u0u9GgoCDNFb5qFqMWmryuQb2fdYmBEmWsoSovylBg== X-Google-Smtp-Source: ADUXVKIxKZqVfAe/Xfc5geH8QAsR/1iGwXvRjpGzeIl4VAKzNauDKBQrXvOtjQnmAI2DsbF0wNn2ydACtE7KQF5II68= X-Received: by 2002:a25:abab:: with SMTP id v40-v6mr10529607ybi.390.1528722435783; Mon, 11 Jun 2018 06:07:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a81:2712:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 06:07:15 -0700 (PDT) In-Reply-To: References: From: Harshal Dhumal Date: Mon, 11 Jun 2018 18:37:15 +0530 Message-ID: Subject: Re: RM#3294 - User need to reset the layout to see the changed preferences parameters To: Aditya Toshniwal Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000bedc7e056e5d6dad" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000bedc7e056e5d6dad Content-Type: text/plain; charset="UTF-8" On Mon, Jun 11, 2018 at 6:02 PM, Aditya Toshniwal < 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. And we can generate event name from preference itself like *:::* eg.:* browser:display:show_system_objects:update* > 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). > > 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" > --000000000000bedc7e056e5d6dad Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Jun 11, 2018 at 6:02 PM, Aditya Toshniwal <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 a= ble 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 inst= ead of generic event.
And we can generate event name from prefere= nce itself like <module>:<category>:<name>:<event_t= ype>
eg.:=C2=A0browser:display:show_system_objects:upda= te
=C2=A0
2) listent to prefChangedEvent wherev= er 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 listene= r executes the event handler and changes are done.
Benefit of this approach is no polling. But, there= is a problem here.=C2=A0
It is not possible to fire = event in another tab/new browser window. For example, query tool can be ope= n in another tab. And thus, changes are not reflected there. There are solu= tions 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 pol= ling on client side it self (at least it will avoid polling over http).
The main tab will update only preference specific cookie when prefer= ence is updated and other tabs will poll required cookies (not all)
with specific interval (1 second can be configurable).
=C2=A0<= /div>

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

Thanks and Regards,
Aditya Toshniwal
Software Engineer |=C2=A0Enterprise= DB Software Solutions |=C2=A0Pune
"Don't Complain about H= eat, Plant a tree"

--000000000000bedc7e056e5d6dad--