1
1
import type { Interpolation , Theme } from "@emotion/react" ;
2
+ import { useTheme } from "@emotion/react" ;
2
3
import LaunchOutlined from "@mui/icons-material/LaunchOutlined" ;
3
4
import Button from "@mui/material/Button" ;
4
5
import Skeleton from "@mui/material/Skeleton" ;
@@ -24,7 +25,34 @@ export type IdpSyncPageViewProps = {
24
25
oidcConfig : OIDCConfig | undefined ;
25
26
} ;
26
27
28
+ type CircleProps = {
29
+ color : string ;
30
+ variant ?: "solid" | "outlined" ;
31
+ } ;
32
+
33
+ const Circle : FC < CircleProps > = ( { color, variant = "solid" } ) => {
34
+ return (
35
+ < div
36
+ aria-hidden
37
+ css = { {
38
+ width : 8 ,
39
+ height : 8 ,
40
+ backgroundColor : variant === "solid" ? color : undefined ,
41
+ border : variant === "outlined" ? `1px solid ${ color } ` : undefined ,
42
+ borderRadius : 9999 ,
43
+ } }
44
+ />
45
+ ) ;
46
+ } ;
47
+
27
48
export const IdpSyncPageView : FC < IdpSyncPageViewProps > = ( { oidcConfig } ) => {
49
+ const theme = useTheme ( ) ;
50
+ const {
51
+ groups_field,
52
+ user_role_field,
53
+ group_regex_filter,
54
+ group_auto_create,
55
+ } = oidcConfig || { } ;
28
56
return (
29
57
< >
30
58
< ChooseOne >
@@ -43,9 +71,21 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
43
71
< legend css = { styles . legend } > Groups</ legend >
44
72
< Stack direction = { "row" } alignItems = { "center" } spacing = { 3 } >
45
73
< h4 > Sync Field</ h4 >
46
- < p css = { styles . secondary } > { oidcConfig ?. groups_field } </ p >
74
+ < p css = { styles . secondary } >
75
+ { groups_field || (
76
+ < Stack
77
+ style = { { color : theme . palette . text . secondary } }
78
+ direction = "row"
79
+ spacing = { 1 }
80
+ alignItems = "center"
81
+ >
82
+ < Circle color = { theme . roles . error . fill . solid } />
83
+ < p > disabled</ p >
84
+ </ Stack >
85
+ ) }
86
+ </ p >
47
87
< h4 > Regex Filter</ h4 >
48
- < p css = { styles . secondary } > { oidcConfig ?. group_regex_filter } </ p >
88
+ < p css = { styles . secondary } > { group_regex_filter || "none" } </ p >
49
89
< h4 > Auto Create</ h4 >
50
90
< p css = { styles . secondary } >
51
91
{ oidcConfig ?. group_auto_create . toString ( ) }
@@ -56,16 +96,30 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
56
96
< legend css = { styles . legend } > Roles</ legend >
57
97
< Stack direction = { "row" } alignItems = { "center" } spacing = { 3 } >
58
98
< h4 > Sync Field</ h4 >
59
- < p css = { styles . secondary } > { oidcConfig ?. user_role_field } </ p >
99
+ < p css = { styles . secondary } >
100
+ { user_role_field || (
101
+ < Stack
102
+ style = { { color : theme . palette . text . secondary } }
103
+ direction = "row"
104
+ spacing = { 1 }
105
+ alignItems = "center"
106
+ >
107
+ < Circle color = { theme . roles . error . fill . solid } />
108
+ < p > disabled</ p >
109
+ </ Stack >
110
+ ) }
111
+ </ p >
60
112
</ Stack >
61
113
</ fieldset >
62
114
</ Stack >
63
115
< Stack spacing = { 6 } >
64
116
< IdpMappingTable
65
117
type = "Role"
66
118
isEmpty = { Boolean (
67
- ( oidcConfig ?. user_role_mapping &&
68
- Object . entries ( oidcConfig ?. user_role_mapping ) . length === 0 ) ||
119
+ ! oidcConfig ?. user_role_mapping ||
120
+ ( oidcConfig ?. user_role_mapping &&
121
+ Object . entries ( oidcConfig ?. user_role_mapping ) . length ===
122
+ 0 ) ||
69
123
false ,
70
124
) }
71
125
>
@@ -85,8 +139,9 @@ export const IdpSyncPageView: FC<IdpSyncPageViewProps> = ({ oidcConfig }) => {
85
139
< IdpMappingTable
86
140
type = "Group"
87
141
isEmpty = { Boolean (
88
- ( oidcConfig ?. user_role_mapping &&
89
- Object . entries ( oidcConfig ?. group_mapping ) . length === 0 ) ||
142
+ ! oidcConfig ?. group_mapping ||
143
+ ( oidcConfig ?. group_mapping &&
144
+ Object . entries ( oidcConfig ?. group_mapping ) . length === 0 ) ||
90
145
false ,
91
146
) }
92
147
>
0 commit comments