feat(08-02): add snapshot download button to config history timeline

- Add SnapshotResponse interface and getSnapshot API method
- Add deviceName prop to ConfigHistorySection
- Add download handler that fetches snapshot and triggers .rsc file download
- Add Download icon button on each timeline entry with stopPropagation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-12 23:23:55 -05:00
parent 8a64596d8b
commit be41add4e9
3 changed files with 44 additions and 3 deletions

View File

@@ -991,6 +991,13 @@ export interface DiffResponse {
created_at: string
}
export interface SnapshotResponse {
id: string
config_text: string
sha256_hash: string
collected_at: string
}
export const configHistoryApi = {
list: (tenantId: string, deviceId: string, limit = 50, offset = 0) =>
api
@@ -1006,6 +1013,13 @@ export const configHistoryApi = {
`/api/tenants/${tenantId}/devices/${deviceId}/config/${snapshotId}/diff`,
)
.then((r) => r.data),
getSnapshot: (tenantId: string, deviceId: string, snapshotId: string) =>
api
.get<SnapshotResponse>(
`/api/tenants/${tenantId}/devices/${deviceId}/config/${snapshotId}`,
)
.then((r) => r.data),
}
// ─── VPN (WireGuard) ────────────────────────────────────────────────────────