fix: refresh only export jobs list on Aktualisieren, not the whole page

This commit is contained in:
MechaCat02
2026-04-03 19:47:07 +02:00
parent 0bda0eecc8
commit 2375a9cfa6

View File

@@ -70,6 +70,17 @@
} }
} }
let exportJobsRefreshing = $state(false);
async function refreshExportJobs() {
exportJobsRefreshing = true;
try {
exportJobs = await api.get<ExportJob[]>('/admin/export/jobs');
} finally {
exportJobsRefreshing = false;
}
}
function showToast(msg: string) { function showToast(msg: string) {
toast = msg; toast = msg;
setTimeout(() => (toast = null), 3000); setTimeout(() => (toast = null), 3000);
@@ -225,7 +236,9 @@
<div class="rounded-xl border border-gray-200 bg-white p-5"> <div class="rounded-xl border border-gray-200 bg-white p-5">
<div class="mb-4 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between">
<h2 class="font-semibold text-gray-900">Export-Jobs</h2> <h2 class="font-semibold text-gray-900">Export-Jobs</h2>
<button onclick={reload} class="text-xs text-blue-600 hover:underline">Aktualisieren</button> <button onclick={refreshExportJobs} disabled={exportJobsRefreshing} class="text-xs text-blue-600 hover:underline disabled:opacity-50">
{exportJobsRefreshing ? 'Lädt…' : 'Aktualisieren'}
</button>
</div> </div>
{#if exportJobs.length === 0} {#if exportJobs.length === 0}
<p class="text-sm text-gray-400">Noch keine Export-Jobs.</p> <p class="text-sm text-gray-400">Noch keine Export-Jobs.</p>