Thread: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
[pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
Attachment
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
Hi,Please find the attached patch for RM #1253 - Store and reload current location in treeviewFeature Details:- The current tree state will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- On window unload the current tree state will be saved.- On Reload, while opening the server, the stored path will be populated.- On closing the node the saved will be updated accordingly.- Jasmine test cases are included.Thanks,Khushboo
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
- Logic doesn't work when we disconnect and re-connect to the database server. We have duplicated RM #1335.
- Instead of -1 we should use 0 to stop the tree saving functionality. Send request at 0 second doesn't make any sense.
- What if pgAdmin4 opens in two different browsers or two different tabs with different tree hierarchy in that case it will override the state of each other. (This could be an enhancement request).
Hi Khushboo,Cheers, the patch looks good to me. I have few suggestions:1) Expand the tree -> Go to server properties and rename the server -> the tree closes. It should expand to last state. Same applies to other nodes which can be renamed.2) It would be nice if we can also save the last selected object. The tree expands but the last selected object is not selected.3) In /web/pgadmin/static/js/tree/pgadmin_tree_save_state. js import pgAdmin from '../../../static/js/pgadmin'; -- please use alias here rather than relative path.4) I would suggest to add 1 example/format JSON of tree state in comments in the file so that it will be easier to relate the code with.--On Fri, Aug 24, 2018 at 10:08 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: Hi,Please find the attached patch for RM #1253 - Store and reload current location in treeviewFeature Details:- The current tree state will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- On window unload the current tree state will be saved.- On Reload, while opening the server, the stored path will be populated.- On closing the node the saved will be updated accordingly.- Jasmine test cases are included.Thanks,KhushbooThanks and Regards,Aditya ToshniwalSoftware Engineer | EnterpriseDB Software Solutions | Pune"Don't Complain about Heat, Plant a tree"

