diff --git a/web/src/proxmox.test.tsx b/web/src/proxmox.test.tsx
new file mode 100644
index 0000000..2ebdcfb
--- /dev/null
+++ b/web/src/proxmox.test.tsx
@@ -0,0 +1,40 @@
+import { renderToStaticMarkup } from 'react-dom/server';
+import { expect, it } from 'vitest';
+import { ProxmoxDetails } from './proxmox';
+
+const data = { node: 'pve', cluster: null, version: '9.2.2', not_backed_up: [101],
+ guests: [
+ { vmid: 100, name: 'debian-guest', kind: 'qemu', status: 'running', template: false, cpus: 1,
+ memory_bytes: 2 ** 30, disk_bytes: 2 ** 33, macs: ['bc:24:11:88:35:97'] },
+ { vmid: 101, name: 'alpine-ct', kind: 'lxc', status: 'running', template: false, cpus: 1,
+ memory_bytes: 2 ** 27, disk_bytes: 2 ** 30, macs: [] }],
+ backup_jobs: [{ id: 'backup-debian', enabled: true, schedule: '*/2:00', storage: 'local',
+ selection: 'vmid', covered_vmids: [100], last_expected_run: 1795172400, next_run: 1795179600 }],
+ backup_runs: [] };
+
+it('lists guests, linked devices and an overall backup answer', () => {
+ const view = renderToStaticMarkup();
+ expect(view).toContain('Alle geplanten Backups sind gelaufen.');
+ expect(view).toContain('href="#geraete/t/a/b"');
+ expect(view).toContain('Container');
+ expect(view).toMatch(/Ohne Backupjob<\/h3>101 alpine-ct/);
+ expect(view).toContain('Gelaufen');
+});
+
+it('names failed guests and explains a missing read token', () => {
+ const failed = renderToStaticMarkup();
+ expect(failed).toContain('Nicht alle geplanten Backups sind gelaufen.');
+ expect(failed).toContain('100 debian-guest: Fehlgeschlagen');
+ expect(failed).toContain('nicht zugeordnet');
+ const missing = renderToStaticMarkup();
+ expect(missing).toContain('kein Lesezugang');
+ expect(renderToStaticMarkup()).toBe('');
+});
diff --git a/web/src/proxmox.tsx b/web/src/proxmox.tsx
new file mode 100644
index 0000000..353d7e6
--- /dev/null
+++ b/web/src/proxmox.tsx
@@ -0,0 +1,114 @@
+import { record, type RecordValue } from './api';
+
+const dateFormat = new Intl.DateTimeFormat('de-DE', { dateStyle: 'short', timeStyle: 'short' });
+const gib = new Intl.NumberFormat('de-DE', { maximumFractionDigits: 1 });
+
+const JOB_STATUS: Record = {
+ ok: ['Gelaufen', 'online'],
+ failed: ['Fehlgeschlagen', 'failed'],
+ missed: ['Verpasst', 'failed'],
+ running: ['Läuft', 'historic'],
+ pending: ['Noch nicht fällig', ''],
+ disabled: ['Deaktiviert', ''],
+ unknown: ['Unbekannt', 'historic'],
+};
+const GUEST_STATUS: Record = { running: 'Läuft', stopped: 'Gestoppt', paused: 'Pausiert' };
+
+function list(value: unknown): RecordValue[] {
+ return Array.isArray(value) ? value.filter(v => v && typeof v === 'object' && !Array.isArray(v)).map(v => record(v)) : [];
+}
+function epoch(value: unknown) {
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? dateFormat.format(value * 1000) : '–';
+}
+function size(value: unknown) {
+ return typeof value === 'number' && value > 0 ? gib.format(value / 2 ** 30) + ' GiB' : '–';
+}
+function text(value: unknown) {
+ return typeof value === 'string' && value.trim() ? value : '–';
+}
+function Badge({ status }: { status: unknown }) {
+ const [title, tone] = JOB_STATUS[typeof status === 'string' ? status : 'unknown'] ?? ['Unbekannt', 'historic'];
+ return {title};
+}
+
+function deviceLink(tenant: unknown, link: RecordValue | undefined) {
+ if (!link || typeof tenant !== 'string' || typeof link.asset_id !== 'string' || typeof link.agent_id !== 'string') return null;
+ const path = ['geraete', tenant, link.asset_id, link.agent_id].map(encodeURIComponent).join('/');
+ return {text(link.hostname)};
+}
+
+/** Hosted guests and scheduled vzdump backups reported by a Proxmox VE host. */
+export function ProxmoxDetails({ device }: { device: RecordValue }) {
+ if (!device.proxmox || typeof device.proxmox !== 'object') return null;
+ const report = record(device.proxmox);
+ if (report.quality !== 'valid' || !report.data) {
+ const reason = report.error_code === 'PROXMOX_NOT_CONFIGURED'
+ ? 'Für diesen Proxmox-Host ist kein Lesezugang eingerichtet. Der HTTPS-Installer richtet ihn bei der Aufnahme ein.'
+ : 'Nicht ermittelbar' + (typeof report.error_code === 'string' ? ` (${report.error_code})` : '') + '.';
+ return ;
+ }
+ const data = record(report.data);
+ const status = report.backup_status ? record(report.backup_status) : {};
+ const jobStatus = new Map(list(status.jobs).map(j => [j.id, j]));
+ const lastSuccess = status.last_success_at ? record(status.last_success_at) : {};
+ const links = new Map(list(report.guest_devices).map(l => [l.vmid, l]));
+ const guests = list(data.guests);
+ const names = new Map(guests.map(g => [g.vmid, text(g.name)]));
+ const jobs = list(data.backup_jobs);
+ const notBackedUp = Array.isArray(data.not_backed_up) ? data.not_backed_up : [];
+ const allRan = status.all_scheduled_backups_ran;
+ const guestName = (id: unknown) => `${String(id)} ${names.get(id) ?? ''}`.trim();
+
+ return <>
+
+ Virtuelle Maschinen und Container
+ Node {text(data.node)}{typeof data.cluster === 'string' ? ` · Cluster ${data.cluster}` : ''}
+ {typeof data.version === 'string' ? ` · Proxmox VE ${data.version}` : ''} · erhoben {typeof report.observed_at === 'string' ? dateFormat.format(Date.parse(report.observed_at)) : '–'}
+ {report.truncated === true ? ' · Auszug – unvollständige Liste' : ''}
+ {guests.length === 0 ? Keine Gäste auf diesem Node.
:
+ | VMID | Name | Typ | Status | vCPU | RAM | Disk | Gerät im Bestand | Letzte Sicherung |
+ {guests.map(g =>
+ | {String(g.vmid)} |
+ {text(g.name)}{g.template === true && · Vorlage} |
+ {g.kind === 'lxc' ? 'Container' : 'VM'} |
+ {GUEST_STATUS[String(g.status)] ?? text(g.status)} |
+ {typeof g.cpus === 'number' ? g.cpus : '–'} |
+ {size(g.memory_bytes)} |
+ {size(g.disk_bytes)} |
+ {deviceLink(device.tenant_id, links.get(g.vmid)) ?? nicht zugeordnet} |
+ {epoch(lastSuccess[String(g.vmid)])} |
+
)}
+
}
+
+
+ Geplante Backups
+ {allRan === true ? <> Alle geplanten Backups sind gelaufen.>
+ : allRan === false ? <> Nicht alle geplanten Backups sind gelaufen.>
+ : 'Keine aktiven Backupjobs für diesen Node.'}
+ {jobs.length > 0 &&
+ | Job | Zeitplan | Storage | Gäste | Zuletzt fällig | Ergebnis | Nächster Lauf |
+ {jobs.map(job => {
+ const evaluated = jobStatus.get(job.id);
+ const problems = list(evaluated?.guests).filter(g => g.status !== 'ok');
+ const covered = Array.isArray(job.covered_vmids) ? job.covered_vmids : [];
+ return
+ | {text(job.id)} |
+ {text(job.schedule)} |
+ {text(job.storage)} |
+ {covered.length ? covered.map(guestName).join(', ') : keine lokalen Gäste}
+ {job.selection === 'all' && (alle)} |
+ {epoch(job.last_expected_run)} |
+
+ {problems.length > 0 && {problems.map(g =>
+ - {guestName(g.vmid)}: {JOB_STATUS[String(g.status)]?.[0] ?? text(g.status)}
)} } |
+ {epoch(job.next_run)} |
+
;
+ })}
+
}
+ {notBackedUp.length > 0 && <>
+ Ohne Backupjob
+ {notBackedUp.map(guestName).join(', ')}
+ >}
+
+ >;
+}
diff --git a/web/src/style.css b/web/src/style.css
index 35ad473..1850670 100644
--- a/web/src/style.css
+++ b/web/src/style.css
@@ -116,6 +116,8 @@ section.fleet { padding:0; overflow:hidden; }
.presence i { width:6px; height:6px; border-radius:50%; background:currentColor; }
.presence.online { color:#236343; background:#e6f4e9; }
.presence.historic { color:#80581c; background:#faf1df; }
+.presence.failed { color:#7b3029; background:#fdf1ee; }
+ul.compact { margin:4px 0 0; padding-left:18px; font-size:.85rem; }
.fleet small { font-size:.75rem; margin-top:3px; }
.list-message,.history-hint,.empty-list,.fleet > .error { margin:14px 20px; }
.history-hint,.list-footer { color:var(--subtle); font-size:.83rem; }