Skip to content

Commit abbcffe

Browse files
authored
fix: use multi-org settings layout even if not licensed (#14215)
* fix: only check flag for organization settings I added checks against the license but actually what we want is for these views to become the default even when not licensed (once the experimental flag is removed). * Move deployment settings header to components This will let us use it in the org settings pages, for a consistent look. * Add premium badge * Use settings header on org pages * Add license badges to create org page I am not sure if there is maybe a better place for this, but maybe this is good enough. * Change create org form description text It says "change", but there is nothing to change yet since this is a new organization. * Consistently capitalize org menu items and headings Also, remove the "organizations" prefix since it seems redundant.
1 parent 9a47ea1 commit abbcffe

31 files changed

+302
-238
lines changed

site/src/components/Badges/Badges.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@ export const EnterpriseBadge: FC = () => {
123123
);
124124
};
125125

126+
export const PremiumBadge: FC = () => {
127+
return (
128+
<span
129+
css={[
130+
styles.badge,
131+
(theme) => ({
132+
backgroundColor: theme.roles.info.background,
133+
border: `1px solid ${theme.roles.info.outline}`,
134+
color: theme.roles.info.text,
135+
}),
136+
]}
137+
>
138+
Premium
139+
</span>
140+
);
141+
};
142+
126143
export const PreviewBadge: FC = () => {
127144
return (
128145
<span

site/src/components/Paywall/PopoverPaywall.stories.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ const meta: Meta<typeof PopoverPaywall> = {
99
export default meta;
1010
type Story = StoryObj<typeof PopoverPaywall>;
1111

12-
const Example: Story = {
12+
export const Enterprise: Story = {
1313
args: {
1414
message: "Black Lotus",
1515
description:
1616
"Adds 3 mana of any single color of your choice to your mana pool, then is discarded. Tapping this artifact can be played as an interrupt.",
1717
},
1818
};
1919

20-
export { Example as PopoverPaywall };
20+
export const Premium: Story = {
21+
args: {
22+
message: "Black Lotus",
23+
description:
24+
"Adds 3 mana of any single color of your choice to your mana pool, then is discarded. Tapping this artifact can be played as an interrupt.",
25+
licenseType: "premium",
26+
},
27+
};

site/src/components/Paywall/PopoverPaywall.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,29 @@ import TaskAltIcon from "@mui/icons-material/TaskAlt";
33
import Button from "@mui/material/Button";
44
import Link from "@mui/material/Link";
55
import type { FC, ReactNode } from "react";
6-
import { EnterpriseBadge } from "components/Badges/Badges";
6+
import { EnterpriseBadge, PremiumBadge } from "components/Badges/Badges";
77
import { Stack } from "components/Stack/Stack";
88
import { docs } from "utils/docs";
99

1010
export interface PopoverPaywallProps {
1111
message: string;
1212
description?: ReactNode;
1313
documentationLink?: string;
14+
licenseType?: "enterprise" | "premium";
1415
}
1516

1617
export const PopoverPaywall: FC<PopoverPaywallProps> = ({
1718
message,
1819
description,
1920
documentationLink,
21+
licenseType = "enterprise",
2022
}) => {
2123
return (
2224
<div css={styles.root}>
2325
<div>
2426
<Stack direction="row" alignItems="center" css={{ marginBottom: 18 }}>
2527
<h5 css={styles.title}>{message}</h5>
26-
<EnterpriseBadge />
28+
{licenseType === "premium" ? <PremiumBadge /> : <EnterpriseBadge />}
2729
</Stack>
2830

2931
{description && <p css={styles.description}>{description}</p>}
@@ -51,6 +53,11 @@ export const PopoverPaywall: FC<PopoverPaywallProps> = ({
5153
<li css={styles.feature}>
5254
<FeatureIcon /> Audit logs
5355
</li>
56+
{licenseType === "premium" && (
57+
<li css={styles.feature}>
58+
<FeatureIcon /> Organizations
59+
</li>
60+
)}
5461
</ul>
5562
<Button
5663
href={docs("/enterprise")}
@@ -60,7 +67,7 @@ export const PopoverPaywall: FC<PopoverPaywallProps> = ({
6067
variant="outlined"
6168
color="neutral"
6269
>
63-
Learn about Enterprise
70+
Learn about {licenseType === "premium" ? "Premium" : "Enterprise"}
6471
</Button>
6572
</Stack>
6673
</div>

site/src/pages/DeploySettingsPage/Header.tsx renamed to site/src/components/SettingsHeader/SettingsHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface HeaderProps {
1111
docsHref?: string;
1212
}
1313

14-
export const Header: FC<HeaderProps> = ({
14+
export const SettingsHeader: FC<HeaderProps> = ({
1515
title,
1616
description,
1717
docsHref,

site/src/modules/dashboard/Navbar/Navbar.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const Navbar: FC = () => {
2020
const canViewDeployment = Boolean(permissions.viewDeploymentValues);
2121
const canViewOrganizations =
2222
Boolean(permissions.editAnyOrganization) &&
23-
featureVisibility.multiple_organizations &&
2423
experiments.includes("multi-organization");
2524
const canViewAllUsers = Boolean(permissions.viewAllUsers);
2625
const proxyContextValue = useProxy();

site/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import {
1616
PopoverContent,
1717
PopoverTrigger,
1818
} from "components/Popover/Popover";
19+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
1920
import { getFormHelpers } from "utils/formUtils";
2021
import { Fieldset } from "../Fieldset";
21-
import { Header } from "../Header";
2222
import { AnnouncementBannerSettings } from "./AnnouncementBannerSettings";
2323

2424
export type AppearanceSettingsPageViewProps = {
@@ -54,7 +54,7 @@ export const AppearanceSettingsPageView: FC<
5454

5555
return (
5656
<>
57-
<Header
57+
<SettingsHeader
5858
title="Appearance"
5959
description="Customize the look and feel of your Coder deployment."
6060
/>

site/src/pages/DeploySettingsPage/DeploySettingsLayout.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Stack } from "components/Stack/Stack";
99
import { useAuthenticated } from "contexts/auth/RequireAuth";
1010
import { RequirePermission } from "contexts/auth/RequirePermission";
1111
import { useDashboard } from "modules/dashboard/useDashboard";
12-
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
1312
import { ManagementSettingsLayout } from "pages/ManagementSettingsPage/ManagementSettingsLayout";
1413
import { Sidebar } from "./Sidebar";
1514

@@ -34,9 +33,7 @@ export const useDeploySettings = (): DeploySettingsContextValue => {
3433
export const DeploySettingsLayout: FC = () => {
3534
const { experiments } = useDashboard();
3635

37-
const feats = useFeatureVisibility();
38-
const canViewOrganizations =
39-
feats.multiple_organizations && experiments.includes("multi-organization");
36+
const canViewOrganizations = experiments.includes("multi-organization");
4037

4138
return canViewOrganizations ? (
4239
<ManagementSettingsLayout />

site/src/pages/DeploySettingsPage/ExternalAuthSettingsPage/ExternalAuthSettingsPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type { FC } from "react";
99
import type { DeploymentValues, ExternalAuthConfig } from "api/typesGenerated";
1010
import { Alert } from "components/Alert/Alert";
1111
import { EnterpriseBadge } from "components/Badges/Badges";
12+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
1213
import { docs } from "utils/docs";
13-
import { Header } from "../Header";
1414

1515
export type ExternalAuthSettingsPageViewProps = {
1616
config: DeploymentValues;
@@ -21,7 +21,7 @@ export const ExternalAuthSettingsPageView: FC<
2121
> = ({ config }) => {
2222
return (
2323
<>
24-
<Header
24+
<SettingsHeader
2525
title="External Authentication"
2626
description="Coder integrates with GitHub, GitLab, BitBucket, Azure Repos, and OpenID Connect to authenticate developers with external services."
2727
docsHref={docs("/admin/external-auth")}

site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import {
1111
ActiveUsersTitle,
1212
} from "components/ActiveUserChart/ActiveUserChart";
1313
import { ErrorAlert } from "components/Alert/ErrorAlert";
14+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
1415
import { Stack } from "components/Stack/Stack";
1516
import { useDeploymentOptions } from "utils/deployOptions";
1617
import { docs } from "utils/docs";
1718
import { Alert } from "../../../components/Alert/Alert";
18-
import { Header } from "../Header";
1919
import OptionsTable from "../OptionsTable";
2020
import { ChartSection } from "./ChartSection";
2121

@@ -38,7 +38,7 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
3838
}) => {
3939
return (
4040
<>
41-
<Header
41+
<SettingsHeader
4242
title="General"
4343
description="Information about your Coder deployment."
4444
docsHref={docs("/admin/configure")}

site/src/pages/DeploySettingsPage/LicensesSettingsPage/AddNewLicensePageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { Link as RouterLink } from "react-router-dom";
66
import { ErrorAlert } from "components/Alert/ErrorAlert";
77
import { FileUpload } from "components/FileUpload/FileUpload";
88
import { displayError } from "components/GlobalSnackbar/utils";
9+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
910
import { Stack } from "components/Stack/Stack";
1011
import { Fieldset } from "../Fieldset";
11-
import { Header } from "../Header";
1212
import { DividerWithText } from "./DividerWithText";
1313

1414
type AddNewLicenseProps = {
@@ -50,7 +50,7 @@ export const AddNewLicensePageView: FC<AddNewLicenseProps> = ({
5050
direction="row"
5151
justifyContent="space-between"
5252
>
53-
<Header
53+
<SettingsHeader
5454
title="Add a license"
5555
description="Get access to high availability, RBAC, quotas, and more."
5656
/>

site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicensesSettingsPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import type { FC } from "react";
1010
import Confetti from "react-confetti";
1111
import { Link } from "react-router-dom";
1212
import type { GetLicensesResponse } from "api/api";
13+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
1314
import { Stack } from "components/Stack/Stack";
1415
import { useWindowSize } from "hooks/useWindowSize";
15-
import { Header } from "../Header";
1616
import { LicenseCard } from "./LicenseCard";
1717

1818
type Props = {
@@ -55,7 +55,7 @@ const LicensesSettingsPageView: FC<Props> = ({
5555
direction="row"
5656
justifyContent="space-between"
5757
>
58-
<Header
58+
<SettingsHeader
5959
title="Licenses"
6060
description="Manage licenses to unlock Enterprise features."
6161
/>

site/src/pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPageView.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { FC } from "react";
22
import type { SerpentOption } from "api/typesGenerated";
33
import { Badges, EnabledBadge, DisabledBadge } from "components/Badges/Badges";
4+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
45
import { Stack } from "components/Stack/Stack";
56
import {
67
deploymentGroupHasParent,
78
useDeploymentOptions,
89
} from "utils/deployOptions";
910
import { docs } from "utils/docs";
10-
import { Header } from "../Header";
1111
import OptionsTable from "../OptionsTable";
1212

1313
export type NetworkSettingsPageViewProps = {
@@ -19,7 +19,7 @@ export const NetworkSettingsPageView: FC<NetworkSettingsPageViewProps> = ({
1919
}) => (
2020
<Stack direction="column" spacing={6}>
2121
<div>
22-
<Header
22+
<SettingsHeader
2323
title="Network"
2424
description="Configure your deployment connectivity."
2525
docsHref={docs("/networking")}
@@ -32,7 +32,7 @@ export const NetworkSettingsPageView: FC<NetworkSettingsPageViewProps> = ({
3232
</div>
3333

3434
<div>
35-
<Header
35+
<SettingsHeader
3636
title="Port Forwarding"
3737
secondary
3838
description="Port forwarding lets developers securely access processes on their Coder workspace from a local machine."

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type { FC } from "react";
44
import { Link } from "react-router-dom";
55
import type * as TypesGen from "api/typesGenerated";
66
import { ErrorAlert } from "components/Alert/ErrorAlert";
7+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
78
import { Stack } from "components/Stack/Stack";
8-
import { Header } from "../Header";
99
import { OAuth2AppForm } from "./OAuth2AppForm";
1010

1111
type CreateOAuth2AppProps = {
@@ -26,7 +26,7 @@ export const CreateOAuth2AppPageView: FC<CreateOAuth2AppProps> = ({
2626
direction="row"
2727
justifyContent="space-between"
2828
>
29-
<Header
29+
<SettingsHeader
3030
title="Add an OAuth2 application"
3131
description="Configure an application to use Coder as an OAuth2 provider."
3232
/>

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/EditOAuth2AppPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import { CopyableValue } from "components/CopyableValue/CopyableValue";
2020
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
2121
import { DeleteDialog } from "components/Dialogs/DeleteDialog/DeleteDialog";
2222
import { Loader } from "components/Loader/Loader";
23+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
2324
import { Stack } from "components/Stack/Stack";
2425
import { TableLoader } from "components/TableLoader/TableLoader";
2526
import { createDayString } from "utils/createDayString";
26-
import { Header } from "../Header";
2727
import { OAuth2AppForm } from "./OAuth2AppForm";
2828

2929
export type MutatingResource = {
@@ -75,7 +75,7 @@ export const EditOAuth2AppPageView: FC<EditOAuth2AppProps> = ({
7575
direction="row"
7676
justifyContent="space-between"
7777
>
78-
<Header
78+
<SettingsHeader
7979
title="Edit OAuth2 application"
8080
description="Configure an application to use Coder as an OAuth2 provider."
8181
/>

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/OAuth2AppsSettingsPageView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import type * as TypesGen from "api/typesGenerated";
1414
import { ErrorAlert } from "components/Alert/ErrorAlert";
1515
import { Avatar } from "components/Avatar/Avatar";
1616
import { AvatarData } from "components/AvatarData/AvatarData";
17+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
1718
import { Stack } from "components/Stack/Stack";
1819
import { TableLoader } from "components/TableLoader/TableLoader";
1920
import { useClickableTableRow } from "hooks/useClickableTableRow";
20-
import { Header } from "../Header";
2121

2222
type OAuth2AppsSettingsProps = {
2323
apps?: TypesGen.OAuth2ProviderApp[];
@@ -38,7 +38,7 @@ const OAuth2AppsSettingsPageView: FC<OAuth2AppsSettingsProps> = ({
3838
justifyContent="space-between"
3939
>
4040
<div>
41-
<Header
41+
<SettingsHeader
4242
title="OAuth2 Applications"
4343
description="Configure applications to use Coder as an OAuth2 provider."
4444
/>

site/src/pages/DeploySettingsPage/ObservabilitySettingsPage/ObservabilitySettingsPageView.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
EnabledBadge,
77
EnterpriseBadge,
88
} from "components/Badges/Badges";
9+
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
910
import { Stack } from "components/Stack/Stack";
1011
import { deploymentGroupHasParent } from "utils/deployOptions";
1112
import { docs } from "utils/docs";
12-
import { Header } from "../Header";
1313
import OptionsTable from "../OptionsTable";
1414

1515
export type ObservabilitySettingsPageViewProps = {
@@ -24,8 +24,8 @@ export const ObservabilitySettingsPageView: FC<
2424
<>
2525
<Stack direction="column" spacing={6}>
2626
<div>
27-
<Header title="Observability" />
28-
<Header
27+
<SettingsHeader title="Observability" />
28+
<SettingsHeader
2929
title="Audit Logging"
3030
secondary
3131
description="Allow auditors to monitor user operations in your deployment."
@@ -39,7 +39,7 @@ export const ObservabilitySettingsPageView: FC<
3939
</div>
4040

4141
<div>
42-
<Header
42+
<SettingsHeader
4343
title="Monitoring"
4444
secondary
4545
description="Monitoring your Coder application with logs and metrics."

0 commit comments

Comments
 (0)