Extra audit filters
This commit is contained in:
parent
63f54c3338
commit
1b090be2bf
@ -141,6 +141,7 @@
|
|||||||
"user": "Actor",
|
"user": "Actor",
|
||||||
"ip": "IP address",
|
"ip": "IP address",
|
||||||
"ua": "User agent",
|
"ua": "User agent",
|
||||||
|
"flagged": "Flagged",
|
||||||
"createdAt": "Created at"
|
"createdAt": "Created at"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ export const load = async ({ url, parent }) => {
|
|||||||
let actions: AuditAction[] | undefined = undefined;
|
let actions: AuditAction[] | undefined = undefined;
|
||||||
let user: string | undefined = undefined;
|
let user: string | undefined = undefined;
|
||||||
let content: string | undefined = undefined;
|
let content: string | undefined = undefined;
|
||||||
|
let ip: string | undefined = undefined;
|
||||||
|
let flagged: boolean | undefined = undefined;
|
||||||
if (url.searchParams.has('page')) {
|
if (url.searchParams.has('page')) {
|
||||||
page = Number(url.searchParams.get('page')) || 1;
|
page = Number(url.searchParams.get('page')) || 1;
|
||||||
}
|
}
|
||||||
@ -33,9 +35,17 @@ export const load = async ({ url, parent }) => {
|
|||||||
content = url.searchParams.get('content') as string;
|
content = url.searchParams.get('content') as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (url.searchParams.has('ip')) {
|
||||||
|
ip = url.searchParams.get('ip') as string;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url.searchParams.has('flagged')) {
|
||||||
|
flagged = !!url.searchParams.get('flagged');
|
||||||
|
}
|
||||||
|
|
||||||
const offset = (page - 1) * limit;
|
const offset = (page - 1) * limit;
|
||||||
|
|
||||||
const data = await Audit.searchAudit({ limit, offset, actions, user, content });
|
const data = await Audit.searchAudit({ limit, offset, actions, user, content, ip, flagged });
|
||||||
return {
|
return {
|
||||||
...data,
|
...data,
|
||||||
actions: Object.values(AuditAction)
|
actions: Object.values(AuditAction)
|
||||||
|
@ -25,7 +25,12 @@
|
|||||||
<SplitView>
|
<SplitView>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<label for="actions">{$t('admin.audit.action')}</label>
|
<label for="actions">{$t('admin.audit.action')}</label>
|
||||||
<select name="actions" value={$page.url.searchParams.getAll('actions')} multiple>
|
<select
|
||||||
|
name="actions"
|
||||||
|
id="actions"
|
||||||
|
value={$page.url.searchParams.getAll('actions')}
|
||||||
|
multiple
|
||||||
|
>
|
||||||
{#each data.actions as action}
|
{#each data.actions as action}
|
||||||
<option value={action}>{action}</option>
|
<option value={action}>{action}</option>
|
||||||
{/each}
|
{/each}
|
||||||
@ -33,7 +38,22 @@
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<label for="content">{$t('admin.audit.comment')}</label>
|
<label for="content">{$t('admin.audit.comment')}</label>
|
||||||
<input name="content" value={$page.url.searchParams.get('content')} />
|
<input name="content" id="content" value={$page.url.searchParams.get('content')} />
|
||||||
|
</FormControl>
|
||||||
|
</SplitView>
|
||||||
|
<SplitView>
|
||||||
|
<FormControl>
|
||||||
|
<label for="flagged">{$t('admin.audit.flagged')}</label>
|
||||||
|
<input
|
||||||
|
name="flagged"
|
||||||
|
id="flagged"
|
||||||
|
type="checkbox"
|
||||||
|
checked={!!$page.url.searchParams.get('flagged')}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl>
|
||||||
|
<label for="ip">{$t('admin.audit.ip')}</label>
|
||||||
|
<input name="ip" id="ip" value={$page.url.searchParams.get('ip')} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</SplitView>
|
</SplitView>
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user