Skip to content

Commit 01087d3

Browse files
committed
Control by FF
1 parent 6a368f0 commit 01087d3

File tree

3 files changed

+41
-21
lines changed

3 files changed

+41
-21
lines changed

Diff for: components/dashboard/src/data/featureflag-query.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const featureFlags = {
2727
dashboard_logging_tracing: false,
2828
showBrowserExtensionPromotion: false,
2929
usage_update_scheduler_duration: "15m",
30+
enable_experimental_jbtb: false,
3031
};
3132

3233
type FeatureFlags = typeof featureFlags;

Diff for: components/dashboard/src/user-settings/SelectIDE.tsx

+19-15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useUpdateCurrentUserMutation } from "../data/current-user/update-mutati
1313
import { converter } from "../service/public-api";
1414
import { isOrganizationOwned } from "@gitpod/public-api-common/lib/user-utils";
1515
import Alert from "../components/Alert";
16+
import { useFeatureFlag } from "../data/featureflag-query";
1617

1718
export type IDEChangedTrackLocation = "workspace_list" | "workspace_start" | "preferences";
1819
interface SelectIDEProps {
@@ -27,6 +28,7 @@ export default function SelectIDE(props: SelectIDEProps) {
2728
const [useLatestVersion, setUseLatestVersion] = useState<boolean>(user?.editorSettings?.version === "latest");
2829
const [preferToolbox, setPreferToolbox] = useState<boolean>(user?.editorSettings?.preferToolbox || false);
2930
const [ideWarning, setIdeWarning] = useState<ReactNode | undefined>(undefined);
31+
const enableExperimentalJBTB = useFeatureFlag("enable_experimental_jbtb");
3032

3133
const isOrgOwnedUser = user && isOrganizationOwned(user);
3234

@@ -154,21 +156,23 @@ export default function SelectIDE(props: SelectIDEProps) {
154156
onChange={(checked) => actuallySetUseLatestVersion(checked)}
155157
/>
156158

157-
<CheckboxInputField
158-
label={
159-
<span className="flex items-center gap-2">
160-
Launch in JetBrains Toolbox{" "}
161-
<PillLabel type="warn">
162-
<a href="https://www.gitpod.io/docs/references/gitpod-releases">
163-
<span className="text-xs">BETA</span>
164-
</a>
165-
</PillLabel>
166-
</span>
167-
}
168-
hint={<span>Launch JetBrains IDEs in the JetBrains Toolbox.</span>}
169-
checked={preferToolbox}
170-
onChange={(checked) => actuallySetPreferToolbox(checked)}
171-
/>
159+
{enableExperimentalJBTB && (
160+
<CheckboxInputField
161+
label={
162+
<span className="flex items-center gap-2">
163+
Launch in JetBrains Toolbox{" "}
164+
<PillLabel type="warn">
165+
<a href="https://www.gitpod.io/docs/references/gitpod-releases">
166+
<span className="text-xs">BETA</span>
167+
</a>
168+
</PillLabel>
169+
</span>
170+
}
171+
hint={<span>Launch JetBrains IDEs in the JetBrains Toolbox.</span>}
172+
checked={preferToolbox}
173+
onChange={(checked) => actuallySetPreferToolbox(checked)}
174+
/>
175+
)}
172176
</>
173177
);
174178
}

Diff for: components/server/src/workspace/workspace-starter.ts

+21-6
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,30 @@ export class WorkspaceStarter {
301301

302302
let ideSettings = options.ideSettings;
303303

304+
const enableExperimentalJBTB = await getExperimentsClientForBackend().getValueAsync(
305+
"enable_experimental_jbtb",
306+
false,
307+
{ user },
308+
);
309+
304310
// if no explicit ideSettings are passed, we use the one from the last workspace instance
305311
if (lastValidWorkspaceInstance) {
306312
const ideConfig = lastValidWorkspaceInstance.configuration?.ideConfig;
307313
if (ideConfig?.ide) {
314+
const preferToolbox = !enableExperimentalJBTB
315+
? false
316+
: ideSettings?.preferToolbox ??
317+
user.additionalData?.ideSettings?.preferToolbox ??
318+
ideConfig.preferToolbox ??
319+
false;
308320
ideSettings = {
309321
...ideSettings,
310322
defaultIde: ideConfig.ide,
311323
useLatestVersion:
312324
ideSettings?.useLatestVersion ??
313325
user.additionalData?.ideSettings?.useLatestVersion ??
314326
!!ideConfig.useLatest,
315-
preferToolbox:
316-
ideSettings?.preferToolbox ??
317-
user.additionalData?.ideSettings?.preferToolbox ??
318-
ideConfig.preferToolbox ??
319-
false,
327+
preferToolbox,
320328
};
321329
}
322330
}
@@ -914,10 +922,17 @@ export class WorkspaceStarter {
914922
};
915923
if (ideConfig.ideSettings && ideConfig.ideSettings.trim() !== "") {
916924
try {
925+
const enableExperimentalJBTB = await getExperimentsClientForBackend().getValueAsync(
926+
"enable_experimental_jbtb",
927+
false,
928+
{ user },
929+
);
917930
const ideSettings: IDESettings = JSON.parse(ideConfig.ideSettings);
918931
configuration.ideConfig!.ide = ideSettings.defaultIde;
919932
configuration.ideConfig!.useLatest = !!ideSettings.useLatestVersion;
920-
configuration.ideConfig!.preferToolbox = ideSettings.preferToolbox ?? false;
933+
configuration.ideConfig!.preferToolbox = !enableExperimentalJBTB
934+
? false
935+
: ideSettings.preferToolbox ?? false;
921936
} catch (error) {
922937
log.error({ userId: user.id, workspaceId: workspace.id }, "cannot parse ideSettings", error);
923938
}

0 commit comments

Comments
 (0)