mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
RolePicker: Only select roles that is delegatable when selecting a group (#51246)
This commit is contained in:
parent
d2ab3556fa
commit
8b82bebdc5
@ -118,14 +118,15 @@ export const RolePickerMenu = ({
|
||||
const group = optionGroups.find((g) => {
|
||||
return g.value === value;
|
||||
});
|
||||
if (groupSelected(value)) {
|
||||
if (groupSelected(value) || groupPartiallySelected(value)) {
|
||||
if (group) {
|
||||
setSelectedOptions(selectedOptions.filter((role) => !group.options.find((option) => role.uid === option.uid)));
|
||||
}
|
||||
} else {
|
||||
if (group) {
|
||||
const groupOptions = group.options.filter((role) => role.delegatable);
|
||||
const restOptions = selectedOptions.filter((role) => !group.options.find((option) => role.uid === option.uid));
|
||||
setSelectedOptions([...restOptions, ...group.options]);
|
||||
setSelectedOptions([...restOptions, ...groupOptions]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user