Skip to content
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

chore: browser database name should contain a valid DevWorkspace identifier #273

Merged
merged 5 commits into from
Sep 14, 2023

Conversation

vitaliy-guliy
Copy link
Contributor

What does this PR do?

Uses a real workspace identifier taken from env.DEVWORKSPACE_ID to form the name of browser-based database.

What issues does this PR fix?

eclipse-che/che#22338

How to test this PR?

$ export | grep DEVWORKSPACE_ID
  • [1] ensure there is a database containing the ID at the end

  • go to the dasboard, delete workspace, create a workspace using the same URI

  • [2] check the workspace ID and check, that there is another database with this ID has been created

Browse URL must be the same for both workspaces.

Screenshot from 2023-09-08 11-06-41

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Click here to review and test in web IDE: Contribute

@vitaliy-guliy vitaliy-guliy changed the title chore: browser database should contain a valid DevWorkspace identifier chore: browser database name should contain a valid DevWorkspace identifier Sep 8, 2023
@github-actions
Copy link

github-actions bot commented Sep 8, 2023

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@vitaliy-guliy vitaliy-guliy marked this pull request as ready for review September 11, 2023 10:22
@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

3 similar comments
@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

@@ -30,5 +31,5 @@ export function getSingleFolderWorkspaceIdentifier(folderUri: URI): ISingleFolde
}

function getWorkspaceId(uri: URI): string {
return hash(window.location.href + uri.toString()).toString(16);
return getDevWorkspceId() || hash(uri.toString()).toString(16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that using only DevWorkspaceID as a VS Code's Workspace ID will bring another problem.

Let's consider the situation when the user has a DevWorkspace with the Che-Code sources cloned, but she wants to open just a subfolder, e.g.: launcher. In such a case, these two different VS Code Workspaces (che-code and che-code/launcher) will share the same IndexedDB. This means the user will get the same stored state of VS Code (panels layout, opened files, etc.) in both workspaces which is not expected, probably.
WDYT @vitaliy-guliy ?

If we decide we should avoid such a situation I suggest generating a hash value from the DevWorkspace ID as well: hash(getDevWorkspceId() + uri.toString()).toString(16)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in this case we will definitely have the unique ID 😀

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

@vitaliy-guliy vitaliy-guliy merged commit 5db8fd3 into main Sep 14, 2023
1 of 2 checks passed
@vitaliy-guliy vitaliy-guliy deleted the vscode-web-state-db-identifier branch September 14, 2023 09:42
@devstudio-release
Copy link

Build 3.10 :: code_3.x/853: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: code_3.x/852: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: code_3.x/853: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4546 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: code_3.x/852: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4547 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: copyIIBsToQuay/1866: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: sync-to-downstream_3.x/4549: SUCCESS

Build container: devspaces-operator-bundle synced; /DS_CI/get-sources-rhpkg-container-build_3.x/4342 triggered; /job/DS_CI/job/dsc_3.x triggered;

@devstudio-release
Copy link

Build 3.10 :: operator-bundle_3.x/2028: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4549 triggered

@devstudio-release
Copy link

Build 3.10 :: dsc_3.x/1334: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: update-digests_3.x/4228: SUCCESS

Detected new images: rebuild operator-bundle
* code; /DS_CI/operator-bundle_3.x/2028 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: update-digests_3.x/4229: UNSTABLE

No new images detected: nothing to do!

@devstudio-release
Copy link

Build 3.10 :: copyIIBsToQuay/1866: SUCCESS

3.10
arches = x86_64, s390x, ppc64le;
  * LATEST DS OPERATOR BUNDLE = <a href=https://quay.io/repository/devspaces/devspaces-operator-bundle?tab=tags>registry-proxy.engineering.redhat.com/rh-osbs/devspaces-operator-bundle:3.10-13
  * LATEST DWO OPERATOR BUNDLE = <a href=https://quay.io/repository/devworkspace/devworkspace-operator-bundle?tab=tags>registry-proxy.engineering.redhat.com/rh-osbs/devworkspace-operator-bundle:0.21-7
+ s390x-rhel8 IIB(s) copied:
  + quay.io/devspaces/iib:3.10-v4.14-575325-533291-s390x
  + quay.io/devspaces/iib:3.10-v4.14-s390x
  + quay.io/devspaces/iib:next-v4.14-s390x
  + quay.io/devspaces/iib:3.10-v4.13-575281-533286-s390x
  + quay.io/devspaces/iib:3.10-v4.13-s390x
  + quay.io/devspaces/iib:next-v4.13-s390x
  + quay.io/devspaces/iib:3.10-v4.12-575220-533281-s390x
  + quay.io/devspaces/iib:3.10-v4.11-575213-533277-s390x
+ ppc64le-rhel8 IIB(s) copied:
  + quay.io/devspaces/iib:3.10-v4.14-575325-533291-ppc64le
  + quay.io/devspaces/iib:3.10-v4.14-ppc64le
  + quay.io/devspaces/iib:next-v4.14-ppc64le
  + quay.io/devspaces/iib:3.10-v4.13-575281-533286-ppc64le
  + quay.io/devspaces/iib:3.10-v4.13-ppc64le
  + quay.io/devspaces/iib:next-v4.13-ppc64le
  + quay.io/devspaces/iib:3.10-v4.12-575220-533281-ppc64le
  + quay.io/devspaces/iib:3.10-v4.12-ppc64le
  + quay.io/devspaces/iib:next-v4.12-ppc64le
  + quay.io/devspaces/iib:3.10-v4.11-575213-533277-ppc64le
  + quay.io/devspaces/iib:3.10-v4.11-ppc64le
  + quay.io/devspaces/iib:next-v4.11-ppc64le
+ x86_64-rhel8 IIB(s) copied:
  + quay.io/devspaces/iib:3.10-v4.14-575325-533291-x86_64
  + quay.io/devspaces/iib:3.10-v4.14-x86_64
  + quay.io/devspaces/iib:next-v4.14-x86_64
  + quay.io/devspaces/iib:3.10-v4.13-575281-533286-x86_64
  + quay.io/devspaces/iib:3.10-v4.12-575220-533281-x86_64
  + quay.io/devspaces/iib:3.10-v4.11-575213-533277-x86_64

@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

1 similar comment
@github-actions
Copy link

Pull Request images published ✨
image: quay.io/che-incubator-pull-requests/che-code:pr-273-amd64
Dev image: quay.io/che-incubator-pull-requests/che-code-dev:pr-273-dev-amd64

vitaliy-guliy added a commit that referenced this pull request Sep 20, 2023
…tifier (#273)

* feat: use DevWorkspace ID to form browser database identifier

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
vitaliy-guliy added a commit that referenced this pull request Sep 21, 2023
…fier (#273) (#274)

* fix: use DevWorkspace ID to form browser database identifier

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@RomanNikitenko RomanNikitenko mentioned this pull request Oct 4, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants