mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fix
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
import { Fragment, useState } from "react";
|
import { Fragment, useState } from "react";
|
||||||
import { Table, Text, Group, Skeleton, Anchor, Collapse, Box } from "@mantine/core";
|
import {
|
||||||
|
Table,
|
||||||
|
Text,
|
||||||
|
Group,
|
||||||
|
Skeleton,
|
||||||
|
Anchor,
|
||||||
|
Collapse,
|
||||||
|
Box,
|
||||||
|
} from "@mantine/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
@@ -67,7 +75,12 @@ function ChangesDiff({ changes }: { changes: IAuditLog["changes"] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Group key={key} gap={6} mb={2} wrap="nowrap" align="center">
|
<Group key={key} gap={6} mb={2} wrap="nowrap" align="center">
|
||||||
<Text fz="xs" c="dimmed" fw={500} style={{ minWidth: "fit-content" }}>
|
<Text
|
||||||
|
fz="xs"
|
||||||
|
c="dimmed"
|
||||||
|
fw={500}
|
||||||
|
style={{ minWidth: "fit-content" }}
|
||||||
|
>
|
||||||
{key}:
|
{key}:
|
||||||
</Text>
|
</Text>
|
||||||
{hasBefore && (
|
{hasBefore && (
|
||||||
@@ -143,7 +156,11 @@ function TableSkeleton() {
|
|||||||
|
|
||||||
function ResourceCell({ entry }: { entry: IAuditLog }) {
|
function ResourceCell({ entry }: { entry: IAuditLog }) {
|
||||||
if (!entry.resource?.name) {
|
if (!entry.resource?.name) {
|
||||||
return <Text fz="sm" c="dimmed">—</Text>;
|
return (
|
||||||
|
<Text fz="sm" c="dimmed">
|
||||||
|
—
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = getResourceUrl(entry);
|
const url = getResourceUrl(entry);
|
||||||
@@ -218,16 +235,24 @@ export default function AuditLogsTable({
|
|||||||
return (
|
return (
|
||||||
<Fragment key={entry.id}>
|
<Fragment key={entry.id}>
|
||||||
<Table.Tr
|
<Table.Tr
|
||||||
onClick={expandable ? () => toggleExpanded(entry.id) : undefined}
|
onClick={
|
||||||
|
expandable ? () => toggleExpanded(entry.id) : undefined
|
||||||
|
}
|
||||||
style={{ cursor: expandable ? "pointer" : undefined }}
|
style={{ cursor: expandable ? "pointer" : undefined }}
|
||||||
>
|
>
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
<Group gap="sm" wrap="nowrap">
|
<Group gap="sm" wrap="nowrap">
|
||||||
{expandable ? (
|
{expandable ? (
|
||||||
isExpanded ? (
|
isExpanded ? (
|
||||||
<IconChevronDown size={16} color="var(--mantine-color-dimmed)" />
|
<IconChevronDown
|
||||||
|
size={16}
|
||||||
|
color="var(--mantine-color-dimmed)"
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<IconChevronRight size={16} color="var(--mantine-color-dimmed)" />
|
<IconChevronRight
|
||||||
|
size={16}
|
||||||
|
color="var(--mantine-color-dimmed)"
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<Box w={16} />
|
<Box w={16} />
|
||||||
@@ -252,7 +277,7 @@ export default function AuditLogsTable({
|
|||||||
<Text fz="sm" c="dimmed" fs="italic">
|
<Text fz="sm" c="dimmed" fs="italic">
|
||||||
{entry.actorType === "system"
|
{entry.actorType === "system"
|
||||||
? t("System")
|
? t("System")
|
||||||
: t("API key")}
|
: t("System")}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
@@ -274,15 +299,21 @@ export default function AuditLogsTable({
|
|||||||
</Table.Tr>
|
</Table.Tr>
|
||||||
|
|
||||||
{expandable && (
|
{expandable && (
|
||||||
<Table.Tr
|
<Table.Tr className={classes.detailRow}>
|
||||||
className={classes.detailRow}
|
|
||||||
>
|
|
||||||
<Table.Td colSpan={4} p={0}>
|
<Table.Td colSpan={4} p={0}>
|
||||||
<Collapse in={isExpanded}>
|
<Collapse in={isExpanded}>
|
||||||
<Box px="md" py="sm" className={classes.detailContent}>
|
<Box
|
||||||
|
px="md"
|
||||||
|
py="sm"
|
||||||
|
className={classes.detailContent}
|
||||||
|
>
|
||||||
<Group gap="xl" align="flex-start">
|
<Group gap="xl" align="flex-start">
|
||||||
{entry.changes && <ChangesDiff changes={entry.changes} />}
|
{entry.changes && (
|
||||||
{entry.metadata && <MetadataDisplay metadata={entry.metadata} />}
|
<ChangesDiff changes={entry.changes} />
|
||||||
|
)}
|
||||||
|
{entry.metadata && (
|
||||||
|
<MetadataDisplay metadata={entry.metadata} />
|
||||||
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ export const EXCLUDED_AUDIT_EVENTS: Set<string> = new Set([
|
|||||||
AuditEvent.COMMENT_UPDATED,
|
AuditEvent.COMMENT_UPDATED,
|
||||||
AuditEvent.COMMENT_RESOLVED,
|
AuditEvent.COMMENT_RESOLVED,
|
||||||
AuditEvent.COMMENT_REOPENED,
|
AuditEvent.COMMENT_REOPENED,
|
||||||
|
AuditEvent.ATTACHMENT_UPLOADED
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const AuditResource = {
|
export const AuditResource = {
|
||||||
|
|||||||
Reference in New Issue
Block a user