0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): only show m2m role notification for m2m roles (#5957)

This commit is contained in:
Xiao Yijun 2024-06-03 10:51:10 +08:00 committed by GitHub
parent a72b71516b
commit ec2df4d3cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,6 +61,8 @@ function RoleDetails() {
? Boolean(m2mRoleNotificationAcknowledged) ? Boolean(m2mRoleNotificationAcknowledged)
: true; : true;
const isM2mRole = data?.type === RoleType.MachineToMachine;
const [isDeletionAlertOpen, setIsDeletionAlertOpen] = useState(false); const [isDeletionAlertOpen, setIsDeletionAlertOpen] = useState(false);
useEffect(() => { useEffect(() => {
@ -98,7 +100,7 @@ function RoleDetails() {
onRetry={mutate} onRetry={mutate}
> >
{/* Todo @xiaoyijun remove dev feature flag */} {/* Todo @xiaoyijun remove dev feature flag */}
{isDevFeaturesEnabled && !isM2mRoleNotificationAcknowledged && ( {isDevFeaturesEnabled && isM2mRole && !isM2mRoleNotificationAcknowledged && (
<InlineNotification <InlineNotification
action="general.got_it" action="general.got_it"
onClick={() => { onClick={() => {
@ -119,12 +121,10 @@ function RoleDetails() {
{data && ( {data && (
<> <>
<DetailsPageHeader <DetailsPageHeader
icon={data.type === RoleType.User ? <UserIcon /> : <MachineToMachineIcon />} icon={isM2mRole ? <MachineToMachineIcon /> : <UserIcon />}
title={data.name} title={data.name}
primaryTag={t( primaryTag={t(
data.type === RoleType.User isM2mRole ? 'role_details.type_m2m_role_tag' : 'role_details.type_user_role_tag'
? 'role_details.type_user_role_tag'
: 'role_details.type_m2m_role_tag'
)} )}
identifier={{ name: 'ID', value: data.id }} identifier={{ name: 'ID', value: data.id }}
actionMenuItems={[ actionMenuItems={[
@ -155,12 +155,10 @@ function RoleDetails() {
</TabNavItem> </TabNavItem>
<TabNavItem <TabNavItem
href={`/roles/${data.id}/${ href={`/roles/${data.id}/${
data.type === RoleType.User ? RoleDetailsTabs.Users : RoleDetailsTabs.M2mApps isM2mRole ? RoleDetailsTabs.M2mApps : RoleDetailsTabs.Users
}`} }`}
> >
{t( {t(isM2mRole ? 'role_details.m2m_apps_tab' : 'role_details.users_tab')}
data.type === RoleType.User ? 'role_details.users_tab' : 'role_details.m2m_apps_tab'
)}
</TabNavItem> </TabNavItem>
<TabNavItem href={`/roles/${data.id}/${RoleDetailsTabs.General}`}> <TabNavItem href={`/roles/${data.id}/${RoleDetailsTabs.General}`}>
{t('role_details.general_tab')} {t('role_details.general_tab')}