feat: sicherungsstatus im admin-bereich, readme zu backup und restore

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 15:33:27 +01:00
1 parent 7fd699c6af
commit 50cf1a8492
6 files changed
+191 -12

No files matched your search

+91
View File
@@ -0,0 +1,91 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { api } from '@/api/client'
import type { BackupStatus } from '@/api/types'
import { formatBytes, formatDateTime } from '@/utils/format'
const status = ref<BackupStatus | null>(null)
const error = ref<string | null>(null)
// Disabled is a choice, not a problem; a missing or failed backup while enabled is
const problem = computed(
() =>
status.value !== null &&
status.value.enabled &&
(status.value.stale || !!status.value.last_error),
)
onMounted(async () => {
try {
status.value = await api.get<BackupStatus>('/admin/backup')
} catch (e) {
error.value = e instanceof Error ? e.message : String(e)
}
})
</script>
<template>
<section class="card" :class="{ problem }">
<h2>Datensicherung</h2>
<p v-if="error" class="error">{{ error }}</p>
<template v-else-if="status">
<p v-if="!status.enabled" class="muted">
Automatische Sicherung ist ausgeschaltet (<code>BACKUP_ENABLED=false</code>).
</p>
<dl>
<dt>Letzte Sicherung</dt>
<dd :class="{ error: status.enabled && status.stale }">
<template v-if="status.latest">
{{ formatDateTime(status.latest.created_at) }} · {{ formatBytes(status.latest.size) }}
</template>
<template v-else>noch keine</template>
</dd>
<dt>Zeitplan</dt>
<dd>täglich {{ String(status.hour).padStart(2, '0') }}:00 Uhr</dd>
<dt>Vorhanden</dt>
<dd>{{ status.count }} {{ status.count === 1 ? 'Sicherung' : 'Sicherungen' }}</dd>
</dl>
<p v-if="status.last_error" class="error" role="alert">
Letzter Versuch fehlgeschlagen: {{ status.last_error }}
</p>
<p v-else-if="status.enabled && status.stale" class="error" role="alert">
Seit über einem Tag keine Sicherung. Log prüfen:
<code>docker compose logs app | grep -i backup</code>
</p>
<p class="muted small">
Ablage unter <code>data/backups/</code>. Manuell sichern:
<code>docker exec -u app lan-clipboard lc-admin backup</code>
</p>
</template>
</section>
</template>
<style scoped>
.problem {
border-color: var(--error);
}
dl {
display: grid;
grid-template-columns: max-content 1fr;
gap: 0.25rem 1rem;
margin: 0 0 1rem;
}
dt {
color: var(--muted);
}
dd {
margin: 0;
}
code {
overflow-wrap: anywhere;
}
.small {
font-size: 0.85rem;
}
</style>