@@ -22,8 +22,14 @@ import {
22
22
} from "components/MultiSelectCombobox/MultiSelectCombobox" ;
23
23
import { Spinner } from "components/Spinner/Spinner" ;
24
24
import { Switch } from "components/Switch/Switch" ;
25
+ import {
26
+ Tooltip ,
27
+ TooltipContent ,
28
+ TooltipProvider ,
29
+ TooltipTrigger ,
30
+ } from "components/Tooltip/Tooltip" ;
25
31
import { useFormik } from "formik" ;
26
- import { Plus , Trash } from "lucide-react" ;
32
+ import { Plus , Trash , TriangleAlert } from "lucide-react" ;
27
33
import { type FC , useId , useState } from "react" ;
28
34
import { docs } from "utils/docs" ;
29
35
import { isUUID } from "utils/uuid" ;
@@ -32,16 +38,6 @@ import { ExportPolicyButton } from "./ExportPolicyButton";
32
38
import { IdpMappingTable } from "./IdpMappingTable" ;
33
39
import { IdpPillList } from "./IdpPillList" ;
34
40
35
- interface IdpGroupSyncFormProps {
36
- groupSyncSettings : GroupSyncSettings ;
37
- groupsMap : Map < string , string > ;
38
- groups : Group [ ] ;
39
- groupMappingCount : number ;
40
- legacyGroupMappingCount : number ;
41
- organization : Organization ;
42
- onSubmit : ( data : GroupSyncSettings ) => void ;
43
- }
44
-
45
41
const groupSyncValidationSchema = Yup . object ( {
46
42
field : Yup . string ( ) . trim ( ) ,
47
43
regex_filter : Yup . string ( ) . trim ( ) ,
@@ -65,15 +61,27 @@ const groupSyncValidationSchema = Yup.object({
65
61
. default ( { } ) ,
66
62
} ) ;
67
63
68
- export const IdpGroupSyncForm = ( {
64
+ interface IdpGroupSyncFormProps {
65
+ groupSyncSettings : GroupSyncSettings ;
66
+ claimFieldValues : readonly string [ ] | undefined ;
67
+ groupsMap : Map < string , string > ;
68
+ groups : Group [ ] ;
69
+ groupMappingCount : number ;
70
+ legacyGroupMappingCount : number ;
71
+ organization : Organization ;
72
+ onSubmit : ( data : GroupSyncSettings ) => void ;
73
+ }
74
+
75
+ export const IdpGroupSyncForm : FC < IdpGroupSyncFormProps > = ( {
69
76
groupSyncSettings,
77
+ claimFieldValues,
70
78
groupMappingCount,
71
79
legacyGroupMappingCount,
72
80
groups,
73
81
groupsMap,
74
82
organization,
75
83
onSubmit,
76
- } : IdpGroupSyncFormProps ) => {
84
+ } ) => {
77
85
const form = useFormik < GroupSyncSettings > ( {
78
86
initialValues : {
79
87
field : groupSyncSettings ?. field ?? "" ,
@@ -270,6 +278,7 @@ export const IdpGroupSyncForm = ({
270
278
< GroupRow
271
279
key = { idpGroup }
272
280
idpGroup = { idpGroup }
281
+ exists = { claimFieldValues ?. includes ( idpGroup ) }
273
282
coderGroup = { getGroupNames ( groups ) }
274
283
onDelete = { handleDelete }
275
284
/>
@@ -288,6 +297,7 @@ export const IdpGroupSyncForm = ({
288
297
< GroupRow
289
298
key = { groupId }
290
299
idpGroup = { idpGroup }
300
+ exists = { claimFieldValues ?. includes ( idpGroup ) }
291
301
coderGroup = { getGroupNames ( [ groupId ] ) }
292
302
onDelete = { handleDelete }
293
303
/>
@@ -303,17 +313,48 @@ export const IdpGroupSyncForm = ({
303
313
304
314
interface GroupRowProps {
305
315
idpGroup : string ;
316
+ exists : boolean | undefined ;
306
317
coderGroup : readonly string [ ] ;
307
318
onDelete : ( idpOrg : string ) => void ;
308
319
}
309
320
310
- const GroupRow : FC < GroupRowProps > = ( { idpGroup, coderGroup, onDelete } ) => {
321
+ const GroupRow : FC < GroupRowProps > = ( {
322
+ idpGroup,
323
+ exists = true ,
324
+ coderGroup,
325
+ onDelete,
326
+ } ) => {
311
327
return (
312
328
< TableRow data-testid = { `group-${ idpGroup } ` } >
313
- < TableCell > { idpGroup } </ TableCell >
329
+ < TableCell >
330
+ < div className = "flex flex-row items-center gap-2 text-content-primary" >
331
+ { idpGroup }
332
+ { ! exists && (
333
+ < TooltipProvider >
334
+ < Tooltip >
335
+ < TooltipTrigger asChild >
336
+ < TriangleAlert className = "size-icon-xs cursor-pointer text-content-warning" />
337
+ </ TooltipTrigger >
338
+ < TooltipContent
339
+ align = "start"
340
+ alignOffset = { - 8 }
341
+ sideOffset = { 8 }
342
+ className = "p-2 text-xs text-content-secondary max-w-sm"
343
+ >
344
+ This value has not be seen in the specified claim field
345
+ before. You might want to check your IdP configuration and
346
+ ensure that this value is not misspelled.
347
+ </ TooltipContent >
348
+ </ Tooltip >
349
+ </ TooltipProvider >
350
+ ) }
351
+ </ div >
352
+ </ TableCell >
353
+
314
354
< TableCell >
315
355
< IdpPillList roles = { coderGroup } />
316
356
</ TableCell >
357
+
317
358
< TableCell >
318
359
< Button
319
360
variant = "outline"
0 commit comments