File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
plugins/rbac/src/components/CreateRole Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,14 @@ export const PermissionPoliciesForm = ({
149
149
}
150
150
onRemove = { ( ) => onRowRemove ( index ) }
151
151
handleBlur = { handleBlur }
152
+ getPermissionDisabled = { ( permission : string ) => {
153
+ const pluginPermissionPolicies = permissionPoliciesRows . filter (
154
+ ppr => ppr . plugin === pp . plugin ,
155
+ ) ;
156
+ return ! ! pluginPermissionPolicies . find (
157
+ ppp => ppp . permission === permission ,
158
+ ) ;
159
+ } }
152
160
/>
153
161
) ) }
154
162
< Button className = { classes . addButton } size = "small" onClick = { onRowAdd } >
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ type PermissionPoliciesFormRowProps = {
28
28
onChangePermission : ( permission : string , policies ?: string [ ] ) => void ;
29
29
onChangePolicy : ( isChecked : boolean , policyIndex : number ) => void ;
30
30
handleBlur : React . FocusEventHandler < HTMLInputElement | HTMLTextAreaElement > ;
31
+ getPermissionDisabled : ( permission : string ) => boolean ;
31
32
} ;
32
33
33
34
export const PermissionPoliciesFormRow = ( {
@@ -41,6 +42,7 @@ export const PermissionPoliciesFormRow = ({
41
42
onChangePolicy,
42
43
onChangePlugin,
43
44
handleBlur,
45
+ getPermissionDisabled,
44
46
} : PermissionPoliciesFormRowProps ) => {
45
47
const classes = useStyles ( ) ;
46
48
const [ pluginSearch , setPluginSearch ] = React . useState ( '' ) ;
@@ -97,6 +99,7 @@ export const PermissionPoliciesFormRow = ({
97
99
}
98
100
inputValue = { permissionSearch }
99
101
onInputChange = { ( _e , newSearch ) => setPermissionSearch ( newSearch ) }
102
+ getOptionDisabled = { getPermissionDisabled }
100
103
renderInput = { params => (
101
104
< TextField
102
105
{ ...params }
You can’t perform that action at this time.
0 commit comments