Skip to content

Commit 1cc80d9

Browse files
committed
Introduce enterprise_onboarding_enabled flag
1 parent d906d7b commit 1cc80d9

File tree

3 files changed

+39
-8
lines changed

3 files changed

+39
-8
lines changed

components/dashboard/src/data/featureflag-query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const featureFlags = {
2424
showBrowserExtensionPromotion: false,
2525
enable_experimental_jbtb: false,
2626
enabled_configuration_prebuild_full_clone: false,
27+
enterprise_onboarding_enabled: false,
2728
};
2829

2930
type FeatureFlags = typeof featureFlags;

components/dashboard/src/teams/OrgSettingsPage.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useCurrentOrg } from "../data/organizations/orgs-query";
1515
import { useFeatureFlag } from "../data/featureflag-query";
1616
import { Organization } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
1717
import { useIsOwner } from "../data/organizations/members-query";
18-
import { isGitpodIo } from "../utils";
18+
import { useInstallationConfiguration } from "../data/installation/default-workspace-image-query";
1919

2020
export interface OrgSettingsPageProps {
2121
children: React.ReactNode;
@@ -27,6 +27,9 @@ export function OrgSettingsPage({ children }: OrgSettingsPageProps) {
2727
const orgBillingMode = useOrgBillingMode();
2828
const oidcServiceEnabled = useFeatureFlag("oidcServiceEnabled");
2929
const orgGitAuthProviders = useFeatureFlag("orgGitAuthProviders");
30+
const isOnboardingEnabled = useFeatureFlag("enterprise_onboarding_enabled");
31+
const { data: installationConfig } = useInstallationConfiguration();
32+
const isDedicatedInstallation = !!installationConfig?.isDedicatedInstallation;
3033

3134
const menu = useMemo(
3235
() =>
@@ -36,8 +39,18 @@ export function OrgSettingsPage({ children }: OrgSettingsPageProps) {
3639
ssoEnabled: oidcServiceEnabled,
3740
orgGitAuthProviders,
3841
isOwner,
42+
isDedicatedInstallation,
43+
showOnboarding: isOnboardingEnabled && isDedicatedInstallation,
3944
}),
40-
[org.data, orgBillingMode.data, oidcServiceEnabled, orgGitAuthProviders, isOwner],
45+
[
46+
org.data,
47+
orgBillingMode.data,
48+
oidcServiceEnabled,
49+
orgGitAuthProviders,
50+
isOwner,
51+
isDedicatedInstallation,
52+
isOnboardingEnabled,
53+
],
4154
);
4255

4356
const title = "Organization Settings";
@@ -76,8 +89,10 @@ function getOrgSettingsMenu(params: {
7689
ssoEnabled?: boolean;
7790
orgGitAuthProviders: boolean;
7891
isOwner?: boolean;
92+
showOnboarding?: boolean;
93+
isDedicatedInstallation?: boolean;
7994
}) {
80-
const { billingMode, ssoEnabled, orgGitAuthProviders, isOwner } = params;
95+
const { billingMode, ssoEnabled, orgGitAuthProviders, isOwner, showOnboarding, isDedicatedInstallation } = params;
8196
const result = [
8297
{
8398
title: "General",
@@ -87,12 +102,8 @@ function getOrgSettingsMenu(params: {
87102
title: "Policies",
88103
link: [`/settings/policy`],
89104
},
90-
{
91-
title: "Onboarding",
92-
link: [`/settings/onboarding`],
93-
},
94105
];
95-
if (isGitpodIo()) {
106+
if (!isDedicatedInstallation) {
96107
result.push(
97108
{
98109
title: "Networking",
@@ -104,6 +115,12 @@ function getOrgSettingsMenu(params: {
104115
},
105116
);
106117
}
118+
if (showOnboarding) {
119+
result.push({
120+
title: "Onboarding",
121+
link: [`/settings/onboarding`],
122+
});
123+
}
107124
if (isOwner && ssoEnabled) {
108125
result.push({
109126
title: "SSO",

components/server/src/api/organization-service-api.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ import { validate as uuidValidate } from "uuid";
4646
import { ctxUserId } from "../util/request-context";
4747
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
4848
import { EntitlementService } from "../billing/entitlement-service";
49+
import { Config } from "../config";
4950

5051
@injectable()
5152
export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationServiceInterface> {
5253
constructor(
54+
@inject(Config)
55+
private readonly config: Config,
5356
@inject(OrganizationService)
5457
private readonly orgService: OrganizationService,
5558
@inject(PublicAPIConverter)
@@ -335,6 +338,16 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
335338
}
336339

337340
if (req.onboardingSettings) {
341+
if (!this.config.isDedicatedInstallation) {
342+
throw new ApplicationError(
343+
ErrorCodes.BAD_REQUEST,
344+
"onboardingSettings can only be set on enterprise installations",
345+
);
346+
}
347+
if (req.onboardingSettings.internalLink?.length ?? 0 > 255) {
348+
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "internalLink must be <= 255 characters");
349+
}
350+
338351
update.onboardingSettings = req.onboardingSettings;
339352
}
340353

0 commit comments

Comments
 (0)