mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
noBasicRole feature: Change RolePickerInput to not show the "None" role (#76300)
Change RolePickerInput to only show the basic role when it's not the None role (no basic role feature)
This commit is contained in:
parent
2049ffc718
commit
c2cbb0a924
@ -49,18 +49,22 @@ export const RolePickerInput = ({
|
||||
onQueryChange(query);
|
||||
};
|
||||
|
||||
const numberOfRoles = appliedRoles.length;
|
||||
const showBasicRoleOnLabel = showBasicRole && basicRole !== 'None';
|
||||
|
||||
return !isFocused ? (
|
||||
// TODO: fix keyboard a11y
|
||||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
||||
<div className={cx(styles.wrapper, styles.selectedRoles)} onMouseDown={onOpen}>
|
||||
{showBasicRole && <ValueContainer>{basicRole}</ValueContainer>}
|
||||
<RolesLabel appliedRoles={appliedRoles} numberOfRoles={numberOfRoles} showBuiltInRole={showBasicRole} />
|
||||
{showBasicRoleOnLabel && <ValueContainer>{basicRole}</ValueContainer>}
|
||||
<RolesLabel
|
||||
appliedRoles={appliedRoles}
|
||||
numberOfRoles={appliedRoles.length}
|
||||
showBuiltInRole={showBasicRoleOnLabel}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.wrapper}>
|
||||
{showBasicRole && <ValueContainer>{basicRole}</ValueContainer>}
|
||||
{showBasicRoleOnLabel && <ValueContainer>{basicRole}</ValueContainer>}
|
||||
{appliedRoles.map((role) => (
|
||||
<ValueContainer key={role.uid}>{role.displayName || role.name}</ValueContainer>
|
||||
))}
|
||||
|
Loading…
Reference in New Issue
Block a user