Re: RM#3294 - User need to reset the layout to see the changed preferences parameters

From: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
To: Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
Date: 2018-06-12 04:51:03
Message-ID: CAM9w-_mm2kxja3_WqoSxa8xyKkaDLBCZavvUhajtgaC7qn57OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Harshal,

On Mon, Jun 11, 2018 at 6:37 PM, Harshal Dhumal <
harshal(dot)dhumal(at)enterprisedb(dot)com> wrote:

> 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.
>
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
> *<module>:<category>:<name>:<event_type>*
> 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"
>>
>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Ashesh Vashi 2018-06-12 05:34:16 pgAdmin 4 commit: Disable ACLs for the database objects for the Greenpl
Previous Message Ashesh Vashi 2018-06-12 04:34:56 Re: [pgadmin4][patch][GreenPlum] Display SQL for tables takes 15 minutes to execute