Mobile: +91 976-788-8246
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
Hi KhushbooPatch looks good to me, following are my review comments:
- Logic doesn't work when we disconnect and re-connect to the database server. We have duplicated RM #1335.
- Instead of -1 we should use 0 to stop the tree saving functionality. Send request at 0 second doesn't make any sense.
- What if pgAdmin4 opens in two different browsers or two different tabs with different tree hierarchy in that case it will override the state of each other. (This could be an enhancement request).
--On Mon, Aug 27, 2018 at 11:09 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote: Hi Khushboo,Cheers, the patch looks good to me. I have few suggestions:1) Expand the tree -> Go to server properties and rename the server -> the tree closes. It should expand to last state. Same applies to other nodes which can be renamed.2) It would be nice if we can also save the last selected object. The tree expands but the last selected object is not selected.3) In /web/pgadmin/static/js/tree/pgadmin_tree_save_state.js import pgAdmin from '../../../static/js/pgadmin'; -- please use alias here rather than relative path.4) I would suggest to add 1 example/format JSON of tree state in comments in the file so that it will be easier to relate the code with.--On Fri, Aug 24, 2018 at 10:08 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: Hi,Please find the attached patch for RM #1253 - Store and reload current location in treeviewFeature Details:- The current tree state will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- On window unload the current tree state will be saved.- On Reload, while opening the server, the stored path will be populated.- On closing the node the saved will be updated accordingly.- Jasmine test cases are included.Thanks,KhushbooThanks and Regards,Aditya ToshniwalSoftware Engineer | EnterpriseDB Software Solutions | Pune"Don't Complain about Heat, Plant a tree"Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246
On Mon, Aug 27, 2018 at 1:19 PM, Akshay Joshi <akshay.joshi@enterprisedb.com> wrote: Hi KhushbooPatch looks good to me, following are my review comments:
- Logic doesn't work when we disconnect and re-connect to the database server. We have duplicated RM #1335.
I have saved the current state of the tree. so If I have disconnected the server, so that closed state will be considered for that server.If another server(s) is still connected and opened at some node, and then you reload the browser, on connecting/expanding the server it will populate the server nodes.@Dave,Do I need to change this behaviour?
- Instead of -1 we should use 0 to stop the tree saving functionality. Send request at 0 second doesn't make any sense.
- What if pgAdmin4 opens in two different browsers or two different tabs with different tree hierarchy in that case it will override the state of each other. (This could be an enhancement request).
--On Mon, Aug 27, 2018 at 11:09 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote: Hi Khushboo,Cheers, the patch looks good to me. I have few suggestions:1) Expand the tree -> Go to server properties and rename the server -> the tree closes. It should expand to last state. Same applies to other nodes which can be renamed.2) It would be nice if we can also save the last selected object. The tree expands but the last selected object is not selected.3) In /web/pgadmin/static/js/tree/pgadmin_tree_save_state.js import pgAdmin from '../../../static/js/pgadmin'; -- please use alias here rather than relative path.4) I would suggest to add 1 example/format JSON of tree state in comments in the file so that it will be easier to relate the code with.--On Fri, Aug 24, 2018 at 10:08 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote: Hi,Please find the attached patch for RM #1253 - Store and reload current location in treeviewFeature Details:- The current tree state will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- On window unload the current tree state will be saved.- On Reload, while opening the server, the stored path will be populated.- On closing the node the saved will be updated accordingly.- Jasmine test cases are included.Thanks,KhushbooThanks and Regards,Aditya ToshniwalSoftware Engineer | EnterpriseDB Software Solutions | Pune"Don't Complain about Heat, Plant a tree"Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
HiOn Tue, Aug 28, 2018 at 1:40 PM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Mon, Aug 27, 2018 at 1:19 PM, Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi KhushbooPatch looks good to me, following are my review comments:
- Logic doesn't work when we disconnect and re-connect to the database server. We have duplicated RM #1335.
I have saved the current state of the tree. so If I have disconnected the server, so that closed state will be considered for that server.If another server(s) is still connected and opened at some node, and then you reload the browser, on connecting/expanding the server it will populate the server nodes.@Dave,Do I need to change this behaviour?Per our Skype call, let's store and restore both the current tree state and the previous state of disconnected servers (as pgAdmin 3 did). So:- On browser open, the treeview is restored to the previous state, with databases reconnected as required.- On re-connect of a database, the sub-treeview for that database is restored to the state it was in prior to disconnection.Thanks!
- Instead of -1 we should use 0 to stop the tree saving functionality. Send request at 0 second doesn't make any sense.
- What if pgAdmin4 opens in two different browsers or two different tabs with different tree hierarchy in that case it will override the state of each other. (This could be an enhancement request).
--On Mon, Aug 27, 2018 at 11:09 AM, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:Hi Khushboo,Cheers, the patch looks good to me. I have few suggestions:1) Expand the tree -> Go to server properties and rename the server -> the tree closes. It should expand to last state. Same applies to other nodes which can be renamed.2) It would be nice if we can also save the last selected object. The tree expands but the last selected object is not selected.3) In /web/pgadmin/static/js/tree/pgadmin_tree_save_state.jsimport pgAdmin from '../../../static/js/pgadmin'; -- please use alias here rather than relative path.4) I would suggest to add 1 example/format JSON of tree state in comments in the file so that it will be easier to relate the code with.--On Fri, Aug 24, 2018 at 10:08 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached patch for RM #1253 - Store and reload current location in treeviewFeature Details:- The current tree state will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- On window unload the current tree state will be saved.- On Reload, while opening the server, the stored path will be populated.- On closing the node the saved will be updated accordingly.- Jasmine test cases are included.Thanks,KhushbooThanks and Regards,Aditya ToshniwalSoftware Engineer | EnterpriseDB Software Solutions | Pune"Don't Complain about Heat, Plant a tree"Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,Khushboo
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.
2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.
I think that covers the different cases I'm imagining.Thanks, Dave.
--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."
2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?
I think that covers the different cases I'm imagining.
Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).
2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?
I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.
Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?
I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.Will do.
Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.
Will do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?
Will do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.
{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Will do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.
Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
HiOn Mon, Oct 1, 2018 at 1:53 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.Looks reasonable to me.Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Hi,Please find the attached updated patch.
Thanks,KhushbooOn Mon, Oct 1, 2018 at 7:14 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Oct 1, 2018 at 1:53 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.Looks reasonable to me.Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
HiOn Thu, Oct 4, 2018 at 1:12 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.This seems to behave quite strangely - only sporadically saving the treeview state, and then not always (maybe ever?) restoring the selected node. When I watch the Python console, even with the save interval set to 1 second, I very rarely see the state being saved. For example:2018-10-04 15:14:01,341: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "GET /browser/database/children/1/1/44243 HTTP/1.1" 200 -2018-10-04 15:14:01,355: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:02,357: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:02] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:23,459: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:23] "GET /preferences/ HTTP/1.1" 200 -You can see there it called it twice, then 21 seconds later I opened the preferences panel to check what the interval was set to (it was still 1 second). Even as I type this some minutes later, it still hasn't called it again. I think it's essential that works reliably, as it's so unreliable to do it on Window close.
Thanks,KhushbooOn Mon, Oct 1, 2018 at 7:14 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Oct 1, 2018 at 1:53 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.Looks reasonable to me.Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Re: [pgAdmin4][Patch]: RM 1253 - Store and reload current location in treeview
On Thu, Oct 4, 2018 at 7:52 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Thu, Oct 4, 2018 at 1:12 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.This seems to behave quite strangely - only sporadically saving the treeview state, and then not always (maybe ever?) restoring the selected node. When I watch the Python console, even with the save interval set to 1 second, I very rarely see the state being saved. For example:2018-10-04 15:14:01,341: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "GET /browser/database/children/1/1/44243 HTTP/1.1" 200 -2018-10-04 15:14:01,355: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:02,357: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:02] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:23,459: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:23] "GET /preferences/ HTTP/1.1" 200 -You can see there it called it twice, then 21 seconds later I opened the preferences panel to check what the interval was set to (it was still 1 second). Even as I type this some minutes later, it still hasn't called it again. I think it's essential that works reliably, as it's so unreliable to do it on Window close.I have checked the previous state and the current state and if both are same then I skip the save call.Is this the case or even if you change the tree view state it is not saving?Thanks,KhushbooOn Mon, Oct 1, 2018 at 7:14 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Oct 1, 2018 at 1:53 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.Looks reasonable to me.Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Hi Dave,I found one issue with the selecting previous selected node which I was fixed and attached the updated patch.Please let me know if you find any specific scenario which is not covered.While testing the patch, please clear your sqlite entry from the setting table as we have changed the structure.Thanks,KhushbooOn Thu, Oct 4, 2018 at 8:07 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Thu, Oct 4, 2018 at 7:52 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Thu, Oct 4, 2018 at 1:12 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.This seems to behave quite strangely - only sporadically saving the treeview state, and then not always (maybe ever?) restoring the selected node. When I watch the Python console, even with the save interval set to 1 second, I very rarely see the state being saved. For example:2018-10-04 15:14:01,341: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "GET /browser/database/children/1/1/44243 HTTP/1.1" 200 -2018-10-04 15:14:01,355: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:01] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:02,357: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:02] "POST /settings/save_tree_state/ HTTP/1.1" 200 -2018-10-04 15:14:23,459: INFO werkzeug: 127.0.0.1 - - [04/Oct/2018 15:14:23] "GET /preferences/ HTTP/1.1" 200 -You can see there it called it twice, then 21 seconds later I opened the preferences panel to check what the interval was set to (it was still 1 second). Even as I type this some minutes later, it still hasn't called it again. I think it's essential that works reliably, as it's so unreliable to do it on Window close.I have checked the previous state and the current state and if both are same then I skip the save call.Is this the case or even if you change the tree view state it is not saving?Thanks,KhushbooOn Mon, Oct 1, 2018 at 7:14 PM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Oct 1, 2018 at 1:53 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi DaveOn Mon, Oct 1, 2018 at 4:02 PM Dave Page <dpage@pgadmin.org> wrote:On Mon, Oct 1, 2018 at 11:06 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:26 PM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:On Tue, Sep 25, 2018 at 6:17 PM Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 25, 2018 at 3:00 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi Dave,On Tue, Sep 25, 2018 at 12:15 AM Dave Page <dpage@pgadmin.org> wrote:HiOn Mon, Sep 24, 2018 at 2:05 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:Hi,Please find the attached updated patch.Feature Details:- The current tree state as well as the previous will be stored in the sqlite database.- The time interval to store the tree state is configurable via preferences and the default is 30 secs.-1 can be used to stop the tree saving functionality,- Jasmine test cases are included.Thanks,KhushbooThis is looking good, however there are a couple of cases where I think it's not quite working as I would expect:1) As soon as the user opens pgAdmin, the tree state should be restored.As per our initial discussion, we have decided that once the user connects / expands the server, then we will restore that server state."If the user has switched network that may cause a whole bunch of connection failures after some period of time. Perhaps we should only restore when opening a particular server."Yeah, I remember that now. I guess it just seems less than ideal - but I'm not sure how we could open everything by default without risking connection failures. Let's stick with the original plan (ie. what you've implemented).Okay.2) If a database or server is disconnected, I would expect it's state to be stored. When it is explicitly re-connected by the user, the state should be restored.This is already implemented and working. Am I missing any particular scenario?I tried disconnecting a server and database, and when I re-opened it, the state wasn't restored. Do we explicitly save the state on disconnect, or was it that I needed to wait up to 30 seconds (or should have waited 30 seconds before disconnecting)?I have explicitly saved the state on the server disconnection. So, on the reconnection of the server, the state should be restored.But this logic is only applicable on server not on the databases. So, once you disconnect the database the state will not be restored.Should I include databases also ?I think that covers the different cases I'm imagining.I wrote that to try to convince myself I hadn't forgotten anything - I think I had though. When the state is restored on any given branch of the tree, the previously selected node should be re-selected. That doesn't seem to be happening at the moment.This means even if I have opened multiple servers/databases, the selected item will remain only one.Is this correct?The selected item will be the previously selected item from whatever was just restored.Previously when the last selected node was not considered, I stored the data in the database as below:{
1:
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
]
}
Here key is the server_id i.e. 1 and all the paths are stored as above
Now, we are adding previously selected item as well as the database restore option, so I am thinking of changing the data storage structure as below.
{
1:
{
'paths':
[
“server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16400”,
"server_group/1,server/1,coll-database/1,database/16393,coll-schema/16393,schema/2200,coll-table/2200,table/16394,coll-column/16394”,
"server_group/1,server/1,coll-database/1,database/12669,coll-schema/12669,schema/2200,coll-table/2200,table/16397,coll-column/16397”
],
'selected' :
{
"server/1": "coll-database/1",
"database/16393": "table/16400",
"database/12669": "coll-column/16397"
},
'connection_status':
{
"database/16393": 1,
"database/12669": 0
}
}
}
Please review it and let me know your suggestion.Looks reasonable to me.Thanks,KhushbooWill do.Thanks!Thanks, Dave.Thanks,Khushboo--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company