Skip to content

Commit

Permalink
fix(console): only show m2m role notification for m2m roles (#5957)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyijun authored Jun 3, 2024
1 parent a72b715 commit ec2df4d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/console/src/pages/RoleDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function RoleDetails() {
? Boolean(m2mRoleNotificationAcknowledged)
: true;

const isM2mRole = data?.type === RoleType.MachineToMachine;

const [isDeletionAlertOpen, setIsDeletionAlertOpen] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -98,7 +100,7 @@ function RoleDetails() {
onRetry={mutate}
>
{/* Todo @xiaoyijun remove dev feature flag */}
{isDevFeaturesEnabled && !isM2mRoleNotificationAcknowledged && (
{isDevFeaturesEnabled && isM2mRole && !isM2mRoleNotificationAcknowledged && (
<InlineNotification
action="general.got_it"
onClick={() => {
Expand All @@ -119,12 +121,10 @@ function RoleDetails() {
{data && (
<>
<DetailsPageHeader
icon={data.type === RoleType.User ? <UserIcon /> : <MachineToMachineIcon />}
icon={isM2mRole ? <MachineToMachineIcon /> : <UserIcon />}
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={[
Expand Down Expand Up @@ -155,12 +155,10 @@ function RoleDetails() {
</TabNavItem>
<TabNavItem
href={`/roles/${data.id}/${
data.type === RoleType.User ? RoleDetailsTabs.Users : RoleDetailsTabs.M2mApps
isM2mRole ? RoleDetailsTabs.M2mApps : RoleDetailsTabs.Users
}`}
>
{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')}
</TabNavItem>
<TabNavItem href={`/roles/${data.id}/${RoleDetailsTabs.General}`}>
{t('role_details.general_tab')}
Expand Down

0 comments on commit ec2df4d

Please sign in to comment.