feat(08-01): add diff viewer component and API client
- Add DiffResponse interface and getDiff method to configHistoryApi - Create DiffViewer component with unified diff rendering - Green highlighting for added lines, red for removed lines - Blue styling for hunk headers, loading skeleton, error state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -981,6 +981,16 @@ export interface ConfigChangeEntry {
|
||||
snapshot_id: string
|
||||
}
|
||||
|
||||
export interface DiffResponse {
|
||||
id: string
|
||||
diff_text: string
|
||||
lines_added: number
|
||||
lines_removed: number
|
||||
old_snapshot_id: string
|
||||
new_snapshot_id: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export const configHistoryApi = {
|
||||
list: (tenantId: string, deviceId: string, limit = 50, offset = 0) =>
|
||||
api
|
||||
@@ -989,6 +999,13 @@ export const configHistoryApi = {
|
||||
{ params: { limit, offset } },
|
||||
)
|
||||
.then((r) => r.data),
|
||||
|
||||
getDiff: (tenantId: string, deviceId: string, snapshotId: string) =>
|
||||
api
|
||||
.get<DiffResponse>(
|
||||
`/api/tenants/${tenantId}/devices/${deviceId}/config/${snapshotId}/diff`,
|
||||
)
|
||||
.then((r) => r.data),
|
||||
}
|
||||
|
||||
// ─── VPN (WireGuard) ────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user