From c2cbb0a924db1763b48ce98b4ab6b52db21bc73b Mon Sep 17 00:00:00 2001 From: Aaron Godin Date: Wed, 11 Oct 2023 09:42:09 -0500 Subject: [PATCH] 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) --- .../core/components/RolePicker/RolePickerInput.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/app/core/components/RolePicker/RolePickerInput.tsx b/public/app/core/components/RolePicker/RolePickerInput.tsx index df3ddfadedb..355daa65b46 100644 --- a/public/app/core/components/RolePicker/RolePickerInput.tsx +++ b/public/app/core/components/RolePicker/RolePickerInput.tsx @@ -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
- {showBasicRole && {basicRole}} - + {showBasicRoleOnLabel && {basicRole}} +
) : (
- {showBasicRole && {basicRole}} + {showBasicRoleOnLabel && {basicRole}} {appliedRoles.map((role) => ( {role.displayName || role.name} ))}