Skip to content

Commit 01540c8

Browse files
committed
chore: extract UUID regex
1 parent ba0ad6f commit 01540c8

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

site/src/pages/DeploymentSettingsPage/IdpOrgSyncPage/OrganizationPills.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ import {
77
} from "components/Popover/Popover";
88
import type { FC } from "react";
99
import { cn } from "utils/cn";
10+
import { UUID } from "utils/idp";
1011

1112
interface OrganizationPillsProps {
1213
organizations: readonly string[];
1314
}
1415

15-
// used to check if the organization is a UUID
16-
const UUID =
17-
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
18-
1916
export const OrganizationPills: FC<OrganizationPillsProps> = ({
2017
organizations,
2118
}) => {

site/src/pages/ManagementSettingsPage/IdpSyncPage/IdpPillList.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ import {
77
PopoverTrigger,
88
} from "components/Popover/Popover";
99
import type { FC } from "react";
10+
import { UUID } from "utils/idp";
1011

1112
interface PillListProps {
1213
roles: readonly string[];
1314
}
1415

15-
// used to check if the role is a UUID
16-
const UUID =
17-
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
18-
1916
export const IdpPillList: FC<PillListProps> = ({ roles }) => {
2017
return (
2118
<Stack direction="row" spacing={1}>

site/src/utils/idp.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const UUID =
2+
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

0 commit comments

Comments
 (0)