feat(timeline): fix chronology, status resolution, and component history UI

This commit is contained in:
2026-02-16 23:17:22 +03:00
parent b799228960
commit 88503d2457
17 changed files with 882 additions and 506 deletions

View File

@@ -38,9 +38,6 @@ func TestTimelineInstalledRemovedFirmwareChanged(t *testing.T) {
t.Fatalf("cleanup: %v", err)
}
projectID := insertProject(t, db, "Core")
assetID := insertAsset(t, db, projectID, "server-01", "ASSET-01")
mux := http.NewServeMux()
RegisterIngestRoutes(mux, IngestDependencies{Service: ingest.NewService(db)})
RegisterAssetComponentRoutes(mux, AssetComponentDependencies{
@@ -53,24 +50,30 @@ func TestTimelineInstalledRemovedFirmwareChanged(t *testing.T) {
collectedAt1 := time.Now().UTC().Add(-time.Minute).Format(time.RFC3339)
payload1 := map[string]any{
"asset_id": assetID,
"target_host": "server-01",
"collected_at": collectedAt1,
"components": []map[string]any{
{"vendor_serial": "VSN-A", "firmware_version": "1.0.0"},
{"vendor_serial": "VSN-B", "firmware_version": "1.0.0"},
"hardware": map[string]any{
"board": map[string]any{"serial_number": "ASSET-01"},
"storage": []map[string]any{
{"serial_number": "VSN-A", "firmware": "1.0.0", "present": true, "status": "OK"},
{"serial_number": "VSN-B", "firmware": "1.0.0", "present": true, "status": "OK"},
},
},
}
postJSON(t, server.URL+"/ingest/logbundle", payload1, http.StatusCreated)
postJSON(t, server.URL+"/ingest/hardware", payload1, http.StatusCreated)
collectedAt2 := time.Now().UTC().Format(time.RFC3339)
payload2 := map[string]any{
"asset_id": assetID,
"target_host": "server-01",
"collected_at": collectedAt2,
"components": []map[string]any{
{"vendor_serial": "VSN-A", "firmware_version": "2.0.0"},
"hardware": map[string]any{
"board": map[string]any{"serial_number": "ASSET-01"},
"storage": []map[string]any{
{"serial_number": "VSN-A", "firmware": "2.0.0", "present": true, "status": "OK"},
},
},
}
postJSON(t, server.URL+"/ingest/logbundle", payload2, http.StatusCreated)
postJSON(t, server.URL+"/ingest/hardware", payload2, http.StatusCreated)
componentA := lookupComponentID(t, db, "VSN-A")
componentB := lookupComponentID(t, db, "VSN-B")