style: clean up code with prettier and eslint
This commit is contained in:
1 parent
60278b9e71
commit
fb8e77bb68
378 files changed
+22407
-20689
No files matched your search
@@ -1,38 +1,38 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import { DataTable } from '@/components/admin/data-table'
|
||||
import { formatTimestamp } from '@/lib/admin-helpers'
|
||||
import type { DataTableColumn, PaginatedResult } from '@/types'
|
||||
import { DataTable } from "@/components/admin/data-table";
|
||||
import { formatTimestamp } from "@/lib/admin-helpers";
|
||||
import type { DataTableColumn, PaginatedResult } from "@/types";
|
||||
|
||||
interface CommandLogRow {
|
||||
id: number
|
||||
username: string
|
||||
command: string
|
||||
params: string
|
||||
timestamp: number
|
||||
id: number;
|
||||
username: string;
|
||||
command: string;
|
||||
params: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<CommandLogRow>[] = [
|
||||
{ key: 'id', label: 'ID', sortable: true },
|
||||
{ key: 'username', label: 'User' },
|
||||
{ key: 'command', label: 'Command', sortable: true },
|
||||
{ key: "id", label: "ID", sortable: true },
|
||||
{ key: "username", label: "User" },
|
||||
{ key: "command", label: "Command", sortable: true },
|
||||
{
|
||||
key: 'params',
|
||||
label: 'Params',
|
||||
key: "params",
|
||||
label: "Params",
|
||||
render: (value) => (
|
||||
<span className="max-w-[200px] truncate block font-mono text-sm">{String(value) || '-'}</span>
|
||||
<span className="max-w-[200px] truncate block font-mono text-sm">{String(value) || "-"}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'timestamp',
|
||||
label: 'Time',
|
||||
key: "timestamp",
|
||||
label: "Time",
|
||||
sortable: true,
|
||||
render: (value) => <span>{formatTimestamp(Number(value))}</span>,
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
interface CommandsTableProps {
|
||||
data: PaginatedResult<CommandLogRow>
|
||||
data: PaginatedResult<CommandLogRow>;
|
||||
}
|
||||
|
||||
export function CommandsTable({ data }: CommandsTableProps) {
|
||||
@@ -43,5 +43,5 @@ export function CommandsTable({ data }: CommandsTableProps) {
|
||||
searchPlaceholder="Search by username, command, or params..."
|
||||
exportUrl="/api/admin/export?type=commands"
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
|
||||
export default function CommandLogsLoading() {
|
||||
return (
|
||||
@@ -24,5 +24,5 @@ export default function CommandLogsLoading() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
import { fetchAdminList } from '@/lib/admin-list'
|
||||
import { PERMS } from '@/lib/permissions'
|
||||
import { CommandsTable } from './commands-table'
|
||||
import { fetchAdminList } from "@/lib/admin-list";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { CommandsTable } from "./commands-table";
|
||||
|
||||
export default async function CommandLogsPage({
|
||||
params: paramsPromise,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ locale: string }>
|
||||
searchParams: Promise<Record<string, string>>
|
||||
params: Promise<{ locale: string }>;
|
||||
searchParams: Promise<Record<string, string>>;
|
||||
}) {
|
||||
const result = await fetchAdminList(
|
||||
{
|
||||
permission: PERMS.LOGS_VIEW,
|
||||
model: 'commandLog',
|
||||
searchFields: ['command', 'params', 'user.username'],
|
||||
model: "commandLog",
|
||||
searchFields: ["command", "params", "user.username"],
|
||||
defaultPerPage: 50,
|
||||
include: { user: { select: { username: true } } },
|
||||
mapRow: (l) => ({
|
||||
@@ -26,7 +26,7 @@ export default async function CommandLogsPage({
|
||||
},
|
||||
paramsPromise,
|
||||
searchParams,
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
@@ -45,5 +45,5 @@ export default async function CommandLogsPage({
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user