Files
sharepoint-acc-sync/src/routes/projects/[id]/history/[runId]/+page.svelte
2026-10-23 06:52:20 -05:00

73 lines
1.8 KiB
Svelte

<script lang="ts">
import { resolve } from '$app/paths';
import Badge from '#lib/components/Badge.svelte';
import { EVENT, OUTCOME, describeCounts, formatDateTime, formatDuration } from '#lib/format.ts';
import type { PageProps } from './$types';
let { data }: PageProps = $props();
const timeOnly = new Intl.DateTimeFormat(undefined, { timeStyle: 'medium' });
</script>
<svelte:head>
<title>Sync on {formatDateTime(data.run.startedAt)} | {data.project.name}</title>
</svelte:head>
<div class="page">
<div class="section">
<a class="small" href={resolve('/projects/[id]/history', { id: data.project.id })}>
Back to sync history
</a>
<h1>Sync on {formatDateTime(data.run.startedAt)}</h1>
<div class="actions">
{#if data.run.outcome}
<Badge {...OUTCOME[data.run.outcome]} />
{/if}
<span class="muted">
{data.run.trigger === 'manual' ? 'Started with Run now' : 'Started by the schedule'}, took
{formatDuration(data.run.startedAt, data.run.finishedAt)}. {describeCounts(
data.run.counts
)}.
</span>
</div>
{#if data.run.error}
<div class="notice tone-danger">{data.run.error}</div>
{/if}
</div>
{#if data.events.length === 0}
<div class="notice">Nothing needed to change in ACC during this sync.</div>
{:else}
<div class="table-wrap">
<table class="register">
<thead>
<tr>
<th>Time</th>
<th>What happened</th>
<th>File</th>
</tr>
</thead>
<tbody>
{#each data.events as event, i (i)}
<tr>
<td class="small">{timeOnly.format(event.at)}</td>
<td><Badge {...EVENT[event.action]} /></td>
<td>
{event.path}
{#if event.message}
<div class="small error">{event.message}</div>
{/if}
</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/if}
</div>
<style>
.error {
color: var(--danger);
}
</style>