0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

feat(console): add impersonation tag to audit log (#6267)

This commit is contained in:
wangsijie 2024-07-19 17:00:00 +08:00 committed by GitHub
parent 2101280940
commit 477d8a7369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 1 deletions

View file

@ -4,6 +4,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
gap: _.unit(2);
.icon { .icon {
flex-shrink: 0; flex-shrink: 0;

View file

@ -4,6 +4,7 @@ import { Link } from 'react-router-dom';
import Failed from '@/assets/icons/failed.svg'; import Failed from '@/assets/icons/failed.svg';
import Success from '@/assets/icons/success.svg'; import Success from '@/assets/icons/success.svg';
import { logEventTitle } from '@/consts/logs'; import { logEventTitle } from '@/consts/logs';
import Tag from '@/ds-components/Tag';
import useTenantPathname from '@/hooks/use-tenant-pathname'; import useTenantPathname from '@/hooks/use-tenant-pathname';
import * as styles from './index.module.scss'; import * as styles from './index.module.scss';
@ -35,6 +36,7 @@ function EventName({ eventKey, isSuccess, to }: Props) {
</Link> </Link>
)} )}
{!to && <div className={styles.title}>{title}</div>} {!to && <div className={styles.title}>{title}</div>}
{eventKey === 'ExchangeTokenBy.TokenExchange' && <Tag status="alert">Impersonation</Tag>}
</div> </div>
); );
} }

View file

@ -7,6 +7,7 @@ export const auditLogEventTitle: Record<string, Optional<string>> & {
'ExchangeTokenBy.AuthorizationCode': 'Exchange token by Code', 'ExchangeTokenBy.AuthorizationCode': 'Exchange token by Code',
'ExchangeTokenBy.ClientCredentials': 'Exchange token by Client Credentials', 'ExchangeTokenBy.ClientCredentials': 'Exchange token by Client Credentials',
'ExchangeTokenBy.RefreshToken': 'Exchange token by Refresh Token', 'ExchangeTokenBy.RefreshToken': 'Exchange token by Refresh Token',
'ExchangeTokenBy.TokenExchange': 'Token exchange',
'Interaction.Create': 'Interaction started', 'Interaction.Create': 'Interaction started',
'Interaction.End': 'Interaction ended', 'Interaction.End': 'Interaction ended',
'Interaction.ForgotPassword.Identifier.VerificationCode.Create': 'Interaction.ForgotPassword.Identifier.VerificationCode.Create':

View file

@ -14,6 +14,9 @@
.eventName { .eventName {
color: var(--color-text); color: var(--color-text);
font: var(--font-title-1); font: var(--font-title-1);
display: flex;
align-items: center;
gap: _.unit(2);
} }
.basicInfo { .basicInfo {

View file

@ -16,6 +16,7 @@ import CodeEditor from '@/ds-components/CodeEditor';
import DangerousRaw from '@/ds-components/DangerousRaw'; import DangerousRaw from '@/ds-components/DangerousRaw';
import FormField from '@/ds-components/FormField'; import FormField from '@/ds-components/FormField';
import TabNav, { TabNavItem } from '@/ds-components/TabNav'; import TabNav, { TabNavItem } from '@/ds-components/TabNav';
import Tag from '@/ds-components/Tag';
import type { RequestError } from '@/hooks/use-api'; import type { RequestError } from '@/hooks/use-api';
import { isWebhookEventLogKey } from '@/pages/WebhookDetails/utils'; import { isWebhookEventLogKey } from '@/pages/WebhookDetails/utils';
import { getUserTitle } from '@/utils/user'; import { getUserTitle } from '@/utils/user';
@ -84,7 +85,12 @@ function AuditLogDetails() {
<Card className={styles.header}> <Card className={styles.header}>
<EventIcon isSuccess={data.payload.result === 'Success'} /> <EventIcon isSuccess={data.payload.result === 'Success'} />
<div className={styles.content}> <div className={styles.content}>
<div className={styles.eventName}>{logEventTitle[data.key]}</div> <div className={styles.eventName}>
{logEventTitle[data.key]}
{data.key === 'ExchangeTokenBy.TokenExchange' && (
<Tag status="alert">Impersonation</Tag>
)}
</div>
<div className={styles.basicInfo}> <div className={styles.basicInfo}>
<div className={styles.infoItem}> <div className={styles.infoItem}>
<div className={styles.label}>{t('log_details.event_key')}</div> <div className={styles.label}>{t('log_details.event_key')}</div>