From ec2df4d3cf110dbd154f9df9824432d275138801 Mon Sep 17 00:00:00 2001 From: Xiao Yijun Date: Mon, 3 Jun 2024 10:51:10 +0800 Subject: [PATCH] fix(console): only show m2m role notification for m2m roles (#5957) --- packages/console/src/pages/RoleDetails/index.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/console/src/pages/RoleDetails/index.tsx b/packages/console/src/pages/RoleDetails/index.tsx index f31adfc9d..6aedbda4d 100644 --- a/packages/console/src/pages/RoleDetails/index.tsx +++ b/packages/console/src/pages/RoleDetails/index.tsx @@ -61,6 +61,8 @@ function RoleDetails() { ? Boolean(m2mRoleNotificationAcknowledged) : true; + const isM2mRole = data?.type === RoleType.MachineToMachine; + const [isDeletionAlertOpen, setIsDeletionAlertOpen] = useState(false); useEffect(() => { @@ -98,7 +100,7 @@ function RoleDetails() { onRetry={mutate} > {/* Todo @xiaoyijun remove dev feature flag */} - {isDevFeaturesEnabled && !isM2mRoleNotificationAcknowledged && ( + {isDevFeaturesEnabled && isM2mRole && !isM2mRoleNotificationAcknowledged && ( { @@ -119,12 +121,10 @@ function RoleDetails() { {data && ( <> : } + icon={isM2mRole ? : } title={data.name} primaryTag={t( - data.type === RoleType.User - ? 'role_details.type_user_role_tag' - : 'role_details.type_m2m_role_tag' + isM2mRole ? 'role_details.type_m2m_role_tag' : 'role_details.type_user_role_tag' )} identifier={{ name: 'ID', value: data.id }} actionMenuItems={[ @@ -155,12 +155,10 @@ function RoleDetails() { - {t( - data.type === RoleType.User ? 'role_details.users_tab' : 'role_details.m2m_apps_tab' - )} + {t(isM2mRole ? 'role_details.m2m_apps_tab' : 'role_details.users_tab')} {t('role_details.general_tab')}