@principal-ai/subsystems-react 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -85
- package/dist/index.d.ts +7 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -32
- package/dist/index.js.map +1 -1
- package/dist/subsystem/SubsystemCarousel.d.ts +36 -0
- package/dist/subsystem/SubsystemCarousel.d.ts.map +1 -0
- package/dist/subsystem/SubsystemCarousel.js +163 -0
- package/dist/subsystem/SubsystemCarousel.js.map +1 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts +25 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +329 -68
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +9 -199
- package/src/subsystem/SubsystemComponentGraph.tsx +396 -50
- package/src/components/ConfigurationSelector.tsx +0 -133
- package/src/components/GraphRenderer.tsx +0 -3195
- package/src/components/MultiCanvasRenderer.tsx +0 -295
- package/src/components/NodeTooltip.tsx +0 -279
- package/src/components/PendingChanges.test.tsx +0 -375
- package/src/components/SelectionSidebar.tsx +0 -352
- package/src/components/SequenceDiagramRenderer.tsx +0 -1156
- package/src/components/WorkflowSequenceDiagram.tsx +0 -270
- package/src/components/dashboard/DashboardRenderer.tsx +0 -317
- package/src/components/dashboard/MetricPanel.tsx +0 -254
- package/src/components/dashboard/MockDataProvider.ts +0 -330
- package/src/components/dashboard/components/BarChart.tsx +0 -299
- package/src/components/dashboard/components/LineChart.tsx +0 -279
- package/src/components/dashboard/components/MetricCard.tsx +0 -270
- package/src/components/dashboard/components/SourceLink.tsx +0 -63
- package/src/components/dashboard/components/TimeRangeSelector.tsx +0 -280
- package/src/components/dashboard/components/index.ts +0 -5
- package/src/components/dashboard/index.ts +0 -47
- package/src/components/dashboard/types.ts +0 -126
- package/src/components/state-view/PipelineView.tsx +0 -347
- package/src/components/state-view/index.ts +0 -14
- package/src/components/state-view/types.ts +0 -261
- package/src/components/state-view/useStateView.ts +0 -205
- package/src/contexts/GraphEditContext.tsx +0 -27
- package/src/contexts/TooltipPortalContext.ts +0 -8
- package/src/edges/CustomEdge.tsx +0 -402
- package/src/edges/GenericEdge.tsx +0 -36
- package/src/hooks/usePathBasedEvents.ts +0 -192
- package/src/hooks/useSequenceLayout.ts +0 -543
- package/src/hooks/useUndoRedo.ts +0 -144
- package/src/nodes/CustomNode.tsx +0 -1231
- package/src/nodes/GenericNode.tsx +0 -55
- package/src/nodes/otel/OtelBoundaryNode.tsx +0 -224
- package/src/nodes/otel/OtelEventNode.tsx +0 -225
- package/src/nodes/otel/OtelResourceNode.tsx +0 -251
- package/src/nodes/otel/OtelScopeNode.tsx +0 -221
- package/src/nodes/otel/OtelSpanConventionNode.tsx +0 -295
- package/src/nodes/otel/index.ts +0 -23
- package/src/nodes/otel/shared/NodeBadges.tsx +0 -295
- package/src/nodes/otel/shared/NodeContent.tsx +0 -204
- package/src/nodes/otel/shared/index.ts +0 -8
- package/src/nodes/otel/shared/types.ts +0 -138
- package/src/nodes/otel/shared/useNodeBehavior.ts +0 -114
- package/src/stories/Audit/BoundaryNodes.stories.tsx +0 -385
- package/src/stories/Audit/CanvasEdgeTypes.stories.tsx +0 -1448
- package/src/stories/Audit/CanvasNodeTypes.stories.tsx +0 -1049
- package/src/stories/Audit/ColorPriority.stories.tsx +0 -895
- package/src/stories/Audit/DiamondBadges.stories.tsx +0 -629
- package/src/stories/Audit/NodeDimensionsTesting.stories.tsx +0 -724
- package/src/stories/Audit/NodeFieldsAudit.stories.tsx +0 -996
- package/src/stories/Audit/NodeFontSizeTesting.stories.tsx +0 -715
- package/src/stories/Audit/NodeShapes.stories.tsx +0 -1208
- package/src/stories/Audit/WideNodesTesting.stories.tsx +0 -1045
- package/src/stories/Components/DashboardRenderer.stories.tsx +0 -263
- package/src/stories/Components/GraphRenderer.stories.tsx +0 -3236
- package/src/stories/Components/MultiCanvasRenderer.stories.tsx +0 -370
- package/src/stories/Components/SequenceDiagram.stories.tsx +0 -255
- package/src/stories/Components/StateView.stories.tsx +0 -417
- package/src/stories/Components/TraceViewer.stories.tsx +0 -442
- package/src/stories/Components/WorkflowSequenceDiagram.stories.tsx +0 -802
- package/src/stories/Features/AnimationWorkshop.stories.tsx +0 -727
- package/src/stories/Features/ChangeTypeVisual.stories.tsx +0 -67
- package/src/stories/Features/EventDrivenAnimations.stories.tsx +0 -513
- package/src/stories/Features/MultiConfig.stories.tsx +0 -539
- package/src/stories/Layout/ElkEdgeRouting.stories.tsx +0 -539
- package/src/stories/Layout/GraphOrientation.stories.tsx +0 -500
- package/src/stories/Layout/MultiDirectionalConnections.stories.tsx +0 -352
- package/src/stories/Nodes/NodeDefinitionComparison.stories.tsx +0 -560
- package/src/stories/Nodes/NodeNameFallbacks.stories.tsx +0 -491
- package/src/stories/Nodes/NumericColors.stories.tsx +0 -440
- package/src/stories/OTEL/EventNameDisplay.stories.tsx +0 -694
- package/src/stories/OTEL/EventNameFallback.stories.tsx +0 -578
- package/src/stories/OTEL/OtelComponents.stories.tsx +0 -422
- package/src/stories/OTEL/OtelNodeTypesPrototype.stories.tsx +0 -806
- package/src/stories/OTEL/RawEventCards.stories.tsx +0 -57
- package/src/stories/OTEL/SpanBadges.stories.tsx +0 -840
- package/src/stories/OTEL/ValidationEventsCanvas.stories.tsx +0 -209
- package/src/stories/RealWorld/BacklogMdCanvases.stories.tsx +0 -721
- package/src/stories/RealWorld/FileCitySequence.stories.tsx +0 -516
- package/src/stories/RealWorld/RealCanvasFiles.stories.tsx +0 -336
- package/src/stories/__traces__/test-run.canvas.json +0 -241
- package/src/stories/data/activity-feed-analytics.dashboard.json +0 -300
- package/src/stories/data/file-city-images-transformed.otel.canvas.json +0 -295
- package/src/stories/data/file-city-workflows.json +0 -269
- package/src/stories/data/graph-converter-test-execution.json +0 -443
- package/src/stories/data/graph-converter-test.workflow.json +0 -105
- package/src/stories/data/graph-converter-validated-execution.json +0 -58
- package/src/utils/animationMapping.ts +0 -166
- package/src/utils/canvasBounds.ts +0 -146
- package/src/utils/graphConverter.ts +0 -148
- package/src/utils/iconResolver.tsx +0 -53
- package/src/utils/orientationUtils.ts +0 -73
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard Types for React Components
|
|
3
|
-
*
|
|
4
|
-
* Core definition types are imported from @principal-ai/subsystems-core.
|
|
5
|
-
* This file only contains React-specific component props types.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Re-export all core dashboard types
|
|
9
|
-
export type {
|
|
10
|
-
// Dashboard definition types
|
|
11
|
-
DashboardDefinition,
|
|
12
|
-
MetricDefinition,
|
|
13
|
-
MetricType,
|
|
14
|
-
MetricSource,
|
|
15
|
-
MetricQuery,
|
|
16
|
-
Derivation,
|
|
17
|
-
TimeGroup,
|
|
18
|
-
AlertDefinition,
|
|
19
|
-
MetricDisplay,
|
|
20
|
-
DisplayComponent,
|
|
21
|
-
// Layout types
|
|
22
|
-
DashboardLayout,
|
|
23
|
-
DashboardRow,
|
|
24
|
-
PanelPlacement,
|
|
25
|
-
// Mock data types
|
|
26
|
-
MockMetricData,
|
|
27
|
-
TimeSeriesPoint,
|
|
28
|
-
HistogramData,
|
|
29
|
-
// Time range types
|
|
30
|
-
TimeRangePreset,
|
|
31
|
-
TimeRange,
|
|
32
|
-
RefreshInterval,
|
|
33
|
-
TimeRangeConfig,
|
|
34
|
-
// Runtime types
|
|
35
|
-
MetricData,
|
|
36
|
-
DataProvider,
|
|
37
|
-
} from '@principal-ai/subsystems-core';
|
|
38
|
-
|
|
39
|
-
// Import types needed for component props
|
|
40
|
-
import type {
|
|
41
|
-
DashboardDefinition,
|
|
42
|
-
MetricDefinition,
|
|
43
|
-
MetricSource,
|
|
44
|
-
MetricData,
|
|
45
|
-
TimeSeriesPoint,
|
|
46
|
-
TimeRange,
|
|
47
|
-
RefreshInterval,
|
|
48
|
-
TimeRangeConfig,
|
|
49
|
-
} from '@principal-ai/subsystems-core';
|
|
50
|
-
|
|
51
|
-
// ============================================================================
|
|
52
|
-
// React Component Props Types
|
|
53
|
-
// ============================================================================
|
|
54
|
-
|
|
55
|
-
export interface DashboardRendererProps {
|
|
56
|
-
dashboard: DashboardDefinition;
|
|
57
|
-
dataProvider?: import('@principal-ai/subsystems-core').DataProvider;
|
|
58
|
-
|
|
59
|
-
// Time range controls
|
|
60
|
-
timeRange?: TimeRange;
|
|
61
|
-
onTimeRangeChange?: (range: TimeRange) => void;
|
|
62
|
-
refreshInterval?: RefreshInterval;
|
|
63
|
-
onRefreshIntervalChange?: (interval: RefreshInterval) => void;
|
|
64
|
-
timeRangeConfig?: TimeRangeConfig;
|
|
65
|
-
|
|
66
|
-
// Callbacks
|
|
67
|
-
onMetricClick?: (metricId: string) => void;
|
|
68
|
-
onSourceClick?: (source: MetricSource) => void;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface MetricPanelProps {
|
|
72
|
-
metric: MetricDefinition;
|
|
73
|
-
data: MetricData;
|
|
74
|
-
onMetricClick?: (metricId: string) => void;
|
|
75
|
-
onSourceClick?: (source: MetricSource) => void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface MetricCardProps {
|
|
79
|
-
title: string;
|
|
80
|
-
value: number | string;
|
|
81
|
-
unit?: string;
|
|
82
|
-
description?: string;
|
|
83
|
-
trend?: 'up' | 'down' | 'flat';
|
|
84
|
-
changePercent?: number;
|
|
85
|
-
showTrend?: boolean;
|
|
86
|
-
showSparkline?: boolean;
|
|
87
|
-
sparklineData?: TimeSeriesPoint[];
|
|
88
|
-
thresholds?: { warning?: number; critical?: number };
|
|
89
|
-
size?: 'small' | 'medium' | 'large';
|
|
90
|
-
onClick?: () => void;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface LineChartProps {
|
|
94
|
-
title: string;
|
|
95
|
-
data: TimeSeriesPoint[];
|
|
96
|
-
xKey?: string;
|
|
97
|
-
yKey?: string;
|
|
98
|
-
series?: string[]; // For multi-series charts
|
|
99
|
-
unit?: string;
|
|
100
|
-
height?: number;
|
|
101
|
-
onClick?: () => void;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface BarChartProps {
|
|
105
|
-
title: string;
|
|
106
|
-
data: TimeSeriesPoint[];
|
|
107
|
-
xKey?: string;
|
|
108
|
-
series: string[];
|
|
109
|
-
stacked?: boolean;
|
|
110
|
-
unit?: string;
|
|
111
|
-
height?: number;
|
|
112
|
-
onClick?: () => void;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface SourceLinkProps {
|
|
116
|
-
source: MetricSource;
|
|
117
|
-
onClick?: (source: MetricSource) => void;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface TimeRangeSelectorProps {
|
|
121
|
-
timeRange: TimeRange;
|
|
122
|
-
onTimeRangeChange: (range: TimeRange) => void;
|
|
123
|
-
refreshInterval?: RefreshInterval;
|
|
124
|
-
onRefreshIntervalChange?: (interval: RefreshInterval) => void;
|
|
125
|
-
config?: TimeRangeConfig;
|
|
126
|
-
}
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PipelineView Component
|
|
3
|
-
*
|
|
4
|
-
* A state-driven visualization showing data flowing through pipeline stages.
|
|
5
|
-
* Demonstrates the state view pattern with animations.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import type {
|
|
10
|
-
PipelineState,
|
|
11
|
-
PipelineEvent,
|
|
12
|
-
PipelineStage,
|
|
13
|
-
EventSource,
|
|
14
|
-
TransitionDefinition,
|
|
15
|
-
} from './types';
|
|
16
|
-
import { useStateView } from './useStateView';
|
|
17
|
-
|
|
18
|
-
// =============================================================================
|
|
19
|
-
// Reducer
|
|
20
|
-
// =============================================================================
|
|
21
|
-
|
|
22
|
-
const initialPipelineState: PipelineState = {
|
|
23
|
-
stages: {
|
|
24
|
-
disk: { id: 'disk', label: 'Disk', lastEventTime: null, isActive: false },
|
|
25
|
-
watch: { id: 'watch', label: 'Watch', lastEventTime: null, isActive: false },
|
|
26
|
-
cache: { id: 'cache', label: 'Cache', lastEventTime: null, isActive: false, count: 0 },
|
|
27
|
-
event: { id: 'event', label: 'Events', lastEventTime: null, isActive: false, count: 0 },
|
|
28
|
-
},
|
|
29
|
-
repos: new Map(),
|
|
30
|
-
totalEvents: 0,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function pipelineReducer(state: PipelineState, event: PipelineEvent): PipelineState {
|
|
34
|
-
const now = event.timestamp;
|
|
35
|
-
|
|
36
|
-
switch (event.type) {
|
|
37
|
-
case 'FS_CHANGE':
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
40
|
-
stages: {
|
|
41
|
-
...state.stages,
|
|
42
|
-
disk: { ...state.stages.disk, lastEventTime: now, isActive: true },
|
|
43
|
-
},
|
|
44
|
-
totalEvents: state.totalEvents + 1,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
case 'WATCH_DETECTED':
|
|
48
|
-
return {
|
|
49
|
-
...state,
|
|
50
|
-
stages: {
|
|
51
|
-
...state.stages,
|
|
52
|
-
watch: { ...state.stages.watch, lastEventTime: now, isActive: true },
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
case 'CACHE_REBUILD':
|
|
57
|
-
case 'CACHE_HIT': {
|
|
58
|
-
const newRepos = new Map(state.repos);
|
|
59
|
-
if (event.payload.repo) {
|
|
60
|
-
newRepos.set(event.payload.repo, {
|
|
61
|
-
path: event.payload.repo,
|
|
62
|
-
lastEventTime: now,
|
|
63
|
-
lastEventType: event.type,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
...state,
|
|
68
|
-
stages: {
|
|
69
|
-
...state.stages,
|
|
70
|
-
cache: {
|
|
71
|
-
...state.stages.cache,
|
|
72
|
-
lastEventTime: now,
|
|
73
|
-
isActive: true,
|
|
74
|
-
count: (state.stages.cache.count ?? 0) + 1,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
repos: newRepos,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
case 'EVENT_BROADCAST':
|
|
82
|
-
return {
|
|
83
|
-
...state,
|
|
84
|
-
stages: {
|
|
85
|
-
...state.stages,
|
|
86
|
-
event: {
|
|
87
|
-
...state.stages.event,
|
|
88
|
-
lastEventTime: now,
|
|
89
|
-
isActive: true,
|
|
90
|
-
count: (state.stages.event.count ?? 0) + 1,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
default:
|
|
96
|
-
return state;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// =============================================================================
|
|
101
|
-
// Transitions
|
|
102
|
-
// =============================================================================
|
|
103
|
-
|
|
104
|
-
const pipelineTransitions: TransitionDefinition[] = [
|
|
105
|
-
{ watch: 'stages.disk.lastEventTime', condition: 'changed', animate: 'pulse', target: 'stage-disk' },
|
|
106
|
-
{ watch: 'stages.watch.lastEventTime', condition: 'changed', animate: 'pulse', target: 'stage-watch' },
|
|
107
|
-
{ watch: 'stages.cache.lastEventTime', condition: 'changed', animate: 'pulse', target: 'stage-cache' },
|
|
108
|
-
{ watch: 'stages.event.lastEventTime', condition: 'changed', animate: 'pulse', target: 'stage-event' },
|
|
109
|
-
{ watch: 'stages.event.count', condition: 'increased', animate: 'particle-flow', target: 'flow-cache-event' },
|
|
110
|
-
];
|
|
111
|
-
|
|
112
|
-
// =============================================================================
|
|
113
|
-
// Sub-Components
|
|
114
|
-
// =============================================================================
|
|
115
|
-
|
|
116
|
-
interface StageBoxProps {
|
|
117
|
-
stage: PipelineStage;
|
|
118
|
-
isAnimating: boolean;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function StageBox({ stage, isAnimating }: StageBoxProps) {
|
|
122
|
-
const baseStyle: React.CSSProperties = {
|
|
123
|
-
display: 'flex',
|
|
124
|
-
flexDirection: 'column',
|
|
125
|
-
alignItems: 'center',
|
|
126
|
-
justifyContent: 'center',
|
|
127
|
-
width: 100,
|
|
128
|
-
height: 80,
|
|
129
|
-
borderRadius: 8,
|
|
130
|
-
backgroundColor: stage.isActive ? '#3b82f6' : '#374151',
|
|
131
|
-
color: 'white',
|
|
132
|
-
fontFamily: 'system-ui, sans-serif',
|
|
133
|
-
transition: 'all 0.3s ease',
|
|
134
|
-
boxShadow: isAnimating ? '0 0 20px rgba(59, 130, 246, 0.8)' : 'none',
|
|
135
|
-
transform: isAnimating ? 'scale(1.05)' : 'scale(1)',
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<div id={`stage-${stage.id}`} style={baseStyle}>
|
|
140
|
-
<div style={{ fontWeight: 'bold', fontSize: 14 }}>{stage.label}</div>
|
|
141
|
-
{stage.count !== undefined && (
|
|
142
|
-
<div style={{ fontSize: 20, fontWeight: 'bold' }}>{stage.count}</div>
|
|
143
|
-
)}
|
|
144
|
-
{stage.lastEventTime && (
|
|
145
|
-
<div style={{ fontSize: 10, opacity: 0.7 }}>
|
|
146
|
-
{formatTimeAgo(stage.lastEventTime)}
|
|
147
|
-
</div>
|
|
148
|
-
)}
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
interface FlowArrowProps {
|
|
154
|
-
id: string;
|
|
155
|
-
isAnimating: boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function FlowArrow({ id, isAnimating }: FlowArrowProps) {
|
|
159
|
-
const style: React.CSSProperties = {
|
|
160
|
-
display: 'flex',
|
|
161
|
-
alignItems: 'center',
|
|
162
|
-
justifyContent: 'center',
|
|
163
|
-
width: 60,
|
|
164
|
-
height: 40,
|
|
165
|
-
color: isAnimating ? '#3b82f6' : '#6b7280',
|
|
166
|
-
fontSize: 24,
|
|
167
|
-
transition: 'color 0.3s ease',
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div id={id} style={style}>
|
|
172
|
-
{isAnimating ? (
|
|
173
|
-
<span style={{ animation: 'pulse 0.5s ease-in-out' }}>→→→</span>
|
|
174
|
-
) : (
|
|
175
|
-
'→'
|
|
176
|
-
)}
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function formatTimeAgo(timestamp: number): string {
|
|
182
|
-
const seconds = Math.floor((Date.now() - timestamp) / 1000);
|
|
183
|
-
if (seconds < 60) return `${seconds}s ago`;
|
|
184
|
-
const minutes = Math.floor(seconds / 60);
|
|
185
|
-
if (minutes < 60) return `${minutes}m ago`;
|
|
186
|
-
const hours = Math.floor(minutes / 60);
|
|
187
|
-
return `${hours}h ago`;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// =============================================================================
|
|
191
|
-
// Main Component
|
|
192
|
-
// =============================================================================
|
|
193
|
-
|
|
194
|
-
export interface PipelineViewProps {
|
|
195
|
-
eventSource: EventSource<PipelineEvent>;
|
|
196
|
-
title?: string;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export function PipelineView({ eventSource, title = 'Pipeline View' }: PipelineViewProps) {
|
|
200
|
-
const { state, animations, isReplay, reset } = useStateView<PipelineState, PipelineEvent>({
|
|
201
|
-
initialState: initialPipelineState,
|
|
202
|
-
reducer: pipelineReducer,
|
|
203
|
-
eventSource,
|
|
204
|
-
transitions: pipelineTransitions,
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
const isStageAnimating = (stageId: string) =>
|
|
208
|
-
animations.some((a) => a.target === `stage-${stageId}`);
|
|
209
|
-
|
|
210
|
-
const isFlowAnimating = (flowId: string) =>
|
|
211
|
-
animations.some((a) => a.target === flowId);
|
|
212
|
-
|
|
213
|
-
const containerStyle: React.CSSProperties = {
|
|
214
|
-
fontFamily: 'system-ui, sans-serif',
|
|
215
|
-
backgroundColor: '#1f2937',
|
|
216
|
-
color: 'white',
|
|
217
|
-
padding: 24,
|
|
218
|
-
borderRadius: 12,
|
|
219
|
-
minWidth: 600,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const headerStyle: React.CSSProperties = {
|
|
223
|
-
display: 'flex',
|
|
224
|
-
justifyContent: 'space-between',
|
|
225
|
-
alignItems: 'center',
|
|
226
|
-
marginBottom: 24,
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const pipelineStyle: React.CSSProperties = {
|
|
230
|
-
display: 'flex',
|
|
231
|
-
alignItems: 'center',
|
|
232
|
-
justifyContent: 'center',
|
|
233
|
-
gap: 8,
|
|
234
|
-
marginBottom: 24,
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const statsStyle: React.CSSProperties = {
|
|
238
|
-
display: 'flex',
|
|
239
|
-
gap: 24,
|
|
240
|
-
justifyContent: 'center',
|
|
241
|
-
padding: '16px 0',
|
|
242
|
-
borderTop: '1px solid #374151',
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
const statBoxStyle: React.CSSProperties = {
|
|
246
|
-
textAlign: 'center',
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
const repoListStyle: React.CSSProperties = {
|
|
250
|
-
marginTop: 16,
|
|
251
|
-
padding: 16,
|
|
252
|
-
backgroundColor: '#111827',
|
|
253
|
-
borderRadius: 8,
|
|
254
|
-
maxHeight: 200,
|
|
255
|
-
overflowY: 'auto',
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
return (
|
|
259
|
-
<div style={containerStyle}>
|
|
260
|
-
<div style={headerStyle}>
|
|
261
|
-
<h2 style={{ margin: 0 }}>{title}</h2>
|
|
262
|
-
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
|
263
|
-
{isReplay && (
|
|
264
|
-
<span style={{ fontSize: 12, color: '#f59e0b' }}>REPLAY</span>
|
|
265
|
-
)}
|
|
266
|
-
<button
|
|
267
|
-
onClick={reset}
|
|
268
|
-
style={{
|
|
269
|
-
padding: '4px 12px',
|
|
270
|
-
borderRadius: 4,
|
|
271
|
-
border: 'none',
|
|
272
|
-
backgroundColor: '#374151',
|
|
273
|
-
color: 'white',
|
|
274
|
-
cursor: 'pointer',
|
|
275
|
-
}}
|
|
276
|
-
>
|
|
277
|
-
Reset
|
|
278
|
-
</button>
|
|
279
|
-
</div>
|
|
280
|
-
</div>
|
|
281
|
-
|
|
282
|
-
{/* Pipeline Stages */}
|
|
283
|
-
<div style={pipelineStyle}>
|
|
284
|
-
<StageBox stage={state.stages.disk} isAnimating={isStageAnimating('disk')} />
|
|
285
|
-
<FlowArrow id="flow-disk-watch" isAnimating={isFlowAnimating('flow-disk-watch')} />
|
|
286
|
-
<StageBox stage={state.stages.watch} isAnimating={isStageAnimating('watch')} />
|
|
287
|
-
<FlowArrow id="flow-watch-cache" isAnimating={isFlowAnimating('flow-watch-cache')} />
|
|
288
|
-
<StageBox stage={state.stages.cache} isAnimating={isStageAnimating('cache')} />
|
|
289
|
-
<FlowArrow id="flow-cache-event" isAnimating={isFlowAnimating('flow-cache-event')} />
|
|
290
|
-
<StageBox stage={state.stages.event} isAnimating={isStageAnimating('event')} />
|
|
291
|
-
</div>
|
|
292
|
-
|
|
293
|
-
{/* Stats */}
|
|
294
|
-
<div style={statsStyle}>
|
|
295
|
-
<div style={statBoxStyle}>
|
|
296
|
-
<div style={{ fontSize: 24, fontWeight: 'bold' }}>{state.repos.size}</div>
|
|
297
|
-
<div style={{ fontSize: 12, color: '#9ca3af' }}>Repos</div>
|
|
298
|
-
</div>
|
|
299
|
-
<div style={statBoxStyle}>
|
|
300
|
-
<div style={{ fontSize: 24, fontWeight: 'bold' }}>{state.stages.cache.count}</div>
|
|
301
|
-
<div style={{ fontSize: 12, color: '#9ca3af' }}>Cache Ops</div>
|
|
302
|
-
</div>
|
|
303
|
-
<div style={statBoxStyle}>
|
|
304
|
-
<div style={{ fontSize: 24, fontWeight: 'bold' }}>{state.stages.event.count}</div>
|
|
305
|
-
<div style={{ fontSize: 12, color: '#9ca3af' }}>Events</div>
|
|
306
|
-
</div>
|
|
307
|
-
<div style={statBoxStyle}>
|
|
308
|
-
<div style={{ fontSize: 24, fontWeight: 'bold' }}>{state.totalEvents}</div>
|
|
309
|
-
<div style={{ fontSize: 12, color: '#9ca3af' }}>Total</div>
|
|
310
|
-
</div>
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
{/* Repo List */}
|
|
314
|
-
{state.repos.size > 0 && (
|
|
315
|
-
<div style={repoListStyle}>
|
|
316
|
-
<div style={{ fontSize: 12, color: '#9ca3af', marginBottom: 8 }}>
|
|
317
|
-
Active Repositories
|
|
318
|
-
</div>
|
|
319
|
-
{Array.from(state.repos.values()).map((repo) => (
|
|
320
|
-
<div
|
|
321
|
-
key={repo.path}
|
|
322
|
-
style={{
|
|
323
|
-
display: 'flex',
|
|
324
|
-
justifyContent: 'space-between',
|
|
325
|
-
padding: '4px 0',
|
|
326
|
-
borderBottom: '1px solid #374151',
|
|
327
|
-
}}
|
|
328
|
-
>
|
|
329
|
-
<span style={{ fontSize: 13 }}>{repo.path}</span>
|
|
330
|
-
<span style={{ fontSize: 11, color: '#9ca3af' }}>
|
|
331
|
-
{repo.lastEventType} - {formatTimeAgo(repo.lastEventTime)}
|
|
332
|
-
</span>
|
|
333
|
-
</div>
|
|
334
|
-
))}
|
|
335
|
-
</div>
|
|
336
|
-
)}
|
|
337
|
-
|
|
338
|
-
{/* CSS for animations */}
|
|
339
|
-
<style>{`
|
|
340
|
-
@keyframes pulse {
|
|
341
|
-
0%, 100% { opacity: 1; }
|
|
342
|
-
50% { opacity: 0.5; }
|
|
343
|
-
}
|
|
344
|
-
`}</style>
|
|
345
|
-
</div>
|
|
346
|
-
);
|
|
347
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State View Components
|
|
3
|
-
*
|
|
4
|
-
* A pattern for state-driven visualizations where:
|
|
5
|
-
* - Telemetry events are processed into state changes
|
|
6
|
-
* - State has a defined shape
|
|
7
|
-
* - State changes trigger animations/transitions
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export * from './types';
|
|
11
|
-
export { useStateView } from './useStateView';
|
|
12
|
-
export type { UseStateViewOptions, UseStateViewResult } from './useStateView';
|
|
13
|
-
export { PipelineView } from './PipelineView';
|
|
14
|
-
export type { PipelineViewProps } from './PipelineView';
|