public inbox for [email protected]  
help / color / mirror / Atom feed
RM#3294 - User need to reset the layout to see the changed preferences parameters
6+ messages / 4 participants
[nested] [flat]

* RM#3294 - User need to reset the layout to see the changed preferences parameters
@ 2018-06-11 12:32 Aditya Toshniwal <[email protected]>
  2018-06-11 13:07 ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Harshal Dhumal <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Aditya Toshniwal @ 2018-06-11 12:32 UTC (permalink / raw)
  To: pgadmin-hackers

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
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.

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"


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
  2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
@ 2018-06-11 13:07 ` Harshal Dhumal <[email protected]>
  2018-06-12 04:51   ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Harshal Dhumal @ 2018-06-11 13:07 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

On Mon, Jun 11, 2018 at 6:02 PM, Aditya Toshniwal <
[email protected]> 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
*<module>:<category>:<name>:<event_type>*
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"
>


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
  2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-11 13:07 ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Harshal Dhumal <[email protected]>
@ 2018-06-12 04:51   ` Aditya Toshniwal <[email protected]>
  2018-06-12 16:22     ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Victoria Henry <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Aditya Toshniwal @ 2018-06-12 04:51 UTC (permalink / raw)
  To: Harshal Dhumal <[email protected]>; +Cc: pgadmin-hackers

Hi Harshal,

On Mon, Jun 11, 2018 at 6:37 PM, Harshal Dhumal <
[email protected]> 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"
>>
>
>


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
  2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-11 13:07 ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Harshal Dhumal <[email protected]>
  2018-06-12 04:51   ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
@ 2018-06-12 16:22     ` Victoria Henry <[email protected]>
  2018-06-14 13:24       ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Victoria Henry @ 2018-06-12 16:22 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: [email protected]; pgadmin-hackers

Hi Aditya,


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.
>

Maybe it's better to poll only when an editor is open in a separate
window?  What would we be polling for and how would be tell the backend
that something changed during the poll?

Thanks
Victoria & Joao


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
  2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-11 13:07 ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Harshal Dhumal <[email protected]>
  2018-06-12 04:51   ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-12 16:22     ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Victoria Henry <[email protected]>
@ 2018-06-14 13:24       ` Aditya Toshniwal <[email protected]>
  2018-06-15 05:16         ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Aditya Toshniwal @ 2018-06-14 13:24 UTC (permalink / raw)
  To: Victoria Henry <[email protected]>; +Cc: Harshal Dhumal <[email protected]>; pgadmin-hackers

Hi Victoria/Hackers,

On Tue, Jun 12, 2018 at 9:52 PM, Victoria Henry <[email protected]> wrote:

> Hi Aditya,
>
>
> 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.
>>
>
> Maybe it's better to poll only when an editor is open in a separate
> window?  What would we be polling for and how would be tell the backend
> that something changed during the poll?
>

​Currently I am using the cache_preferences function to fire the events.​
cache_preferences is called whenever preferences are changed. I suggest we
add kind of version for the preference cache, lets say prefcache_version
and we can set it to current epoch time whenever the cache_preference is
called.
​
​ Now, when a new tab/window is opened, it will store the version of
prefcache it is having. When the main window changes the preferences and
cache_preference is called, the prefcache_version will increase to current
epoch time. New tab polling can check if the version has increased and can
update ​its preferences along with prefcache_version.

​Please let me know if any suggestions.​


> Thanks
> Victoria & Joao
>



-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: RM#3294 - User need to reset the layout to see the changed preferences parameters
  2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-11 13:07 ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Harshal Dhumal <[email protected]>
  2018-06-12 04:51   ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
  2018-06-12 16:22     ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Victoria Henry <[email protected]>
  2018-06-14 13:24       ` Re: RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
@ 2018-06-15 05:16         ` Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Khushboo Vashi @ 2018-06-15 05:16 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Victoria Henry <[email protected]>; Harshal Dhumal <[email protected]>; pgadmin-hackers

On Thu, Jun 14, 2018 at 6:54 PM, Aditya Toshniwal <
[email protected]> wrote:

> Hi Victoria/Hackers,
>
> On Tue, Jun 12, 2018 at 9:52 PM, Victoria Henry <[email protected]> wrote:
>
>> Hi Aditya,
>>
>>
>> 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.
>>>
>>
>> Maybe it's better to poll only when an editor is open in a separate
>> window?  What would we be polling for and how would be tell the backend
>> that something changed during the poll?
>>
>
> ​Currently I am using the cache_preferences function to fire the events.​
> cache_preferences is called whenever preferences are changed. I suggest we
> add kind of version for the preference cache, lets say prefcache_version
> and we can set it to current epoch time whenever the cache_preference is
> called.
> ​
> ​ Now, when a new tab/window is opened, it will store the version of
> prefcache it is having. When the main window changes the preferences and
> cache_preference is called, the prefcache_version will increase to current
> epoch time. New tab polling can check if the version has increased and can
> update ​its preferences along with prefcache_version.
>
> Sounds good to me.

> ​Please let me know if any suggestions.​
>
>
>> Thanks
>> Victoria & Joao
>>
>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-06-15 05:16 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 12:32 RM#3294 - User need to reset the layout to see the changed preferences parameters Aditya Toshniwal <[email protected]>
2018-06-11 13:07 ` Harshal Dhumal <[email protected]>
2018-06-12 04:51   ` Aditya Toshniwal <[email protected]>
2018-06-12 16:22     ` Victoria Henry <[email protected]>
2018-06-14 13:24       ` Aditya Toshniwal <[email protected]>
2018-06-15 05:16         ` Khushboo Vashi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox