Closed matthewberryman closed 6 years ago
I think cookies are the best solution here. https://github.com/voltace/browser-cookies looks like a suitable library browser side for this.
Or https://github.com/js-cookie/js-cookie (browser-cookies would require a build system that we don't have yet)
js-cookie already in use for the jwt stuff; could also use server side in lib/util.js for more efficient parsing of cookies.
seems to work Ok in dev on events page although the page is taking a bit longer to load than usual (perhaps just cache catching up with changes) - I will give this another look tomorrow, and once it's working in dev events page will roll it out to landing page and in master (prod) too. @LucieGueuning
@LucieGueuning reports this not working on log out and log in, but I cannot reproduce this. Lucie have you cleared your browser cache? The events page has a separate issue on page zoom & pan as the code for making the layers dynamic with the table is breaking the changes, which I will fix, and which may be what you are seeing.
Separately I wasn't storing the reports sublayers properly. Have that fixed locally, will deploy once I get this new code interacting properly with the dynamic missions and contacts updating.
@LucieGueuning I have implemented and tested this across all layers on landing page and events page (dev only at this point) and fixed the issues you were seeing plus for the issue I noticed on sublayers. Also if the user is a new user I go with the defaults we'd previously had for on/off and set those. By the time you wake up your browser should be fetching the new page instead of the cached version, if you have issues then try Ctrl-R (Windows) or Command-R (Mac) to get your browser to refresh the page from the server.
I tested it. Please find my feedback:
Update:
chrome://settings/cookies/detail?site=dev.msf-reach.org
into the address bar (for dev) or chrome://settings/cookies/detail?site=msf-reach.org
(for prod) and remove all the cookies—just noting that will also force a logout so you will have to login and then you will see the starting defaults.Great. working well on Google Chrome. Not working on Internet Explorer. We only have the hazards on the legend, no contacts nor mission history layers, neither current event.
I will share the concrete progress on front-end to Natasha in terms of legend, once it is done.
IE support is a separate issue https://github.com/MSFREACH/msf-reach/issues/224
You can keep non-MSF contacts (as per spreadsheet) on by default please.
Everything on and people will manage their preferences by themselves.
Although this has been done a while and working well through testing for the custom layers we're adding (reports, contacts, missions, events, hazards) it's not saving the selected underlying map title layer, which will become more important with #255, so re-opening this issue to deal with saving of the map layer.
@LucieGueuning with regards to the new code for saving map layers (in addition to previous layers already done), note that the behaviour for map layer is to use the same one for both landing and events maps (leaving terrain as the default for new reports and new contacts, neither of which have the OSM layer, though I can change all of this if required).
Can each operator decide on which default layers are present on the landing page? Personally, I only want the hazards layers (PDC, GDACS, etc.). Even if I select only the hazards layers, every time I move away from the landing page and go back, all the layers are back.