Open brianmcmichael opened 6 years ago
This has been cleaned up quite a bit and uses the json string described at https://github.com/OSC/ood-fileexplorer/issues/166#issuecomment-348974279
Also fixes https://github.com/OSC/ood-fileexplorer/issues/173
To test, follow the directions described in the top comment.
@brianmcmichael I set @nickjer as a reviewer. Do you still have qualms about this approach, like you mentioned in https://github.com/OSC/ood-fileexplorer/issues/166. Jeremy asked if we could just use query param and try to ensure that every link in the app itself has the query param added. One possibility would be to handle the event that bubbles up when a link is activated so that this link can be modified i.e. to add the query param if it already exists.
You already did a lot of work on this implementation though, at my request. So I'll leave it to you two to decide if this the current approach is safe and reliable, considering multiple browsers, including IE11, or if an alternative just using query params is also do-able.
This is all working pretty well. I had resolved my concerns by storing the data in a json format rather than as a string, with error handling in case it's not parseable.
Also have you explored https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
I am probably doing something wrong. I followed your test directions above but I only see Home in my tree root. Should I also delete my node_modules
directory?
Update: Nevermind, I was using the wrong query param.
If I go to:
https://ondemand-dev.osc.edu/pun/sys/files/fs/etc/httpd/conf.d/?treeroot=/users/appl/jnicklas
I get this...
Hmm. So it's working for me. I'm wondering if you've got some old javascript files cached somewhere.
From reading it, sessionStorage looks like the right tool for the job. If that’s not currently being used for persistence maybe we can switch to that, while using the same payload that already works?
Discovered a couple more issues:
Allows for the changing of the root of the file tree when a
treeroot
query parameter is set.This mechanism:
1) Grabs the query param from the URL if present 2) Sets an environment variable on the process to the URL 3) Renders the process variable into a javascript variable on the client html 4) An onload function on the client side checks for the presence of the variable, and if present 5) sets the
window.name
to the path 6) After the variable is rendered into the client html once, the process variable is wiped to prevent future windows from adopting the nameAll-in-all, I'm not happy with this solution, as it seems quite serpentine in the way the data transfers around the app. It also the seems to be fairly brittle in it's reliance on "window.name", which could be set by the client browser elsewhere. I'm not sure of another way that we would be able to persist the custom setting across reloads, but not across browser tabs, however.
To test this, you'll need to
treeroot
branch ofood-fileexplorer
,npm-shrinkwrap.json
,package.json
dependency to"cloudcmd": "git://github.com/OSC/cloudcmd.git#roottree",
npm i