mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
feat: add a token column to the audit logs table
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
00f26d6b3b
commit
937c89a0d9
@@ -18,6 +18,7 @@
|
||||
selectedId?: number | undefined
|
||||
usernameFilter?: string | undefined
|
||||
resourceFilter?: string | undefined
|
||||
tokenFilter?: string | undefined
|
||||
showWorkspace?: boolean
|
||||
loading?: boolean
|
||||
loadingExtra?: boolean
|
||||
@@ -38,6 +39,7 @@
|
||||
selectedId = undefined,
|
||||
usernameFilter = $bindable(),
|
||||
resourceFilter = $bindable(),
|
||||
tokenFilter = $bindable(),
|
||||
showWorkspace = false,
|
||||
batchProgress = null,
|
||||
batchSize = null,
|
||||
@@ -49,6 +51,11 @@
|
||||
onLoadMore
|
||||
}: Props = $props()
|
||||
|
||||
// `span` is the caller's token prefix, except on entries a job's own token made, where it
|
||||
// names the job instead.
|
||||
const tokenOf = (log: AuditLog) =>
|
||||
log.span && !log.span.startsWith('job-span-') ? log.span : undefined
|
||||
|
||||
function groupLogsByDay(logs: AuditLog[]): Record<string, AuditLog[]> {
|
||||
const groupedLogs = {}
|
||||
|
||||
@@ -132,7 +139,8 @@
|
||||
>
|
||||
<div class="w-1/12">ID</div>
|
||||
<div class={showWorkspace ? 'w-2/12' : 'w-3/12'}>Timestamp</div>
|
||||
<div class={showWorkspace ? 'w-2/12' : 'w-3/12'}>Username</div>
|
||||
<div class="w-2/12">Username</div>
|
||||
<div class={showWorkspace ? 'w-1/12' : 'w-2/12'}>Token</div>
|
||||
{#if showWorkspace}
|
||||
<div class="w-2/12">Workspace</div>
|
||||
{/if}
|
||||
@@ -204,7 +212,7 @@
|
||||
<div class={showWorkspace ? 'w-2/12 text-xs' : 'w-3/12 text-xs'}>
|
||||
{displayDate(logOrDate.log.timestamp)}
|
||||
</div>
|
||||
<div class={showWorkspace ? 'w-2/12 text-xs' : 'w-3/12 text-xs'}>
|
||||
<div class="w-2/12 text-xs">
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<!-- end_user can be an arbitrarily long token label; truncate it rather
|
||||
than let it push the username out of the cell. -->
|
||||
@@ -232,6 +240,28 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class={showWorkspace ? 'w-1/12 text-xs' : 'w-2/12 text-xs'}>
|
||||
{#if tokenOf(logOrDate.log)}
|
||||
{@const token = tokenOf(logOrDate.log)!}
|
||||
<div class="flex flex-row gap-2 items-center min-w-0 pr-2">
|
||||
<span
|
||||
class="truncate"
|
||||
title={`${token}****${logOrDate.log.token_label ? ` (${logOrDate.log.token_label})` : ''}`}
|
||||
>
|
||||
{token}****
|
||||
</span>
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="sm"
|
||||
iconOnly
|
||||
startIcon={{ icon: ListFilterPlus }}
|
||||
on:click={() => {
|
||||
tokenFilter = token
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if showWorkspace}
|
||||
<div class="w-2/12 text-xs">
|
||||
<div class="whitespace-nowrap overflow-x-auto no-scrollbar max-w-60">
|
||||
|
||||
@@ -245,6 +245,7 @@
|
||||
bind:operation
|
||||
bind:usernameFilter={username}
|
||||
bind:resourceFilter={resource}
|
||||
bind:tokenFilter={tokenPrefix}
|
||||
hasMore={auditLogsLoader.hasMore}
|
||||
loadingExtra={auditLogsLoader.loadingExtra}
|
||||
onLoadMore={() => auditLogsLoader.loadMore()}
|
||||
@@ -299,6 +300,7 @@
|
||||
bind:operation
|
||||
bind:usernameFilter={username}
|
||||
bind:resourceFilter={resource}
|
||||
bind:tokenFilter={tokenPrefix}
|
||||
{batchProgress}
|
||||
batchSize={auditLogsLoader.currentBatchSize}
|
||||
onBatchSizeChange={(size) => auditLogsLoader.restreamWithBatchSize(size)}
|
||||
|
||||
Reference in New Issue
Block a user