Skip to content

Commit 847c8af

Browse files
committed
feat: add Logs tab to entity resource panel
Adds a "Logs" tab to EntityResourceTabs for viewing ROS log entries per entity with severity/context filtering, auto-refresh polling, JSON download, and per-entity logs configuration editing. - Generic store actions + api-dispatch helpers for /logs endpoints - Local TypeScript interfaces mirroring the gateway JSON shape - LogsPanel component: dense table, click-to-expand rows, toolbar filters, auto-refresh with visibility gating, clear/download, lazy-loaded collapsible configuration row - Aggregation header for areas and functions - Wired as the 5th tab alongside Data/Operations/Config/Faults Closes #43
1 parent f66d317 commit 847c8af

9 files changed

Lines changed: 1575 additions & 2 deletions

File tree

src/components/EntityResourceTabs.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { useState, useEffect, useCallback, useRef } from 'react';
22
import { useShallow } from 'zustand/shallow';
3-
import { Database, Zap, Settings, AlertTriangle, Loader2, MessageSquare } from 'lucide-react';
3+
import { Database, Zap, Settings, AlertTriangle, Loader2, MessageSquare, ScrollText } from 'lucide-react';
44
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/card';
55
import { Badge } from '@/components/ui/badge';
66
import { useAppStore } from '@/lib/store';
77
import { ConfigurationPanel } from '@/components/ConfigurationPanel';
88
import { OperationsPanel } from '@/components/OperationsPanel';
99
import { FaultsPanel } from '@/components/FaultsPanel';
10+
import { LogsPanel } from '@/components/LogsPanel';
1011
import type { SovdResourceEntityType } from '@/lib/types';
1112
import type { ComponentTopic, Operation, Fault } from '@/lib/types';
1213

13-
type ResourceTab = 'data' | 'operations' | 'configurations' | 'faults';
14+
type ResourceTab = 'data' | 'operations' | 'configurations' | 'faults' | 'logs';
1415

1516
interface TabConfig {
1617
id: ResourceTab;
@@ -23,6 +24,7 @@ const RESOURCE_TABS: TabConfig[] = [
2324
{ id: 'operations', label: 'Operations', icon: Zap },
2425
{ id: 'configurations', label: 'Config', icon: Settings },
2526
{ id: 'faults', label: 'Faults', icon: AlertTriangle },
27+
{ id: 'logs', label: 'Logs', icon: ScrollText },
2628
];
2729

2830
interface EntityResourceTabsProps {
@@ -39,6 +41,7 @@ interface LoadedResources {
3941
operations: boolean;
4042
configurations: boolean;
4143
faults: boolean;
44+
logs: boolean;
4245
}
4346

4447
/**
@@ -55,6 +58,7 @@ export function EntityResourceTabs({ entityId, entityType, basePath, onNavigate
5558
operations: false,
5659
configurations: false,
5760
faults: false,
61+
logs: false,
5862
});
5963
const loadedTabsRef = useRef(loadedTabs);
6064
loadedTabsRef.current = loadedTabs;
@@ -111,6 +115,10 @@ export function EntityResourceTabs({ entityId, entityType, basePath, onNavigate
111115
setFaults(faultsRes.items || []);
112116
break;
113117
}
118+
case 'logs': {
119+
// LogsPanel owns its own fetching; no parent-level count fetch.
120+
break;
121+
}
114122
}
115123
setLoadedTabs((prev) => ({ ...prev, [tab]: true }));
116124
} catch (error) {
@@ -237,6 +245,9 @@ export function EntityResourceTabs({ entityId, entityType, basePath, onNavigate
237245

238246
{/* Faults Tab */}
239247
{activeTab === 'faults' && <FaultsPanel entityId={entityId} entityType={entityType} />}
248+
249+
{/* Logs Tab */}
250+
{activeTab === 'logs' && <LogsPanel entityId={entityId} entityType={entityType} />}
240251
</>
241252
)}
242253
</div>

0 commit comments

Comments
 (0)