0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-27 21:39:16 -05:00

fix(console): log event filter (#3678)

This commit is contained in:
Gao Sun 2023-04-06 11:32:46 +08:00 committed by GitHub
parent d816734b20
commit 6cbc90389f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 55 deletions

View file

@ -0,0 +1,5 @@
---
"@logto/console": patch
---
ensure all log keys present in the filter, remove deprecated log keys, fix log event filter

View file

@ -12,7 +12,7 @@ function EventSelector({ value, onChange }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const options = Object.entries(logEventTitle).map(([value, title]) => ({
value,
title,
title: title ?? value,
}));
return (

View file

@ -39,7 +39,7 @@ function AuditLogTable({ userId, className }: Props) {
const url = buildUrl('api/logs', {
page: String(page),
page_size: String(pageSize),
...conditional(event && { logType: event }),
...conditional(event && { logKey: event }),
...conditional(applicationId && { applicationId }),
...conditional(userId && { userId }),
});

View file

@ -1,65 +1,54 @@
import type { LogKey } from '@logto/schemas';
import { type Optional } from '@silverhand/essentials';
type LogEventTitle = Record<string, string>;
/** @deprecated Don't use or update. @simeng-li clean up along with session api */
const logEventTitleLegacy: LogEventTitle = Object.freeze({
RegisterUsernamePassword: 'Register with username and password',
RegisterEmailSendPasscode: 'Register with email (send passcode)',
RegisterEmail: 'Register with email',
RegisterSmsSendPasscode: 'Register with SMS (send passcode)',
RegisterSms: 'Register with SMS',
RegisterSocialBind: 'Bind social account',
RegisterSocial: 'Register with social account',
SignInUsernamePassword: 'Sign in with username and password',
SignInEmailSendPasscode: 'Sign in with email (send passcode)',
SignInEmail: 'Register with email',
SignInSmsSendPasscode: 'Sign in with SMS (send passcode)',
SignInSms: 'Sign in with SMS',
SignInSocialBind: 'Sign in with social related account',
SignInSocial: 'Sign in with social account',
CodeExchangeToken: 'Exchange token by auth code',
RefreshTokenExchangeToken: 'Exchange token by refresh token',
RevokeToken: 'Revoke token',
});
export const logEventTitle: Record<string, string | undefined> & Partial<Record<LogKey, string>> =
export const logEventTitle: Record<string, Optional<string>> & Record<LogKey, Optional<string>> =
Object.freeze({
...logEventTitleLegacy,
'ExchangeTokenBy.AuthorizationCode': 'Exchange token by auth code',
'ExchangeTokenBy.RefreshToken': 'Exchange token by refresh token',
'ExchangeTokenBy.AuthorizationCode': 'Exchange token by Code',
'ExchangeTokenBy.ClientCredentials': 'Exchange token by Client Credentials',
'ExchangeTokenBy.RefreshToken': 'Exchange token by Refresh Token',
'ExchangeTokenBy.Unknown': undefined,
'Interaction.Create': 'Interaction started',
'Interaction.End': 'Interaction ended',
'Interaction.SignIn.Update': 'Update sign-in interaction',
'Interaction.SignIn.Submit': 'Submit sign-in interaction',
'Interaction.Register.Update': 'Update register interaction',
'Interaction.Register.Submit': 'Submit register interaction',
'Interaction.ForgotPassword.Update': 'Update forgot-password interaction',
'Interaction.ForgotPassword.Submit': 'Submit forgot-password interaction',
'Interaction.SignIn.Profile.Update': 'Patch Update sign-in interaction profile',
'Interaction.SignIn.Profile.Create': 'Put new sign-in interaction profile',
'Interaction.SignIn.Profile.Delete': 'Delete sign-in interaction profile',
'Interaction.Register.Profile.Update': 'Patch update register interaction profile',
'Interaction.Register.Profile.Create': 'Put new register interaction profile',
'Interaction.Register.Profile.Delete': 'Delete register interaction profile',
'Interaction.ForgotPassword.Profile.Update': 'Patch update forgot-password interaction profile',
'Interaction.ForgotPassword.Profile.Create': 'Put new forgot-password interaction profile',
'Interaction.ForgotPassword.Profile.Delete': 'Delete forgot-password interaction profile',
'Interaction.SignIn.Identifier.Password.Submit': 'Submit sign-in identifier with password',
'Interaction.ForgotPassword.Identifier.Password.Submit':
'Submit forgot-password identifier with password',
'Interaction.SignIn.Identifier.VerificationCode.Create':
'Create and send sign-in verification code',
'Interaction.SignIn.Identifier.VerificationCode.Submit':
'Submit and verify sign-in identifier with verification code',
'Interaction.SignIn.Identifier.Social.Create': 'Create social sign-in authorization-url',
'Interaction.SignIn.Identifier.Social.Submit': 'Authenticate and submit social identifier',
'Interaction.Register.Identifier.VerificationCode.Create':
'Create and send register identifier with verification code',
'Interaction.Register.Identifier.VerificationCode.Submit':
'Submit and verify register verification code',
'Interaction.ForgotPassword.Identifier.Social.Create': undefined,
'Interaction.ForgotPassword.Identifier.Social.Submit': undefined,
'Interaction.ForgotPassword.Identifier.VerificationCode.Create':
'Create and send forgot-password verification code',
'Interaction.ForgotPassword.Identifier.VerificationCode.Submit':
'Submit and verify forgot-password verification code',
'Interaction.ForgotPassword.Profile.Create': 'Put new forgot-password interaction profile',
'Interaction.ForgotPassword.Profile.Delete': 'Delete forgot-password interaction profile',
'Interaction.ForgotPassword.Profile.Update': 'Patch update forgot-password interaction profile',
'Interaction.ForgotPassword.Submit': 'Submit forgot-password interaction',
'Interaction.ForgotPassword.Update': 'Update forgot-password interaction',
'Interaction.Register.Identifier.Password.Submit': undefined,
'Interaction.Register.Identifier.Social.Create': undefined,
'Interaction.Register.Identifier.Social.Submit': undefined,
'Interaction.Register.Identifier.VerificationCode.Create':
'Create and send register identifier with verification code',
'Interaction.Register.Identifier.VerificationCode.Submit':
'Submit and verify register verification code',
'Interaction.Register.Profile.Create': 'Put new register interaction profile',
'Interaction.Register.Profile.Delete': 'Delete register interaction profile',
'Interaction.Register.Profile.Update': 'Patch update register interaction profile',
'Interaction.Register.Submit': 'Submit register interaction',
'Interaction.Register.Update': 'Update register interaction',
'Interaction.SignIn.Identifier.Password.Submit': 'Submit sign-in identifier with password',
'Interaction.SignIn.Identifier.Social.Create': 'Create social sign-in authorization-url',
'Interaction.SignIn.Identifier.Social.Submit': 'Authenticate and submit social identifier',
'Interaction.SignIn.Identifier.VerificationCode.Create':
'Create and send sign-in verification code',
'Interaction.SignIn.Identifier.VerificationCode.Submit':
'Submit and verify sign-in identifier with verification code',
'Interaction.SignIn.Profile.Create': 'Put new sign-in interaction profile',
'Interaction.SignIn.Profile.Delete': 'Delete sign-in interaction profile',
'Interaction.SignIn.Profile.Update': 'Patch Update sign-in interaction profile',
'Interaction.SignIn.Submit': 'Submit sign-in interaction',
'Interaction.SignIn.Update': 'Update sign-in interaction',
'TriggerHook.PostRegister': undefined,
'TriggerHook.PostResetPassword': undefined,
'TriggerHook.PostSignIn': undefined,
RevokeToken: undefined,
Unknown: undefined,
});