a7a2b4efa4
Backend
- Per-chat album scope for Immich commands (search/latest/memory/...): new
allowed_album_ids on CommandTrackerListener, threaded listener/page kwargs
through ProviderCommandHandler.handle; PATCH listener-scope endpoint.
- /search and /find accept a trailing page number; Immich client search_smart
/ search_metadata take a page param.
- Immich person-asset lookup switched from removed GET /api/people/{id}/assets
to POST /api/search/metadata with personIds (fixes /person command and
auto_organize rules silently returning zero candidates on Immich 1.106+).
- Auto_organize rule now sets the target album's thumbnail to the first added
image when missing (falls back to any asset type); failures do not fail the
rule. add_assets_to_album surfaces the Immich error body on non-2xx.
- EventLog.user_id / action_id / action_name columns with defensive migration
+ backfill. Status query filters by user_id directly; Immich/webhook paths
emit user_id explicitly. action_runner writes an action_success/partial/
failed event on each non-dry-run.
- Dashboard DELETE /api/status/events (scoped to user_id) + rendering live
tracker/provider/action names via FK join with snapshot fallback.
- PATCH /api/users/{id} for username/role change with last-admin guard.
- Deletion protection returns structured {message, entity, blocked_by}
(ApiError carries .blockedBy; frontend opens BlockedByModal).
- Backup prepare-restore → AppSetting markers + atomic write of
pending_restore.json; lifespan hook applies on next startup and archives
under data/applied_restores/. apply-restart sends SIGTERM so the lifespan
shutdown runs; NOTIFY_BRIDGE_SUPERVISED env override gates the button.
Manual POST /api/backup/files (same format as scheduled).
- New periodic-summary test path reuses shared collect_scheduled_assets
(limit=0) so test and future production code go through one primitive.
- Per-receiver locale for Telegram test messages (resolves
TelegramChat.language_override per chat instead of applying the first
receiver's locale to everyone).
- Bounded concurrency (semaphores) in NotificationDispatcher._preload_asset_data
and _refresh_telegram_chat_titles; chat title sweep extended to 24h since
save_chat_from_webhook covers active chats opportunistically.
- Telegram poller detects the \"webhook is active\" 409 and auto-calls
deleteWebhook for bots whose DB update_mode is polling (throttled per bot).
- TelegramClient.get_chat added (CLAUDE.md rule 6); set_album_thumbnail added.
- Seeds: rename \"Default Commands\" → \"Default Immich Commands\";
track_assets_removed default False.
Frontend
- Global provider selector visible when there is only one provider.
- Clear-events button + i18n + ConfirmModal on the dashboard; new icons/
labels/filters/colors for action_success / action_partial / action_failed.
- Auto-select first available tracking/template/command/config + bot on
create forms (trackers, command-trackers, targets, template/command
configs).
- Telegram target disable_url_preview defaults to true.
- BlockedByModal wired into 8 deletion flows; fetchAuth helper for
multipart/binary calls (reuses api()'s refresh + ApiError mapping).
- Immich tracker 'Checking links' parallelised (concurrency cap 6).
- Backup page: pending-restore banner + Apply-now / Apply-later modal,
restarting overlay polling /api/health, manual 'Create backup' button.
- Command-trackers listener row gets an 'Edit album scope' modal with
inherit/explicit multiselect.
- Users page: Edit user modal (username + role).
- parseDate helper for consistent UTC date rendering.
Migrations / schema
- event_log: + user_id, action_id, action_name (+ backfill user_id from
notification_tracker).
- command_tracker_listener: + allowed_album_ids.
115 lines
4.0 KiB
Svelte
115 lines
4.0 KiB
Svelte
<script lang="ts">
|
|
import { api, parseDate } from '$lib/api';
|
|
import { t } from '$lib/i18n';
|
|
import MdiIcon from '$lib/components/MdiIcon.svelte';
|
|
import type { ActionExecution } from '$lib/types';
|
|
|
|
let { actionId }: { actionId: number } = $props();
|
|
|
|
let executions = $state<ActionExecution[]>([]);
|
|
let loading = $state(true);
|
|
let expandedId = $state<number | null>(null);
|
|
|
|
$effect(() => {
|
|
loadExecutions();
|
|
});
|
|
|
|
async function loadExecutions() {
|
|
loading = true;
|
|
try {
|
|
executions = await api<ActionExecution[]>(`/actions/${actionId}/executions?limit=10`);
|
|
} catch { /* ignore */ }
|
|
loading = false;
|
|
}
|
|
|
|
function statusIcon(status: string): string {
|
|
if (status === 'success') return 'mdiCheckCircle';
|
|
if (status === 'partial') return 'mdiAlertCircle';
|
|
if (status === 'failed') return 'mdiCloseCircle';
|
|
if (status === 'running') return 'mdiLoading';
|
|
return 'mdiCircleOutline';
|
|
}
|
|
|
|
function statusColor(status: string): string {
|
|
if (status === 'success') return '#059669';
|
|
if (status === 'partial') return '#f59e0b';
|
|
if (status === 'failed') return '#ef4444';
|
|
if (status === 'running') return '#3b82f6';
|
|
return 'var(--color-muted-foreground)';
|
|
}
|
|
|
|
function triggerLabel(trigger: string): string {
|
|
if (trigger === 'manual') return t('actions.triggerManual');
|
|
if (trigger === 'dry_run') return t('actions.triggerDryRun');
|
|
return t('actions.triggerScheduled');
|
|
}
|
|
|
|
function formatDate(iso: string | null): string {
|
|
if (!iso) return '-';
|
|
try {
|
|
return parseDate(iso).toLocaleString();
|
|
} catch { return iso; }
|
|
}
|
|
|
|
function formatDuration(start: string, end: string | null): string {
|
|
if (!end) return '-';
|
|
try {
|
|
const ms = parseDate(end).getTime() - parseDate(start).getTime();
|
|
if (ms < 1000) return `${ms}ms`;
|
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
} catch { return '-'; }
|
|
}
|
|
</script>
|
|
|
|
<div class="space-y-2">
|
|
<h4 class="text-xs font-semibold text-[var(--color-muted-foreground)] uppercase tracking-wide">
|
|
{t('actions.history')}
|
|
</h4>
|
|
|
|
{#if loading}
|
|
<p class="text-xs text-[var(--color-muted-foreground)]">{t('common.loading')}...</p>
|
|
{:else if executions.length === 0}
|
|
<p class="text-xs text-[var(--color-muted-foreground)]">{t('actions.noExecutions')}</p>
|
|
{:else}
|
|
<div class="space-y-1">
|
|
{#each executions as exec}
|
|
<button onclick={() => expandedId = expandedId === exec.id ? null : exec.id}
|
|
class="w-full text-left px-2 py-1.5 rounded text-xs hover:bg-[var(--color-muted)]/50 flex items-center gap-2">
|
|
<span style="color: {statusColor(exec.status)}">
|
|
<MdiIcon name={statusIcon(exec.status)} size={14} />
|
|
</span>
|
|
<span class="flex-1">{formatDate(exec.started_at)}</span>
|
|
<span class="text-[var(--color-muted-foreground)]">{triggerLabel(exec.trigger)}</span>
|
|
<span class="font-mono">{exec.rules_succeeded}/{exec.rules_processed}</span>
|
|
<span class="text-[var(--color-muted-foreground)]">{exec.total_items_affected} {t('actions.affected')}</span>
|
|
<span class="text-[var(--color-muted-foreground)]">{formatDuration(exec.started_at, exec.finished_at)}</span>
|
|
</button>
|
|
|
|
{#if expandedId === exec.id}
|
|
<div class="ml-6 px-2 py-1.5 text-xs space-y-1 border-l-2 border-[var(--color-border)]">
|
|
{#if exec.error}
|
|
<p class="text-[var(--color-error-fg)]">{exec.error}</p>
|
|
{/if}
|
|
{#if exec.summary?.rule_results}
|
|
{#each exec.summary.rule_results as rr}
|
|
<div class="flex items-center gap-2">
|
|
<span style="color: {rr.success ? '#059669' : '#ef4444'}">
|
|
<MdiIcon name={rr.success ? 'mdiCheck' : 'mdiClose'} size={12} />
|
|
</span>
|
|
<span class="font-medium">{rr.rule_name}</span>
|
|
<span class="text-[var(--color-muted-foreground)]">
|
|
{rr.items_matched} matched, {rr.items_affected} affected, {rr.items_skipped} skipped
|
|
</span>
|
|
{#if rr.error}
|
|
<span class="text-[var(--color-error-fg)]">{rr.error}</span>
|
|
{/if}
|
|
</div>
|
|
{/each}
|
|
{/if}
|
|
</div>
|
|
{/if}
|
|
{/each}
|
|
</div>
|
|
{/if}
|
|
</div>
|