Skip to content

Commit f2a98ec

Browse files
Add xterm as an IDE (#8464)
* Add xterm as an IDE * Move the IDE to our GCP registry 🎉 * Also resolve the source code commit for IDEs in `ide-service` * Add feature flag * Xterm => terminal * Revert "Also resolve the source code commit for IDEs in `ide-service`" This reverts commit 06aee00. * always add `<iframe>` to the top of `<body>`
1 parent a1c6ade commit f2a98ec

File tree

9 files changed

+44
-3
lines changed

9 files changed

+44
-3
lines changed

components/dashboard/src/components/SelectIDEComponent.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
*/
66

77
import { IDEOption, IDEOptions } from "@gitpod/gitpod-protocol/lib/ide-protocol";
8-
import { useCallback, useEffect, useState } from "react";
8+
import { useCallback, useContext, useEffect, useState } from "react";
99
import { getGitpodService } from "../service/service";
1010
import { DropDown2, DropDown2Element } from "./DropDown2";
1111
import Editor from "../icons/Editor.svg";
12+
import { FeatureFlagContext } from "../contexts/FeatureFlagContext";
1213

1314
interface SelectIDEComponentProps {
1415
selectedIdeOption?: string;
@@ -17,8 +18,16 @@ interface SelectIDEComponentProps {
1718
setError?: (error?: string) => void;
1819
}
1920

21+
function filteredIdeOptions(ideOptions: IDEOptions, experimentalTurnedOn: boolean) {
22+
return IDEOptions.asArray(ideOptions)
23+
.filter((x) => !x.hidden)
24+
.filter((x) => (x.experimental ? experimentalTurnedOn : true));
25+
}
26+
2027
export default function SelectIDEComponent(props: SelectIDEComponentProps) {
2128
const [ideOptions, setIdeOptions] = useState<IDEOptions>();
29+
const { experimentalIdes } = useContext(FeatureFlagContext);
30+
2231
useEffect(() => {
2332
getGitpodService().server.getIDEOptions().then(setIdeOptions);
2433
}, []);
@@ -27,7 +36,7 @@ export default function SelectIDEComponent(props: SelectIDEComponentProps) {
2736
if (!ideOptions) {
2837
return [];
2938
}
30-
const options = IDEOptions.asArray(ideOptions);
39+
const options = filteredIdeOptions(ideOptions, experimentalIdes);
3140
const result: DropDown2Element[] = [];
3241
for (const ide of options.filter((ide) =>
3342
`${ide.label}${ide.title}${ide.notes}${ide.id}`.toLowerCase().includes(search.toLowerCase()),

components/dashboard/src/contexts/FeatureFlagContext.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const defaultFeatureFlags = {
2929
orgGitAuthProviders: false,
3030
switchToPAYG: false,
3131
newSignupFlow: false,
32+
experimentalIdes: false,
3233
};
3334

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

5254
useEffect(() => {
5355
if (!user) return;
@@ -66,6 +68,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
6668
orgGitAuthProviders: { defaultValue: false, setter: setOrgGitAuthProviders },
6769
switchToPAYG: { defaultValue: false, setter: setSwitchToPAYG },
6870
newSignupFlow: { defaultValue: false, setter: setNewSignupFlow },
71+
experimentalIdes: { defaultValue: false, setter: setExperimentalIdes },
6972
};
7073

7174
for (const [flagName, config] of Object.entries(featureFlags)) {
@@ -114,6 +117,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
114117
orgGitAuthProviders,
115118
newSignupFlow,
116119
switchToPAYG,
120+
experimentalIdes,
117121
};
118122
}, [
119123
enablePersonalAccessTokens,
@@ -126,6 +130,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
126130
startWithOptions,
127131
switchToPAYG,
128132
usePublicApiWorkspacesService,
133+
experimentalIdes,
129134
]);
130135

131136
return <FeatureFlagContext.Provider value={flags}>{children}</FeatureFlagContext.Provider>;

components/gitpod-protocol/src/ide-protocol.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export interface IDEOption {
105105
*/
106106
hidden?: boolean;
107107

108+
/**
109+
* If `true` this IDE option is conditionally shown in the IDE preferences
110+
*/
111+
experimental?: boolean;
112+
108113
/**
109114
* The image ref to the IDE image.
110115
*/
Lines changed: 4 additions & 0 deletions
Loading

components/ide-service-api/go/config/ideconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type IDEOption struct {
4444
Notes []string `json:"notes,omitempty"`
4545
// Hidden this IDE option is not visible in the IDE preferences.
4646
Hidden bool `json:"hidden,omitempty"`
47+
// Experimental this IDE option is to only be shown to some users
48+
Experimental bool `json:"experimental,omitempty"`
4749
// Image ref to the IDE image.
4850
Image string `json:"image"`
4951
// LatestImage ref to the IDE image, this image ref always resolve to digest.

components/supervisor/frontend/src/shared/loading-frame.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function load(): Promise<{
1616
frame.src = startUrl.toString();
1717
frame.style.visibility = "visible";
1818
frame.className = "gitpod-frame loading";
19-
document.body.appendChild(frame);
19+
document.body.prepend(frame);
2020

2121
frame.onload = () => {
2222
const frontendDashboardServiceClient = new FrontendDashboardServiceClient(frame.contentWindow!);

install/installer/pkg/components/blobserve/configmap.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
9999
PrePull: []string{},
100100
Workdir: "/.supervisor/frontend",
101101
},
102+
ctx.RepoName(ctx.Config.Repository, ide.XtermIDEImage): {
103+
PrePull: []string{},
104+
Workdir: "/ide",
105+
},
102106
},
103107
BlobSpace: blobserve_config.BlobSpace{
104108
Location: "/mnt/cache/blobserve",

install/installer/pkg/components/ide-service/ide_config_configmap.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {
3434
webstorm := "webstorm"
3535
rider := "rider"
3636
clion := "clion"
37+
xterm := "xterm"
3738

3839
resolveLatestImage := func(name string, tag string, bundledLatest versions.Versioned) string {
3940
resolveLatest := true
@@ -195,6 +196,16 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {
195196
ImageLayers: []string{jbPluginImage, jbLauncherImage},
196197
LatestImageLayers: []string{jbPluginLatestImage, jbLauncherImage},
197198
},
199+
xterm: {
200+
OrderKey: "12",
201+
Title: "Terminal",
202+
Type: ide_config.IDETypeBrowser,
203+
Logo: getIdeLogoPath("terminal"),
204+
Label: "Insiders",
205+
Image: ctx.ImageName(ctx.Config.Repository, ide.XtermIDEImage, "latest"),
206+
ResolveImageDigest: true,
207+
Experimental: true,
208+
},
198209
},
199210
DefaultIde: "code",
200211
DefaultDesktopIde: codeDesktop,

install/installer/pkg/components/workspace/ide/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const (
1212
CodeWebExtensionVersion = "commit-3b076b91039c47404d98c4a3198edf2982e24af7" // gitpod-web extension version comes from https://github.com/gitpod-io/gitpod-code
1313
CodeDesktopIDEImage = "ide/code-desktop"
1414
CodeDesktopInsidersIDEImage = "ide/code-desktop-insiders"
15+
XtermIDEImage = "ide/xterm-web"
1516
IntelliJDesktopIDEImage = "ide/intellij"
1617
GoLandDesktopIdeImage = "ide/goland"
1718
PyCharmDesktopIdeImage = "ide/pycharm"

0 commit comments

Comments
 (0)