Skip to content

[Create WS] Various fixes #17135

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

Merged
merged 3 commits into from
Apr 11, 2023
Merged

[Create WS] Various fixes #17135

merged 3 commits into from
Apr 11, 2023

Conversation

svenefftinge
Copy link
Contributor

@svenefftinge svenefftinge commented Apr 5, 2023

Description

Several smaller improvements to the create workspace page

  • apply the same preprocessing of the given contextURL for resolving a workspace context that is applied when creating a workspace.
  • handle referrer prefix URLs, so that the workspace starts immediately
  • ensure createWorkspace is not called multiple times
  • checks and displays directly if a workspace on the same revision is already running

Screenshot 2023-04-06 at 11 55 43

cc @gtsiolis

Related Issue(s)

Fixes https://linear.app/gitpod/issue/WEB-68/startworkspacewithoptions-invalid-url-error-on-missing-scheme
Fixes https://linear.app/gitpod/issue/WEB-81/context-urls-with-referrer-dont-show-modal
Fixes https://linear.app/gitpod/issue/WEB-73/[new-workspace-page]-dont-start-more-than-one-workspace-with-enter

How to test

Release Notes

NONE

Documentation

Build Options:

  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish Options
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer Options
  • with-dedicated-emulation
  • with-ws-manager-mk2
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated

Preview Environment Options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh

- respect referrer context
- useWorkspaceContext returns null instead of being disabled
when contextUrl is undefined
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-create-ws-page.1 because the annotations in the pull request description changed
(with .werft/ from main)

@roboquat roboquat added the size/M label Apr 5, 2023
@svenefftinge svenefftinge marked this pull request as ready for review April 5, 2023 10:10
@svenefftinge svenefftinge requested a review from a team April 5, 2023 10:10
@svenefftinge svenefftinge requested a review from gtsiolis as a code owner April 5, 2023 10:10
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Apr 5, 2023
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-create-ws-page.2 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-create-ws-page.3 because the annotations in the pull request description changed
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-se-create-ws-page.4 because the annotations in the pull request description changed
(with .werft/ from main)

@@ -3669,6 +3669,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
async getIDToken(): Promise<void> {}
public async resolveContext(ctx: TraceContextWithSpan, contextUrl: string): Promise<WorkspaceContext> {
const user = this.checkAndBlockUser("resolveContext");
return this.contextParser.handle(ctx, user, contextUrl);
const normalizedCtxURL = this.contextParser.normalizeContextURL(contextUrl);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a time when you wouldn't want to normalize? And if no, can we move the normalization inside the contextParser.handle method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are places where we don't do the normalization, which is when contexts are created based on git hoster events, where we don't need to be fuzzy around the allowed input. It would probably not harm to call the normalization in those cases as well, but I would like to avoid changing the implementation of contextParser with this PR. It's a bit complex and I don't see enough value in the proposed change.

@roboquat roboquat added size/L and removed size/M labels Apr 6, 2023
@gtsiolis
Copy link
Contributor

gtsiolis commented Apr 6, 2023

Looking at this now! 👀

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Took a quick look, but I couldn't open any workspace. Getting the following error.

Screenshot 2023-04-06 at 20 12 21

I'll see how we can improve the parallel workspaces listing, too.

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Took another look at this and added some UX suggestions for the overall approach and copy.

Thanks for adding this, @svenefftinge. 🌊 🌊

Approving to unblock but holding to let someone take a closer look at the code changes and possibly update the UX.

/hold

@@ -214,6 +257,24 @@ export function CreateWorkspacePage() {
{isLoading ? "Loading ..." : isStarting ? "Creating Workspace ..." : "New Workspace"}
</Button>
</div>
{existingWorkspaces.length > 0 && (
<div className="w-full flex flex-col justify-end px-6">
<p className="mt-6 text-center text-base">Running workspaces on this revision</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

question: If it's not too much trouble and we want to add this in the scope of this PR, it could be helpful to be specific about the number of similar workspaces.

// BEFORE
Running workspaces on this branch

// AFTER
3 running workspaces on this branch

@@ -214,6 +257,24 @@ export function CreateWorkspacePage() {
{isLoading ? "Loading ..." : isStarting ? "Creating Workspace ..." : "New Workspace"}
</Button>
</div>
{existingWorkspaces.length > 0 && (
<div className="w-full flex flex-col justify-end px-6">
<p className="mt-6 text-center text-base">Running workspaces on this revision</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Definitely out of the scope of this PR, but I wonder if including also stopped workspaces could make sense here. If a user has a stopped workspace on the same branch (revision), does it make sense to also include it here?

@@ -214,6 +257,24 @@ export function CreateWorkspacePage() {
{isLoading ? "Loading ..." : isStarting ? "Creating Workspace ..." : "New Workspace"}
</Button>
</div>
{existingWorkspaces.length > 0 && (
<div className="w-full flex flex-col justify-end px-6">
<p className="mt-6 text-center text-base">Running workspaces on this revision</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: I can't skip saying how good this addition generally feels. ✨

@@ -214,6 +257,24 @@ export function CreateWorkspacePage() {
{isLoading ? "Loading ..." : isStarting ? "Creating Workspace ..." : "New Workspace"}
</Button>
</div>
{existingWorkspaces.length > 0 && (
<div className="w-full flex flex-col justify-end px-6">
<p className="mt-6 text-center text-base">Running workspaces on this revision</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I couldn't hold from thinking how this list could be better visualized. What do you think of collapsing the list inside a dropdown?

For running workspaces, I guess this won't be usually more than 2 or 3, but there could be edge cases where this could break the UI by overflowing the height of this feature. Additionally, replacing the primary action button with a block button is something that looks needed here.

BEFORE AFTER
Welcome Welcome-1

Comment on lines +266 to +272
<a
key={w.workspace.id}
href={w.latestInstance?.ideUrl || `/start/${w.workspace.id}}`}
className="rounded-xl group hover:bg-gray-100 dark:hover:bg-gray-800 flex"
>
<WorkspaceEntry info={w} shortVersion={true} />
</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: If we follow the dropdown approach, here's how this could look like:

🅰️ 🅱️
Welcome-1 Welcome

Copy link
Contributor

@selfcontained selfcontained left a comment

Choose a reason for hiding this comment

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

Nice improvements 😄 - Tested out the different additions and they all feel good to me and are doing what's described.

@marcelosousa
Copy link

/reviewpad summarize

@reviewpad
Copy link

reviewpad bot commented Apr 10, 2023

See this Slack (internal) thread for context. (edited by @axonasif)


AI-Generated Summary: This pull request consists of 3 patches:

  1. [server] normalize contextURL: This patch updates the gitpod-server-impl.ts to normalize the context URL before passing it to the handle method in the contextParser.
  2. [create workspace] only create one workspace: This patch updates the resolve-context-query.ts and CreateWorkspacePage.tsx files to respect the referrer context and only create one workspace. It also modifies the behavior when the context URL is undefined by returning null instead of throwing an error.
  3. [dashboard] immediately show running workspaces: This patch updates the dashboard's CreateWorkspacePage.tsx, WorkspaceEntry.tsx, gitpod-service.ts, and gitpod-server-impl.ts files to immediately show running workspaces. It also removes the existing ExistingWorkspaceModal component as it is no longer needed.

@svenefftinge
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit d91fbff into main Apr 11, 2023
@roboquat roboquat deleted the se/create-ws-page branch April 11, 2023 08:07
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/L team: webapp Issue belongs to the WebApp team
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

6 participants