Skip to content

Add the Browser Terminal as an IDE #17196

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 13 commits into from
Apr 24, 2023
Merged

Add the Browser Terminal as an IDE #17196

merged 13 commits into from
Apr 24, 2023

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Apr 12, 2023

Description

Adds Xterm.js as a web alternative to connecting to your workspace via SSH from your terminal. The code can be found at https://github.com/gitpod-io/xterm-web-ide and the Docker image is at ide/xterm-web.

Note: The original PR is at #8464, but it was merged incorrectly.

Note: this relies on #17240 being merged first

Preview environment 🌐: https://ide-browser-terminal.preview.gitpod-dev.com/workspaces

How to test

  1. Open the preview environment
  2. In the preferences, notice there is no Xterm IDE
  3. In Configcat, include yourself in the enable-rule for experimentalIdes (non-prod)
  4. Wait a couple of minutes (🫖 time)
  5. Reload and see the Terminal IDE magically appear
  6. Create a workspace and have a blast

Useful commands

Re-pull the IDE:

kubectl rollout restart deployment/ide-service

Current limitations

  • Does not work on mobile [fixed]

    iPad demo
    RPReplay_Final1679590301.mp4

Release Notes

NONE

⬆️ we can mention it after we finish the internal dog food

Documentation

Todo

  • gp stop closes xterm.js editor and shows the "Workspace Stopping" screen
  • gp open works
  • gp preview works
  • Ensure heartbreating works
  • Move Docker image from DockerHub to our GCP registry

Nice-to-haves

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

@filiptronicek
Copy link
Member Author

filiptronicek commented Apr 14, 2023

/gh run recreate-vm

Comment triggered a workflow run

Started workflow run: 4701100147

  • recreate_vm: true

@filiptronicek filiptronicek self-assigned this Apr 14, 2023
@filiptronicek filiptronicek mentioned this pull request Apr 14, 2023
20 tasks
@filiptronicek filiptronicek marked this pull request as ready for review April 14, 2023 20:30
@filiptronicek filiptronicek requested review from a team April 14, 2023 20:30
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Apr 14, 2023
@@ -51,6 +52,9 @@ func ParseConfig(ctx context.Context, b []byte) (*config.IDEConfig, error) {
return nil, err
}

configCatClient := experiments.NewClient()
experimentalIdesEnabled := configCatClient.GetBoolValue(ctx, "experimentalIdes", false, experiments.Attributes{})
Copy link
Member

Choose a reason for hiding this comment

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

Should not it be per a user? 🤔 otherwise it either enables for all or none?

Copy link
Member Author

@filiptronicek filiptronicek Apr 14, 2023

Choose a reason for hiding this comment

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

It should, do you know where we can get the user data info from?

Copy link
Member

Choose a reason for hiding this comment

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

It should be done in getConfig then, i.e. provide user id and email similar to resolveWorkspaceConfig.

@filiptronicek
Copy link
Member Author

/hold since we need #17240 merged first.

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.

Added my email on the feature flag but still not seeing the editor in /new or /preferences. 🫖

@gtsiolis
Copy link
Contributor

Cross-posting for visibility a review comment from the original PR in #8464 (review):

thought: Overall, UX LGTM and following the flow we're using with other editor options.

suggestion: Also, since this option only supports one terminal, this seems more closely related to the connection with Command Line feature. Cc @loujaybee

  • This means users who would be interested in this will probably be interested in either using 🅰️ their local terminal or 🅱️ the browser xterm.
  • Maybe it's worth toning down this a bit and merging with the Command Line feature, strengthening the SSH functionality.
    • This would make SSH a primary option as an editor and when the workspace is loaded the user could have the option to copy the access token or SSH key to connect with their local terminal or fallback to opening a terminal in the browser.
    • We could also make it pop up as a smaller browser window which is the most common approach for such cases to emulate a terminal UX for users using the command line in browser.

@filiptronicek
Copy link
Member Author

Hello @gtsiolis, could you please look at #17240 first? There are still a couple of things we need to figure out here after that one gets merged.

@filiptronicek
Copy link
Member Author

@gtsiolis may I ask you to give this another go 🙏? I just tried and it seems to work 👀

@@ -16,7 +16,7 @@ export function load(): Promise<{
frame.src = startUrl.toString();
frame.style.visibility = "visible";
frame.className = "gitpod-frame loading";
document.body.appendChild(frame);
document.body.prepend(frame);
Copy link
Member Author

Choose a reason for hiding this comment

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

This solves a bug in which in Safari, the loading screen would not be hidden when the IDE loaded. It wasn't present in VS Code, because we actually append the IDE itself lazily, but for Xterm and potentially other web IDEs we might have a static HTML structure ready.

@@ -195,6 +196,18 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {
ImageLayers: []string{jbPluginImage, jbLauncherImage},
LatestImageLayers: []string{jbPluginLatestImage, jbLauncherImage},
},
xterm: {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we add the IDE to the IDE list. Currently, latest is the same as stable, since there are no proper versions yet.

@filiptronicek
Copy link
Member Author

filiptronicek commented Apr 20, 2023

/gh run recreate-vm

Comment triggered a workflow run

Started workflow run: 4756788264

  • recreate_vm: true

@mbrevoort
Copy link
Contributor

@gtsiolis in what ways would popping up in a separate smaller window be better?

@roboquat roboquat added size/L and removed size/M labels Apr 22, 2023
Never mutate `s.ideConfig` itself and make an in-memory copy of it to not use it every time.
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

code-wise looks good, but I did not test

/hold

@filiptronicek
Copy link
Member Author

Just tested the feature flag and it seems to work again

No feature flag Part of the feature flag
image image

@roboquat roboquat merged commit 83e56d5 into main Apr 24, 2023
@roboquat roboquat deleted the ide/browser-terminal branch April 24, 2023 11:42
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed: IDE IDE change is running in production deployed Change is completely running in production labels May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: IDE IDE change is running in production deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/L team: IDE team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants