-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enteprise onboarding settings (#20508)
* UI reorg * generated stuffs * Make it woooooooork * Classier placeholder * Remove unneeded fragment * Introduce `enterprise_onboarding_enabled` flag * move things properly * add ipv6 localhost
- Loading branch information
1 parent
663fcb9
commit d54bd04
Showing
261 changed files
with
2,866 additions
and
1,371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Copyright (c) 2025 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { OrganizationSettings } from "@gitpod/public-api/lib/gitpod/v1/organization_pb"; | ||
import { FormEvent, useCallback, useEffect, useState } from "react"; | ||
import { Heading2, Heading3, Subheading } from "../components/typography/headings"; | ||
import { useIsOwner } from "../data/organizations/members-query"; | ||
import { useOrgSettingsQuery } from "../data/organizations/org-settings-query"; | ||
import { useCurrentOrg } from "../data/organizations/orgs-query"; | ||
import { useUpdateOrgSettingsMutation } from "../data/organizations/update-org-settings-mutation"; | ||
import { OrgSettingsPage } from "./OrgSettingsPage"; | ||
import { ConfigurationSettingsField } from "../repositories/detail/ConfigurationSettingsField"; | ||
import { useDocumentTitle } from "../hooks/use-document-title"; | ||
import { useToast } from "../components/toasts/Toasts"; | ||
import type { PlainMessage } from "@bufbuild/protobuf"; | ||
import { InputField } from "../components/forms/InputField"; | ||
import { TextInput } from "../components/forms/TextInputField"; | ||
import { LoadingButton } from "@podkit/buttons/LoadingButton"; | ||
|
||
export default function TeamOnboardingPage() { | ||
useDocumentTitle("Organization Settings - Onboarding"); | ||
const { toast } = useToast(); | ||
const org = useCurrentOrg().data; | ||
const isOwner = useIsOwner(); | ||
|
||
const { data: settings } = useOrgSettingsQuery(); | ||
const updateTeamSettings = useUpdateOrgSettingsMutation(); | ||
|
||
const [internalLink, setInternalLink] = useState<string | undefined>(undefined); | ||
|
||
const handleUpdateTeamSettings = useCallback( | ||
async (newSettings: Partial<PlainMessage<OrganizationSettings>>, options?: { throwMutateError?: boolean }) => { | ||
if (!org?.id) { | ||
throw new Error("no organization selected"); | ||
} | ||
if (!isOwner) { | ||
throw new Error("no organization settings change permission"); | ||
} | ||
try { | ||
await updateTeamSettings.mutateAsync({ | ||
...settings, | ||
...newSettings, | ||
}); | ||
toast("Organization settings updated"); | ||
} catch (error) { | ||
if (options?.throwMutateError) { | ||
throw error; | ||
} | ||
toast(`Failed to update organization settings: ${error.message}`); | ||
console.error(error); | ||
} | ||
}, | ||
[updateTeamSettings, org?.id, isOwner, settings, toast], | ||
); | ||
|
||
const handleUpdateInternalLink = useCallback( | ||
async (e: FormEvent) => { | ||
e.preventDefault(); | ||
|
||
await handleUpdateTeamSettings({ onboardingSettings: { internalLink } }); | ||
}, | ||
[handleUpdateTeamSettings, internalLink], | ||
); | ||
|
||
useEffect(() => { | ||
if (settings) { | ||
setInternalLink(settings.onboardingSettings?.internalLink); | ||
} | ||
}, [settings]); | ||
|
||
return ( | ||
<OrgSettingsPage> | ||
<div className="space-y-8"> | ||
<div> | ||
<Heading2>Policies</Heading2> | ||
<Subheading>Restrict workspace classes, editors and sharing across your organization.</Subheading> | ||
</div> | ||
<ConfigurationSettingsField> | ||
<Heading3>Internal dashboard</Heading3> | ||
<Subheading> | ||
The link to your internal dashboard. This link will be shown to your organization members during | ||
the onboarding process. You can disable showing a link by leaving this field empty. | ||
</Subheading> | ||
<form onSubmit={handleUpdateInternalLink}> | ||
<InputField label="Internal dashboard link" error={undefined} className="mb-4"> | ||
<TextInput | ||
value={internalLink} | ||
type="url" | ||
placeholder="https://en.wikipedia.org/wiki/Heisenbug" | ||
onChange={setInternalLink} | ||
disabled={updateTeamSettings.isLoading || !isOwner} | ||
/> | ||
</InputField> | ||
<LoadingButton type="submit" loading={updateTeamSettings.isLoading} disabled={!isOwner}> | ||
Save | ||
</LoadingButton> | ||
</form> | ||
</ConfigurationSettingsField> | ||
</div> | ||
</OrgSettingsPage> | ||
); | ||
} |
Oops, something went wrong.