diff --git a/frontend/src/components/config/ConfigHistorySection.tsx b/frontend/src/components/config/ConfigHistorySection.tsx index 83d64ad..153968a 100644 --- a/frontend/src/components/config/ConfigHistorySection.tsx +++ b/frontend/src/components/config/ConfigHistorySection.tsx @@ -1,8 +1,10 @@ +import { useState } from 'react' import { useQuery } from '@tanstack/react-query' import { History } from 'lucide-react' import { Badge } from '@/components/ui/badge' import { TableSkeleton } from '@/components/ui/page-skeleton' import { configHistoryApi } from '@/lib/api' +import { DiffViewer } from './DiffViewer' interface ConfigHistorySectionProps { tenantId: string @@ -40,6 +42,7 @@ function LineDelta({ added, removed }: { added: number; removed: number }) { } export function ConfigHistorySection({ tenantId, deviceId }: ConfigHistorySectionProps) { + const [selectedSnapshotId, setSelectedSnapshotId] = useState(null) const { data: changes, isLoading } = useQuery({ queryKey: ['config-history', tenantId, deviceId], queryFn: () => configHistoryApi.list(tenantId, deviceId), @@ -53,6 +56,17 @@ export function ConfigHistorySection({ tenantId, deviceId }: ConfigHistorySectio

Configuration History

+ {selectedSnapshotId && ( +
+ setSelectedSnapshotId(null)} + /> +
+ )} + {isLoading ? ( ) : !changes || changes.length === 0 ? ( @@ -68,7 +82,8 @@ export function ConfigHistorySection({ tenantId, deviceId }: ConfigHistorySectio {changes.map((entry) => (
setSelectedSnapshotId(entry.snapshot_id)} > {/* Timeline dot */}