Skip to content

Add xterm as an IDE #8464

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 7 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions components/dashboard/src/components/SelectIDEComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
*/

import { IDEOption, IDEOptions } from "@gitpod/gitpod-protocol/lib/ide-protocol";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useContext, useEffect, useState } from "react";
import { getGitpodService } from "../service/service";
import { DropDown2, DropDown2Element } from "./DropDown2";
import Editor from "../icons/Editor.svg";
import { FeatureFlagContext } from "../contexts/FeatureFlagContext";

interface SelectIDEComponentProps {
selectedIdeOption?: string;
Expand All @@ -17,8 +18,16 @@ interface SelectIDEComponentProps {
setError?: (error?: string) => void;
}

function filteredIdeOptions(ideOptions: IDEOptions, experimentalTurnedOn: boolean) {
return IDEOptions.asArray(ideOptions)
.filter((x) => !x.hidden)
.filter((x) => (x.experimental ? experimentalTurnedOn : true));
}

export default function SelectIDEComponent(props: SelectIDEComponentProps) {
const [ideOptions, setIdeOptions] = useState<IDEOptions>();
const { experimentalIdes } = useContext(FeatureFlagContext);

useEffect(() => {
getGitpodService().server.getIDEOptions().then(setIdeOptions);
}, []);
Expand All @@ -27,7 +36,7 @@ export default function SelectIDEComponent(props: SelectIDEComponentProps) {
if (!ideOptions) {
return [];
}
const options = IDEOptions.asArray(ideOptions);
const options = filteredIdeOptions(ideOptions, experimentalIdes);
const result: DropDown2Element[] = [];
for (const ide of options.filter((ide) =>
`${ide.label}${ide.title}${ide.notes}${ide.id}`.toLowerCase().includes(search.toLowerCase()),
Expand Down
5 changes: 5 additions & 0 deletions components/dashboard/src/contexts/FeatureFlagContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const defaultFeatureFlags = {
orgGitAuthProviders: false,
switchToPAYG: false,
newSignupFlow: false,
experimentalIdes: false,
};

const FeatureFlagContext = createContext<FeatureFlagsType>(defaultFeatureFlags);
Expand All @@ -48,6 +49,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
const [orgGitAuthProviders, setOrgGitAuthProviders] = useState<boolean>(false);
const [switchToPAYG, setSwitchToPAYG] = useState<boolean>(false);
const [newSignupFlow, setNewSignupFlow] = useState<boolean>(false);
const [experimentalIdes, setExperimentalIdes] = useState<boolean>(false);

useEffect(() => {
if (!user) return;
Expand All @@ -66,6 +68,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
orgGitAuthProviders: { defaultValue: false, setter: setOrgGitAuthProviders },
switchToPAYG: { defaultValue: false, setter: setSwitchToPAYG },
newSignupFlow: { defaultValue: false, setter: setNewSignupFlow },
experimentalIdes: { defaultValue: false, setter: setExperimentalIdes },
};

for (const [flagName, config] of Object.entries(featureFlags)) {
Expand Down Expand Up @@ -114,6 +117,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
orgGitAuthProviders,
newSignupFlow,
switchToPAYG,
experimentalIdes,
};
}, [
enablePersonalAccessTokens,
Expand All @@ -126,6 +130,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
startWithOptions,
switchToPAYG,
usePublicApiWorkspacesService,
experimentalIdes,
]);

return <FeatureFlagContext.Provider value={flags}>{children}</FeatureFlagContext.Provider>;
Expand Down
5 changes: 5 additions & 0 deletions components/gitpod-protocol/src/ide-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export interface IDEOption {
*/
hidden?: boolean;

/**
* If `true` this IDE option is conditionally shown in the IDE preferences
*/
experimental?: boolean;

/**
* The image ref to the IDE image.
*/
Expand Down
4 changes: 4 additions & 0 deletions components/ide-proxy/static/image/ide-logo/terminal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions components/ide-service-api/go/config/ideconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type IDEOption struct {
Notes []string `json:"notes,omitempty"`
// Hidden this IDE option is not visible in the IDE preferences.
Hidden bool `json:"hidden,omitempty"`
// Experimental this IDE option is to only be shown to some users
Experimental bool `json:"experimental,omitempty"`
// Image ref to the IDE image.
Image string `json:"image"`
// LatestImage ref to the IDE image, this image ref always resolve to digest.
Expand Down
2 changes: 1 addition & 1 deletion components/supervisor/frontend/src/shared/loading-frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

frame.onload = () => {
const frontendDashboardServiceClient = new FrontendDashboardServiceClient(frame.contentWindow!);
Expand Down
4 changes: 4 additions & 0 deletions install/installer/pkg/components/blobserve/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
PrePull: []string{},
Workdir: "/.supervisor/frontend",
},
ctx.RepoName(ctx.Config.Repository, ide.XtermIDEImage): {
PrePull: []string{},
Workdir: "/ide",
},
},
BlobSpace: blobserve_config.BlobSpace{
Location: "/mnt/cache/blobserve",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {
webstorm := "webstorm"
rider := "rider"
clion := "clion"
xterm := "xterm"

resolveLatestImage := func(name string, tag string, bundledLatest versions.Versioned) string {
resolveLatest := true
Expand Down Expand Up @@ -195,6 +196,16 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {
ImageLayers: []string{jbPluginImage, jbLauncherImage},
LatestImageLayers: []string{jbPluginLatestImage, jbLauncherImage},
},
xterm: {
OrderKey: "12",
Title: "Terminal",
Type: ide_config.IDETypeBrowser,
Logo: getIdeLogoPath("terminal"),
Label: "Insiders",
Image: ctx.ImageName(ctx.Config.Repository, ide.XtermIDEImage, "latest"),
ResolveImageDigest: true,
Experimental: true,
},
},
DefaultIde: "code",
DefaultDesktopIde: codeDesktop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
CodeWebExtensionVersion = "commit-3b076b91039c47404d98c4a3198edf2982e24af7" // gitpod-web extension version comes from https://github.com/gitpod-io/gitpod-code
CodeDesktopIDEImage = "ide/code-desktop"
CodeDesktopInsidersIDEImage = "ide/code-desktop-insiders"
XtermIDEImage = "ide/xterm-web"
IntelliJDesktopIDEImage = "ide/intellij"
GoLandDesktopIdeImage = "ide/goland"
PyCharmDesktopIdeImage = "ide/pycharm"
Expand Down