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

refactor(console): user logs (#2512)

This commit is contained in:
Xiao Yijun 2022-11-24 13:38:04 +08:00 committed by GitHub
parent db9a054786
commit c5595ee7d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 13 deletions

View file

@ -1,5 +1,11 @@
@use '@/scss/underscore' as _; @use '@/scss/underscore' as _;
.container {
display: flex;
flex-direction: column;
height: 100%;
}
.filter { .filter {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
@ -28,6 +34,9 @@
.tableLayout { .tableLayout {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-height: 100%;
overflow-y: auto;
flex: 1;
.tableContainer { .tableContainer {
border-top-left-radius: 0; border-top-left-radius: 0;

View file

@ -13,7 +13,6 @@ import TableError from '@/components/Table/TableError';
import TableLoading from '@/components/Table/TableLoading'; import TableLoading from '@/components/Table/TableLoading';
import UserName from '@/components/UserName'; import UserName from '@/components/UserName';
import type { RequestError } from '@/hooks/use-api'; import type { RequestError } from '@/hooks/use-api';
import * as resourcesStyles from '@/scss/resources.module.scss';
import * as tableStyles from '@/scss/table.module.scss'; import * as tableStyles from '@/scss/table.module.scss';
import ApplicationSelector from './components/ApplicationSelector'; import ApplicationSelector from './components/ApplicationSelector';
@ -69,8 +68,8 @@ const AuditLogTable = ({ userId }: Props) => {
}; };
return ( return (
<> <div className={styles.container}>
<div className={classNames(resourcesStyles.table, styles.tableLayout)}> <div className={styles.tableLayout}>
<div className={styles.filter}> <div className={styles.filter}>
<div className={styles.title}>{t('logs.filter_by')}</div> <div className={styles.title}>{t('logs.filter_by')}</div>
<div className={styles.eventSelector}> <div className={styles.eventSelector}>
@ -153,7 +152,7 @@ const AuditLogTable = ({ userId }: Props) => {
updateQuery('page', String(page)); updateQuery('page', String(page));
}} }}
/> />
</> </div>
); );
}; };

View file

@ -8,7 +8,9 @@ const AuditLogs = () => {
<div className={resourcesStyles.headline}> <div className={resourcesStyles.headline}>
<CardTitle title="logs.title" subtitle="logs.subtitle" /> <CardTitle title="logs.title" subtitle="logs.subtitle" />
</div> </div>
<AuditLogTable /> <div className={resourcesStyles.table}>
<AuditLogTable />
</div>
</div> </div>
); );
}; };

View file

@ -1,9 +1,7 @@
@use '@/scss/underscore' as _; @use '@/scss/underscore' as _;
.logs { .logs {
flex: 1;
margin-bottom: _.unit(6); margin-bottom: _.unit(6);
overflow-y: auto;
>:not(:first-child) {
margin-top: _.unit(3);
}
} }

View file

@ -1,5 +1,4 @@
import AuditLogTable from '@/components/AuditLogTable'; import AuditLogTable from '@/components/AuditLogTable';
import Card from '@/components/Card';
import * as styles from './UserLogs.module.scss'; import * as styles from './UserLogs.module.scss';
@ -9,9 +8,9 @@ type Props = {
const UserLogs = ({ userId }: Props) => { const UserLogs = ({ userId }: Props) => {
return ( return (
<Card className={styles.logs}> <div className={styles.logs}>
<AuditLogTable userId={userId} /> <AuditLogTable userId={userId} />
</Card> </div>
); );
}; };

View file

@ -4,6 +4,10 @@
margin: _.unit(1) 0 0 _.unit(1); margin: _.unit(1) 0 0 _.unit(1);
} }
.resourceLayout {
height: 100%;
}
.header { .header {
padding: _.unit(6); padding: _.unit(6);
display: flex; display: flex;

View file

@ -1,4 +1,5 @@
import type { User } from '@logto/schemas'; import type { User } from '@logto/schemas';
import classNames from 'classnames';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { toast } from 'react-hot-toast'; import { toast } from 'react-hot-toast';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -78,7 +79,7 @@ const UserDetails = () => {
}; };
return ( return (
<div className={detailsStyles.container}> <div className={classNames(detailsStyles.container, isLogs && styles.resourceLayout)}>
<LinkButton <LinkButton
to="/users" to="/users"
icon={<Back />} icon={<Back />}