-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[layout restoration] Store per location #904
Comments
Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
Humm this will be a problem with an implementation I know in which the container port is dynamic but is the same container. So when reconnecting to the same container after some time, the port will change and thus it will appear as the same workspace :( Could we instead use some kind of token that the backend would provide? |
Had to revert the commit, due to #943 |
I noticed this recently: In an internal tool that serves Theia containers, a reverse proxy is used, that "hides" the port number being used, for a given container. Then the user connects to a specific instance using a path instead of a port number. e.g. :
In this situation, the "origin", as used to save the layout info into "Local Storage" is @svenefftinge a slight modification to your reverted PR seems to work in this case, as well as on Electron: instead of adding |
I think that just like @hexa00 said, using a token could allow us to identify a particular instance, without worrying much about path changes. What about looking for some kind of Maybe make Theia look for this on backend boot up ? |
@marechal-p this sounds like a nice way to do it. Then we would need to use that id as part of the key, when we save/restore the workbench layout in/from Local Storage. |
I think that the unique id should uniquely identify the workspace, not a Theia installation or instance. Opening two different workspaces with the same Theia instance or installation should result in two different local data sets. Opening the same workspace using two different Theia instances or installations should result in accessing the same local data set. From that point of view, I think that when it starts, Theia should read that unique id from a file in the workspace (let's say What I am not sure is whether the www path or the filesystem path of the workspace should go into that key or not. If I move my workspace directory and open it again (at the new location), I'd like if we kept the same local data. However, if I copy my workspace and open it separately (so to have two working copies of the same code), they should be considered as two different workspaces. And since I copied everything, including |
I think that ATM we save absolute paths of files, for example to be able to re-create open editors. If we want the above to work, we will need to save the workspace-relative path instead or interpret the paths according to the workpace. |
I think all this is highly depending on how Theia is used (i.e. how the workspace server works). |
@svenefftinge I tend to agree, that we can keep this as simple as possible. So we will consider doing an internal customization if we want to do something custom for our use case. With the current master, I think we are very close to have a recipe that makes this work for all basic cases above. The "Path without port" case is still problematic. Do you see cases where adding the path to the key would break the mechanism? e.g., based on your previous, reverted, PR (this version doesn't break vanilla Electron Theia, since the randomly generated port is not added to the key): |
Because Theia is both meant to roll on a local machine and in the cloud, this commit adds better browser localstorage keys, so that Theia gets less confused as to what is being displayed in case that some URI points to different remotes (reverse proxying the same URL -at different times- to different theia instances). This ensures that despite sharing the same local storage domain (host:port), multiple Theias won't mix up their data, unless you move the `~/.theia/instance.id` file around. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
I think excluding the port is actually also very specific to your workspace server. |
Use case:
In this scenario, using We were talking about using an environment variable to override the URL path in case the URL is irrelevant (in case users use reverse proxying again, a valid use case for a service hosted in the cloud). Basically: if (envWorkspace) {
prefix = `${envWorkspace}:${onDiskProjectPath}`;
} else {
prefix = `${window.location.pathname}:${onDiskProjectPath}`;
} Using Would this be generic enough to support both edit: we could also use cli params instead of an environment variable, but this would allow us to identify remote instances behind the same proxy, based on the server's way of managing theia. |
Because Theia is both meant to roll on a local machine and in the cloud, this commit adds better browser localstorage keys, so that Theia gets less confused as to what is being displayed in case that some URI points to different remotes (reverse proxying the same URL -at different times- to different theia instances). This ensures that despite sharing the same local storage domain (host:port), multiple theias can be differentiated by passing a `--domain` argument. This means that we can identify different theias behind proxies, as long as the instances are run with a different `--domain <id>`. When this domain is not specified, then theia will use `window.location.pathname`. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Because Theia is both meant to roll on a local machine and in the cloud, this commit adds better browser localstorage keys, so that Theia gets less confused as to what is being displayed in case that some URI points to different remotes (reverse proxying the same URL -at different times- to different theia instances). This ensures that despite sharing the same local storage domain (host:port), multiple theias can be differentiated by passing a `--domain` argument. This means that we can identify different theias behind proxies, as long as the instances are run with a different `--domain <id>`. When this domain is not specified, then theia will use `window.location.pathname`. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Yes, but that is the responsibility of the workspace server. At TypeFox, for instance, we use subdomains with a workspaceid. In your case it is pathes. We have an abstraction in place that can be implemented to your needs. There is no need to introduce the notion of a workspace id or 'domain'. Just solve it for your scenario and keep the generic solution a good but simple 80% case. |
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Just in case I made a parallel branch with the change adding some kind of "identification" for the case where theia would be behind a proxy. In this case, the proxy can move the container access point any way possible (because it could change the project name or container name or anything). In this case the admins can just specify an master...marechal-p:mp/issue-904b But if you still feel like this is not a valid issue then I'm fine with the current open PR about this. |
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
Adds the current `window.location.pathname` in the key used to store data into the local storage. This fixes an issue where multiple theia behind a proxy would share the same local storage domain. Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
@svenefftinge @marechal-p Could it be closed? |
Currently, we only store per host and workspace. As a result theia tries to restore the layout whenever those two match. When starting different workspaces in the same container those two informations are always the same although the content is not. To distinguish the location (URL) needs to be taken into account, too.
The text was updated successfully, but these errors were encountered: