feat: location filter for global audit log (#662)

This commit is contained in:
Kyle Mendell
2025-06-19 12:12:53 -05:00
committed by GitHub
parent 481df3bcb9
commit ac5a121f66
11 changed files with 48 additions and 8 deletions

View File

@@ -320,6 +320,7 @@
"all_users": "All Users",
"all_events": "All Events",
"all_clients": "All Clients",
"all_locations": "All Locations",
"global_audit_log": "Global Audit Log",
"see_all_account_activities_from_the_last_3_months": "See all user activity for the last 3 months.",
"token_sign_in": "Token Sign In",

View File

@@ -14,6 +14,7 @@
onSelect,
oninput,
isLoading,
disableSearch = false,
selectText = m.select_an_option(),
...restProps
}: HTMLAttributes<HTMLButtonElement> & {
@@ -25,6 +26,7 @@
oninput?: FormEventHandler<HTMLInputElement>;
onSelect?: (value: string) => void;
isLoading?: boolean;
disableSearch?: boolean;
selectText?: string;
} = $props();
@@ -76,13 +78,15 @@
</Popover.Trigger>
<Popover.Content class="p-0" sameWidth>
<Command.Root shouldFilter={false}>
<Command.Input
placeholder={m.search()}
oninput={(e) => {
filterItems(e.currentTarget.value);
oninput?.(e);
}}
/>
{#if !disableSearch}
<Command.Input
placeholder={m.search()}
oninput={(e) => {
filterItems(e.currentTarget.value);
oninput?.(e);
}}
/>
{/if}
<Command.Empty>
{#if isLoading}
<div class="flex w-full justify-center">

View File

@@ -14,5 +14,6 @@ export type AuditLog = {
export type AuditLogFilter = {
userId: string;
event: string;
location: string;
clientName: string;
};

View File

@@ -18,9 +18,15 @@
let filters: AuditLogFilter = $state({
userId: '',
event: '',
location: '',
clientName: ''
});
const locationTypes = $state({
external: 'External Networks',
internal: 'Internal Networks'
});
const eventTypes = $state({
SIGN_IN: m.sign_in(),
TOKEN_SIGN_IN: m.token_sign_in(),
@@ -47,7 +53,7 @@
>
</Card.Header>
<Card.Content>
<div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-3">
<div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-4">
<div>
{#await auditLogService.listUsers()}
<Select.Root type="single">
@@ -82,6 +88,20 @@
bind:value={filters.event}
/>
</div>
<div>
<SearchableSelect
disableSearch={true}
class="w-full"
items={[
{ value: '', label: m.all_locations() },
...Object.entries(locationTypes).map(([value, label]) => ({
value,
label
}))
]}
bind:value={filters.location}
/>
</div>
<div>
{#await auditLogService.listClientNames()}
<Select.Root