Skip to content

Commit e9a5bff

Browse files
committed
one last bit of polish
1 parent a76a243 commit e9a5bff

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

site/src/pages/DeploymentSettingsPage/IdpOrgSyncPage/IdpOrgSyncPageView.stories.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { userEvent, within } from "@storybook/test";
2+
import { expect, userEvent, within } from "@storybook/test";
33
import {
44
MockOrganization,
55
MockOrganization2,
@@ -49,6 +49,12 @@ export const MissingClaims: Story = {
4949
args: {
5050
claimFieldValues: [],
5151
},
52+
play: async ({ canvasElement }) => {
53+
const user = userEvent.setup();
54+
const warning = canvasElement.querySelector(".lucide-triangle-alert")!;
55+
expect(warning).not.toBe(null);
56+
await user.hover(warning);
57+
},
5258
};
5359

5460
export const AssignDefaultOrgWarningDialog: Story = {

site/src/pages/OrganizationSettingsPage/IdpSyncPage/IdpGroupSyncForm.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const groupSyncValidationSchema = Yup.object({
6363

6464
interface IdpGroupSyncFormProps {
6565
groupSyncSettings: GroupSyncSettings;
66-
fieldValues: readonly string[] | undefined;
66+
claimFieldValues: readonly string[] | undefined;
6767
groupsMap: Map<string, string>;
6868
groups: Group[];
6969
groupMappingCount: number;
@@ -74,7 +74,7 @@ interface IdpGroupSyncFormProps {
7474

7575
export const IdpGroupSyncForm: FC<IdpGroupSyncFormProps> = ({
7676
groupSyncSettings,
77-
fieldValues,
77+
claimFieldValues,
7878
groupMappingCount,
7979
legacyGroupMappingCount,
8080
groups,
@@ -278,7 +278,7 @@ export const IdpGroupSyncForm: FC<IdpGroupSyncFormProps> = ({
278278
<GroupRow
279279
key={idpGroup}
280280
idpGroup={idpGroup}
281-
exists={fieldValues?.includes(idpGroup)}
281+
exists={claimFieldValues?.includes(idpGroup)}
282282
coderGroup={getGroupNames(groups)}
283283
onDelete={handleDelete}
284284
/>
@@ -297,7 +297,7 @@ export const IdpGroupSyncForm: FC<IdpGroupSyncFormProps> = ({
297297
<GroupRow
298298
key={groupId}
299299
idpGroup={idpGroup}
300-
exists={fieldValues?.includes(idpGroup)}
300+
exists={claimFieldValues?.includes(idpGroup)}
301301
coderGroup={getGroupNames([groupId])}
302302
onDelete={handleDelete}
303303
/>

site/src/pages/OrganizationSettingsPage/IdpSyncPage/IdpRoleSyncForm.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const roleSyncValidationSchema = Yup.object({
4848

4949
interface IdpRoleSyncFormProps {
5050
roleSyncSettings: RoleSyncSettings;
51-
fieldValues: readonly string[] | undefined;
51+
claimFieldValues: readonly string[] | undefined;
5252
roleMappingCount: number;
5353
organization: Organization;
5454
roles: Role[];
@@ -57,7 +57,7 @@ interface IdpRoleSyncFormProps {
5757

5858
export const IdpRoleSyncForm: FC<IdpRoleSyncFormProps> = ({
5959
roleSyncSettings,
60-
fieldValues,
60+
claimFieldValues,
6161
roleMappingCount,
6262
organization,
6363
roles,
@@ -218,7 +218,7 @@ export const IdpRoleSyncForm: FC<IdpRoleSyncFormProps> = ({
218218
<RoleRow
219219
key={idpRole}
220220
idpRole={idpRole}
221-
exists={fieldValues?.includes(idpRole)}
221+
exists={claimFieldValues?.includes(idpRole)}
222222
coderRoles={roles}
223223
onDelete={handleDelete}
224224
/>

site/src/pages/OrganizationSettingsPage/IdpSyncPage/IdpSyncPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const IdpSyncPage: FC = () => {
116116
tab={tab}
117117
groupSyncSettings={groupIdpSyncSettingsQuery.data}
118118
roleSyncSettings={roleIdpSyncSettingsQuery.data}
119-
fieldValues={fieldValuesQuery.data}
119+
claimFieldValues={fieldValuesQuery.data}
120120
groups={groupsQuery.data}
121121
groupsMap={groupsMap}
122122
roles={rolesQuery.data}

site/src/pages/OrganizationSettingsPage/IdpSyncPage/IdpSyncPageView.stories.tsx

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { expect, userEvent, within } from "@storybook/test";
2+
import { expect, userEvent } from "@storybook/test";
33
import {
44
MockGroup,
55
MockGroup2,
@@ -23,7 +23,7 @@ const meta: Meta<typeof IdpSyncPageView> = {
2323
tab: "groups",
2424
groupSyncSettings: MockGroupSyncSettings,
2525
roleSyncSettings: MockRoleSyncSettings,
26-
fieldValues: [
26+
claimFieldValues: [
2727
...Object.keys(MockGroupSyncSettings.mapping),
2828
...Object.keys(MockRoleSyncSettings.mapping),
2929
],
@@ -73,15 +73,21 @@ export const MissingGroups: Story = {
7373
export const WithLegacyMapping: Story = {
7474
args: {
7575
groupSyncSettings: MockLegacyMappingGroupSyncSettings,
76-
fieldValues: Object.keys(
76+
claimFieldValues: Object.keys(
7777
MockLegacyMappingGroupSyncSettings.legacy_group_name_mapping,
7878
),
7979
},
8080
};
8181

8282
export const GroupsTabMissingClaims: Story = {
8383
args: {
84-
fieldValues: [],
84+
claimFieldValues: [],
85+
},
86+
play: async ({ canvasElement }) => {
87+
const user = userEvent.setup();
88+
const warning = canvasElement.querySelector(".lucide-triangle-alert")!;
89+
expect(warning).not.toBe(null);
90+
await user.hover(warning);
8591
},
8692
};
8793

@@ -94,6 +100,12 @@ export const RolesTab: Story = {
94100
export const RolesTabMissingClaims: Story = {
95101
args: {
96102
tab: "roles",
97-
fieldValues: [],
103+
claimFieldValues: [],
104+
},
105+
play: async ({ canvasElement }) => {
106+
const user = userEvent.setup();
107+
const warning = canvasElement.querySelector(".lucide-triangle-alert")!;
108+
expect(warning).not.toBe(null);
109+
await user.hover(warning);
98110
},
99111
};

site/src/pages/OrganizationSettingsPage/IdpSyncPage/IdpSyncPageView.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface IdpSyncPageViewProps {
1616
tab: string;
1717
groupSyncSettings: GroupSyncSettings | undefined;
1818
roleSyncSettings: RoleSyncSettings | undefined;
19-
fieldValues: readonly string[] | undefined;
19+
claimFieldValues: readonly string[] | undefined;
2020
groups: Group[] | undefined;
2121
groupsMap: Map<string, string>;
2222
roles: Role[] | undefined;
@@ -30,7 +30,7 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({
3030
tab,
3131
groupSyncSettings,
3232
roleSyncSettings,
33-
fieldValues,
33+
claimFieldValues,
3434
groups,
3535
groupsMap,
3636
roles,
@@ -69,7 +69,7 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({
6969
{tab === "groups" ? (
7070
<IdpGroupSyncForm
7171
groupSyncSettings={groupSyncSettings}
72-
fieldValues={fieldValues}
72+
claimFieldValues={claimFieldValues}
7373
groupMappingCount={groupMappingCount}
7474
legacyGroupMappingCount={legacyGroupMappingCount}
7575
groups={groups}
@@ -80,7 +80,7 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({
8080
) : (
8181
<IdpRoleSyncForm
8282
roleSyncSettings={roleSyncSettings}
83-
fieldValues={fieldValues}
83+
claimFieldValues={claimFieldValues}
8484
roleMappingCount={roleMappingCount}
8585
roles={roles || []}
8686
organization={organization}

0 commit comments

Comments
 (0)