@principal-ai/principal-view-react 0.7.14 → 0.7.16

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.
Files changed (138) hide show
  1. package/README.md +9 -24
  2. package/dist/components/ConfigurationSelector.d.ts +1 -1
  3. package/dist/components/ConfigurationSelector.d.ts.map +1 -1
  4. package/dist/components/ConfigurationSelector.js +6 -10
  5. package/dist/components/ConfigurationSelector.js.map +1 -1
  6. package/dist/components/EdgeInfoPanel.d.ts +1 -1
  7. package/dist/components/EdgeInfoPanel.d.ts.map +1 -1
  8. package/dist/components/EdgeInfoPanel.js +14 -18
  9. package/dist/components/EdgeInfoPanel.js.map +1 -1
  10. package/dist/components/GraphRenderer.d.ts +1 -1
  11. package/dist/components/GraphRenderer.d.ts.map +1 -1
  12. package/dist/components/GraphRenderer.js +89 -92
  13. package/dist/components/GraphRenderer.js.map +1 -1
  14. package/dist/components/NarrativeRenderer.d.ts +19 -0
  15. package/dist/components/NarrativeRenderer.d.ts.map +1 -0
  16. package/dist/components/NarrativeRenderer.js +103 -0
  17. package/dist/components/NarrativeRenderer.js.map +1 -0
  18. package/dist/components/NodeInfoPanel.d.ts +1 -1
  19. package/dist/components/NodeInfoPanel.d.ts.map +1 -1
  20. package/dist/components/NodeInfoPanel.js +33 -37
  21. package/dist/components/NodeInfoPanel.js.map +1 -1
  22. package/dist/components/NodeTooltip.js +15 -19
  23. package/dist/components/NodeTooltip.js.map +1 -1
  24. package/dist/components/SelectionSidebar.d.ts +1 -1
  25. package/dist/components/SelectionSidebar.d.ts.map +1 -1
  26. package/dist/components/SelectionSidebar.js +26 -30
  27. package/dist/components/SelectionSidebar.js.map +1 -1
  28. package/dist/components/TestEventPanel.d.ts +6 -0
  29. package/dist/components/TestEventPanel.d.ts.map +1 -1
  30. package/dist/components/TestEventPanel.js +157 -160
  31. package/dist/components/TestEventPanel.js.map +1 -1
  32. package/dist/edges/CustomEdge.d.ts +1 -1
  33. package/dist/edges/CustomEdge.d.ts.map +1 -1
  34. package/dist/edges/CustomEdge.js +18 -22
  35. package/dist/edges/CustomEdge.js.map +1 -1
  36. package/dist/edges/GenericEdge.d.ts +1 -1
  37. package/dist/edges/GenericEdge.d.ts.map +1 -1
  38. package/dist/edges/GenericEdge.js +3 -7
  39. package/dist/edges/GenericEdge.js.map +1 -1
  40. package/dist/hooks/usePathBasedEvents.d.ts +1 -1
  41. package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
  42. package/dist/hooks/usePathBasedEvents.js +14 -18
  43. package/dist/hooks/usePathBasedEvents.js.map +1 -1
  44. package/dist/index.d.ts +1 -5
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +12 -33
  47. package/dist/index.js.map +1 -1
  48. package/dist/nodes/CustomNode.d.ts +1 -1
  49. package/dist/nodes/CustomNode.d.ts.map +1 -1
  50. package/dist/nodes/CustomNode.js +22 -26
  51. package/dist/nodes/CustomNode.js.map +1 -1
  52. package/dist/nodes/GenericNode.d.ts +1 -1
  53. package/dist/nodes/GenericNode.d.ts.map +1 -1
  54. package/dist/nodes/GenericNode.js +4 -8
  55. package/dist/nodes/GenericNode.js.map +1 -1
  56. package/dist/utils/animationMapping.d.ts +1 -1
  57. package/dist/utils/animationMapping.d.ts.map +1 -1
  58. package/dist/utils/animationMapping.js +6 -13
  59. package/dist/utils/animationMapping.js.map +1 -1
  60. package/dist/utils/graphConverter.d.ts +1 -1
  61. package/dist/utils/graphConverter.d.ts.map +1 -1
  62. package/dist/utils/graphConverter.js +4 -8
  63. package/dist/utils/graphConverter.js.map +1 -1
  64. package/dist/utils/iconResolver.js +7 -45
  65. package/dist/utils/iconResolver.js.map +1 -1
  66. package/dist/utils/narrative-converter.d.ts +45 -0
  67. package/dist/utils/narrative-converter.d.ts.map +1 -0
  68. package/dist/utils/narrative-converter.js +113 -0
  69. package/dist/utils/narrative-converter.js.map +1 -0
  70. package/dist/utils/narrative-loader.d.ts +53 -0
  71. package/dist/utils/narrative-loader.d.ts.map +1 -0
  72. package/dist/utils/narrative-loader.js +163 -0
  73. package/dist/utils/narrative-loader.js.map +1 -0
  74. package/package.json +22 -25
  75. package/src/components/ConfigurationSelector.tsx +1 -1
  76. package/src/components/EdgeInfoPanel.tsx +1 -1
  77. package/src/components/GraphRenderer.test.tsx +1 -1
  78. package/src/components/GraphRenderer.tsx +2 -2
  79. package/src/components/NarrativeRenderer.tsx +171 -0
  80. package/src/components/NodeInfoPanel.tsx +1 -1
  81. package/src/components/NodeTooltip.tsx +3 -3
  82. package/src/components/PendingChanges.test.tsx +1 -1
  83. package/src/components/SelectionSidebar.tsx +1 -1
  84. package/src/components/TestEventPanel.tsx +145 -121
  85. package/src/edges/CustomEdge.tsx +1 -1
  86. package/src/edges/GenericEdge.tsx +1 -1
  87. package/src/hooks/usePathBasedEvents.ts +1 -1
  88. package/src/index.ts +1 -7
  89. package/src/nodes/CustomNode.tsx +1 -1
  90. package/src/nodes/GenericNode.tsx +1 -1
  91. package/src/stories/AnimationWorkshop.stories.tsx +1 -1
  92. package/src/stories/CanvasEdgeTypes.stories.tsx +1 -1
  93. package/src/stories/CanvasNodeTypes.stories.tsx +1 -1
  94. package/src/stories/ColorPriority.stories.tsx +1 -1
  95. package/src/stories/EventDrivenAnimations.stories.tsx +1 -1
  96. package/src/stories/GraphRenderer.stories.tsx +1 -1
  97. package/src/stories/Introduction.mdx +4 -21
  98. package/src/stories/MultiConfig.stories.tsx +1 -1
  99. package/src/stories/MultiDirectionalConnections.stories.tsx +1 -1
  100. package/src/stories/NodeFieldsAudit.stories.tsx +1 -1
  101. package/src/stories/NodeShapes.stories.tsx +1 -1
  102. package/src/stories/OtelComponents.stories.tsx +1 -1
  103. package/src/stories/RealTestExecution.stories.tsx +111 -1
  104. package/src/stories/TraceViewer.stories.tsx +1 -1
  105. package/src/stories/ValidatedExecution.stories.tsx +1 -1
  106. package/src/stories/data/graph-converter-test-execution.json +204 -326
  107. package/src/stories/data/graph-converter-test.narrative.json +106 -0
  108. package/src/stories/data/graph-converter-validated-execution.json +6 -6
  109. package/src/utils/animationMapping.ts +1 -1
  110. package/src/utils/graphConverter.ts +1 -1
  111. package/src/utils/narrative-converter.ts +147 -0
  112. package/src/utils/narrative-loader.ts +172 -0
  113. package/dist/components/EventLog.d.ts +0 -20
  114. package/dist/components/EventLog.d.ts.map +0 -1
  115. package/dist/components/EventLog.js +0 -13
  116. package/dist/components/EventLog.js.map +0 -1
  117. package/dist/components/EventLog.test.d.ts +0 -2
  118. package/dist/components/EventLog.test.d.ts.map +0 -1
  119. package/dist/components/EventLog.test.js +0 -73
  120. package/dist/components/EventLog.test.js.map +0 -1
  121. package/dist/components/GraphRenderer.test.d.ts +0 -2
  122. package/dist/components/GraphRenderer.test.d.ts.map +0 -1
  123. package/dist/components/GraphRenderer.test.js +0 -88
  124. package/dist/components/GraphRenderer.test.js.map +0 -1
  125. package/dist/components/LayerPanel.d.ts +0 -31
  126. package/dist/components/LayerPanel.d.ts.map +0 -1
  127. package/dist/components/LayerPanel.js +0 -207
  128. package/dist/components/LayerPanel.js.map +0 -1
  129. package/dist/components/MetricsDashboard.d.ts +0 -14
  130. package/dist/components/MetricsDashboard.d.ts.map +0 -1
  131. package/dist/components/MetricsDashboard.js +0 -13
  132. package/dist/components/MetricsDashboard.js.map +0 -1
  133. package/src/components/EventLog.test.tsx +0 -85
  134. package/src/components/EventLog.tsx +0 -51
  135. package/src/components/MetricsDashboard.tsx +0 -40
  136. package/src/stories/EventLog.stories.tsx +0 -161
  137. package/src/stories/IndustryThemes.stories.tsx +0 -483
  138. package/src/stories/MetricsDashboard.stories.tsx +0 -227
@@ -1,483 +0,0 @@
1
- import React, { useState } from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
4
- import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
- import {
6
- terminalTheme,
7
- matrixTheme,
8
- slateTheme,
9
- regalTheme,
10
- glassmorphismTheme,
11
- landingPageTheme,
12
- defaultEditorTheme,
13
- ThemeProvider,
14
- } from '@principal-ade/industry-theme';
15
-
16
- const meta = {
17
- title: 'Themes/IndustryThemes',
18
- component: GraphRenderer,
19
- parameters: {
20
- layout: 'fullscreen',
21
- },
22
- } satisfies Meta<typeof GraphRenderer>;
23
-
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
-
27
- // ============================================================================
28
- // Theme Registry from @principal-ade/industry-theme
29
- // ============================================================================
30
-
31
- interface IndustryTheme {
32
- colors: {
33
- text: string;
34
- background: string;
35
- primary: string;
36
- secondary: string;
37
- accent: string;
38
- success: string;
39
- warning: string;
40
- error: string;
41
- info: string;
42
- border: string;
43
- surface: string;
44
- [key: string]: string;
45
- };
46
- fonts: {
47
- body: string;
48
- heading: string;
49
- monospace: string;
50
- };
51
- [key: string]: unknown;
52
- }
53
-
54
- const themes: Record<string, { theme: IndustryTheme; name: string; description: string }> = {
55
- terminal: {
56
- theme: terminalTheme as IndustryTheme,
57
- name: 'Terminal',
58
- description: 'Dark terminal-style theme with monospace fonts',
59
- },
60
- matrix: {
61
- theme: matrixTheme as IndustryTheme,
62
- name: 'Matrix',
63
- description: 'Green-on-black hacker aesthetic',
64
- },
65
- slate: {
66
- theme: slateTheme as IndustryTheme,
67
- name: 'Slate',
68
- description: 'Modern dark gray theme with amber accents',
69
- },
70
- regal: {
71
- theme: regalTheme as IndustryTheme,
72
- name: 'Regal',
73
- description: 'Elegant dark theme with gold accents',
74
- },
75
- glassmorphism: {
76
- theme: glassmorphismTheme as IndustryTheme,
77
- name: 'Glassmorphism',
78
- description: 'Frosted glass effect with purple tones',
79
- },
80
- landingPage: {
81
- theme: landingPageTheme as IndustryTheme,
82
- name: 'Landing Page',
83
- description: 'Cyan accent on dark background',
84
- },
85
- editor: {
86
- theme: defaultEditorTheme as IndustryTheme,
87
- name: 'Editor',
88
- description: 'VS Code inspired dark theme',
89
- },
90
- };
91
-
92
- // ============================================================================
93
- // Sample Canvas that uses theme colors
94
- // ============================================================================
95
-
96
- function createThemedCanvas(theme: IndustryTheme): ExtendedCanvas {
97
- const colors = theme.colors;
98
-
99
- return {
100
- nodes: [
101
- {
102
- id: 'api-gateway',
103
- type: 'text',
104
- x: 100,
105
- y: 200,
106
- width: 140,
107
- height: 70,
108
- text: '# API Gateway',
109
- pv: {
110
- nodeType: 'api-gateway',
111
- shape: 'rectangle',
112
- icon: 'Globe',
113
- fill: colors.primary,
114
- },
115
- },
116
- {
117
- id: 'auth-service',
118
- type: 'text',
119
- x: 320,
120
- y: 100,
121
- width: 140,
122
- height: 70,
123
- text: '# Auth Service',
124
- pv: {
125
- nodeType: 'service',
126
- shape: 'hexagon',
127
- icon: 'Shield',
128
- fill: colors.success,
129
- },
130
- },
131
- {
132
- id: 'user-service',
133
- type: 'text',
134
- x: 320,
135
- y: 300,
136
- width: 140,
137
- height: 70,
138
- text: '# User Service',
139
- pv: {
140
- nodeType: 'service',
141
- shape: 'hexagon',
142
- icon: 'Users',
143
- fill: colors.info,
144
- },
145
- },
146
- {
147
- id: 'database',
148
- type: 'text',
149
- x: 540,
150
- y: 200,
151
- width: 100,
152
- height: 100,
153
- text: '# Database',
154
- pv: {
155
- nodeType: 'database',
156
- shape: 'circle',
157
- icon: 'Database',
158
- fill: colors.secondary,
159
- },
160
- },
161
- {
162
- id: 'cache',
163
- type: 'text',
164
- x: 540,
165
- y: 350,
166
- width: 80,
167
- height: 80,
168
- text: '# Cache',
169
- pv: {
170
- nodeType: 'cache',
171
- shape: 'diamond',
172
- icon: 'Zap',
173
- fill: colors.warning,
174
- },
175
- },
176
- {
177
- id: 'queue',
178
- type: 'text',
179
- x: 320,
180
- y: 450,
181
- width: 80,
182
- height: 80,
183
- text: '# Queue',
184
- pv: {
185
- nodeType: 'queue',
186
- shape: 'diamond',
187
- icon: 'Inbox',
188
- fill: colors.accent,
189
- },
190
- },
191
- ],
192
- edges: [
193
- {
194
- id: 'e1',
195
- fromNode: 'api-gateway',
196
- toNode: 'auth-service',
197
- fromSide: 'right',
198
- toSide: 'left',
199
- pv: { edgeType: 'http' },
200
- },
201
- {
202
- id: 'e2',
203
- fromNode: 'api-gateway',
204
- toNode: 'user-service',
205
- fromSide: 'right',
206
- toSide: 'left',
207
- pv: { edgeType: 'http' },
208
- },
209
- {
210
- id: 'e3',
211
- fromNode: 'auth-service',
212
- toNode: 'database',
213
- fromSide: 'right',
214
- toSide: 'left',
215
- pv: { edgeType: 'query' },
216
- },
217
- {
218
- id: 'e4',
219
- fromNode: 'user-service',
220
- toNode: 'database',
221
- fromSide: 'right',
222
- toSide: 'left',
223
- pv: { edgeType: 'query' },
224
- },
225
- {
226
- id: 'e5',
227
- fromNode: 'user-service',
228
- toNode: 'cache',
229
- fromSide: 'right',
230
- toSide: 'top',
231
- pv: { edgeType: 'cache' },
232
- },
233
- {
234
- id: 'e6',
235
- fromNode: 'user-service',
236
- toNode: 'queue',
237
- fromSide: 'bottom',
238
- toSide: 'top',
239
- pv: { edgeType: 'async' },
240
- },
241
- ],
242
- pv: {
243
- version: '1.0.0',
244
- name: 'Themed Architecture',
245
- edgeTypes: {
246
- http: { style: 'solid', color: colors.primary, directed: true },
247
- query: { style: 'dashed', color: colors.secondary, directed: true },
248
- cache: { style: 'dotted', color: colors.warning, directed: true },
249
- async: { style: 'dashed', color: colors.accent, directed: true },
250
- },
251
- },
252
- };
253
- }
254
-
255
- // ============================================================================
256
- // Interactive Theme Switcher Component
257
- // ============================================================================
258
-
259
- const ThemeSwitcher = () => {
260
- const [selectedTheme, setSelectedTheme] = useState<string>('terminal');
261
- const themeConfig = themes[selectedTheme];
262
- const canvas = createThemedCanvas(themeConfig.theme);
263
-
264
- return (
265
- <ThemeProvider theme={themeConfig.theme}>
266
- <div
267
- style={{
268
- width: '100%',
269
- height: '100vh',
270
- display: 'flex',
271
- flexDirection: 'column',
272
- backgroundColor: themeConfig.theme.colors.background,
273
- color: themeConfig.theme.colors.text,
274
- fontFamily: themeConfig.theme.fonts.body,
275
- }}
276
- >
277
- {/* Theme Selector Header */}
278
- <div
279
- style={{
280
- padding: '16px 24px',
281
- backgroundColor: themeConfig.theme.colors.surface,
282
- display: 'flex',
283
- alignItems: 'center',
284
- gap: '16px',
285
- borderBottom: `1px solid ${themeConfig.theme.colors.border}`,
286
- }}
287
- >
288
- <label style={{ fontWeight: 600, fontSize: '14px' }}>Theme:</label>
289
- <select
290
- value={selectedTheme}
291
- onChange={(e) => setSelectedTheme(e.target.value)}
292
- style={{
293
- padding: '8px 16px',
294
- fontSize: '14px',
295
- borderRadius: '6px',
296
- border: `1px solid ${themeConfig.theme.colors.border}`,
297
- backgroundColor: themeConfig.theme.colors.background,
298
- color: themeConfig.theme.colors.text,
299
- cursor: 'pointer',
300
- minWidth: '200px',
301
- }}
302
- >
303
- {Object.entries(themes).map(([key, config]) => (
304
- <option key={key} value={key}>
305
- {config.name}
306
- </option>
307
- ))}
308
- </select>
309
-
310
- <div style={{ marginLeft: 'auto', fontSize: '12px', opacity: 0.7 }}>
311
- @principal-ade/industry-theme
312
- </div>
313
- </div>
314
-
315
- {/* Theme Description */}
316
- <div
317
- style={{
318
- padding: '12px 24px',
319
- backgroundColor: themeConfig.theme.colors.surface,
320
- borderBottom: `1px solid ${themeConfig.theme.colors.border}`,
321
- fontSize: '13px',
322
- opacity: 0.8,
323
- }}
324
- >
325
- <strong>{themeConfig.name}</strong>: {themeConfig.description}
326
- </div>
327
-
328
- {/* Graph Renderer */}
329
- <div style={{ flex: 1, position: 'relative' }}>
330
- <GraphRenderer canvas={canvas} width="100%" height="100%" />
331
- </div>
332
-
333
- {/* Color Palette Legend */}
334
- <div
335
- style={{
336
- padding: '16px 24px',
337
- backgroundColor: themeConfig.theme.colors.surface,
338
- borderTop: `1px solid ${themeConfig.theme.colors.border}`,
339
- display: 'flex',
340
- flexWrap: 'wrap',
341
- gap: '16px',
342
- }}
343
- >
344
- {['primary', 'secondary', 'accent', 'success', 'warning', 'error', 'info'].map(
345
- (colorKey) => (
346
- <div
347
- key={colorKey}
348
- style={{
349
- display: 'flex',
350
- alignItems: 'center',
351
- gap: '8px',
352
- fontSize: '12px',
353
- }}
354
- >
355
- <div
356
- style={{
357
- width: '16px',
358
- height: '16px',
359
- borderRadius: '4px',
360
- backgroundColor: themeConfig.theme.colors[colorKey],
361
- border: `1px solid ${themeConfig.theme.colors.border}`,
362
- }}
363
- />
364
- <span style={{ fontFamily: themeConfig.theme.fonts.monospace }}>{colorKey}</span>
365
- </div>
366
- )
367
- )}
368
- </div>
369
- </div>
370
- </ThemeProvider>
371
- );
372
- };
373
-
374
- // ============================================================================
375
- // Stories
376
- // ============================================================================
377
-
378
- export const ThemeSwitcherDemo: Story = {
379
- render: () => <ThemeSwitcher />,
380
- parameters: {
381
- docs: {
382
- description: {
383
- story: `
384
- **Industry Theme Switcher**
385
-
386
- This demo uses the \`@principal-ade/industry-theme\` package to apply different visual themes to the graph.
387
-
388
- Available themes:
389
- - **Terminal**: Dark terminal-style with monospace fonts
390
- - **Matrix**: Green-on-black hacker aesthetic
391
- - **Slate**: Modern dark gray with amber accents
392
- - **Regal**: Elegant dark theme with gold accents
393
- - **Glassmorphism**: Frosted glass effect with purple tones
394
- - **Landing Page**: Cyan accent on dark background
395
- - **Editor**: VS Code inspired dark theme
396
-
397
- Each theme provides a cohesive color palette that is applied to:
398
- - Node fill colors
399
- - Edge colors
400
- - Background and UI elements
401
- `,
402
- },
403
- },
404
- },
405
- };
406
-
407
- // Individual theme stories for direct access
408
- export const TerminalTheme: Story = {
409
- render: () => {
410
- const canvas = createThemedCanvas(terminalTheme as IndustryTheme);
411
- return (
412
- <div style={{ backgroundColor: terminalTheme.colors.background, padding: 20 }}>
413
- <GraphRenderer canvas={canvas} width={800} height={500} />
414
- </div>
415
- );
416
- },
417
- };
418
-
419
- export const MatrixTheme: Story = {
420
- render: () => {
421
- const canvas = createThemedCanvas(matrixTheme as IndustryTheme);
422
- return (
423
- <div style={{ backgroundColor: matrixTheme.colors.background, padding: 20 }}>
424
- <GraphRenderer canvas={canvas} width={800} height={500} />
425
- </div>
426
- );
427
- },
428
- };
429
-
430
- export const SlateTheme: Story = {
431
- render: () => {
432
- const canvas = createThemedCanvas(slateTheme as IndustryTheme);
433
- return (
434
- <div style={{ backgroundColor: slateTheme.colors.background, padding: 20 }}>
435
- <GraphRenderer canvas={canvas} width={800} height={500} />
436
- </div>
437
- );
438
- },
439
- };
440
-
441
- export const RegalTheme: Story = {
442
- render: () => {
443
- const canvas = createThemedCanvas(regalTheme as IndustryTheme);
444
- return (
445
- <div style={{ backgroundColor: regalTheme.colors.background, padding: 20 }}>
446
- <GraphRenderer canvas={canvas} width={800} height={500} />
447
- </div>
448
- );
449
- },
450
- };
451
-
452
- export const GlassmorphismTheme: Story = {
453
- render: () => {
454
- const canvas = createThemedCanvas(glassmorphismTheme as IndustryTheme);
455
- return (
456
- <div style={{ backgroundColor: glassmorphismTheme.colors.background, padding: 20 }}>
457
- <GraphRenderer canvas={canvas} width={800} height={500} />
458
- </div>
459
- );
460
- },
461
- };
462
-
463
- export const LandingPageTheme: Story = {
464
- render: () => {
465
- const canvas = createThemedCanvas(landingPageTheme as IndustryTheme);
466
- return (
467
- <div style={{ backgroundColor: landingPageTheme.colors.background, padding: 20 }}>
468
- <GraphRenderer canvas={canvas} width={800} height={500} />
469
- </div>
470
- );
471
- },
472
- };
473
-
474
- export const EditorTheme: Story = {
475
- render: () => {
476
- const canvas = createThemedCanvas(defaultEditorTheme as IndustryTheme);
477
- return (
478
- <div style={{ backgroundColor: defaultEditorTheme.colors.background, padding: 20 }}>
479
- <GraphRenderer canvas={canvas} width={800} height={500} />
480
- </div>
481
- );
482
- },
483
- };
@@ -1,227 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { MetricsDashboard } from '../components/MetricsDashboard';
3
- import type { GraphMetrics } from '@principal-ai/principal-view-core';
4
-
5
- const meta = {
6
- title: 'Components/MetricsDashboard',
7
- component: MetricsDashboard,
8
- parameters: {
9
- layout: 'centered',
10
- },
11
- tags: ['autodocs'],
12
- } satisfies Meta<typeof MetricsDashboard>;
13
-
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
-
17
- // Sample metrics
18
- const sampleMetrics: GraphMetrics = {
19
- nodes: {
20
- total: 25,
21
- byType: {
22
- process: 10,
23
- data: 8,
24
- external: 7,
25
- },
26
- byStatus: {
27
- active: 20,
28
- inactive: 3,
29
- error: 2,
30
- },
31
- },
32
- edges: {
33
- total: 42,
34
- byType: {
35
- dataflow: 30,
36
- control: 8,
37
- dependency: 4,
38
- },
39
- byStatus: {
40
- active: 38,
41
- inactive: 2,
42
- error: 2,
43
- },
44
- },
45
- events: {
46
- total: 156,
47
- byCategory: {
48
- node: 85,
49
- edge: 45,
50
- validation: 15,
51
- system: 11,
52
- },
53
- byType: {
54
- node_added: 25,
55
- node_updated: 35,
56
- node_removed: 10,
57
- edge_added: 30,
58
- edge_updated: 10,
59
- edge_removed: 5,
60
- validation_run: 15,
61
- system_start: 5,
62
- system_stop: 5,
63
- custom: 16,
64
- },
65
- rate: {
66
- perSecond: 2.5,
67
- perMinute: 150,
68
- perHour: 9000,
69
- },
70
- },
71
- validation: {
72
- violations: 3,
73
- warnings: 7,
74
- healthScore: 0.92,
75
- lastRun: Date.now() - 30000,
76
- },
77
- performance: {
78
- avgEventProcessingTime: 15,
79
- avgValidationTime: 120,
80
- memoryUsage: 45.2,
81
- },
82
- };
83
-
84
- const healthyMetrics: GraphMetrics = {
85
- nodes: {
86
- total: 10,
87
- byType: { process: 5, data: 5 },
88
- byStatus: { active: 10, inactive: 0, error: 0 },
89
- },
90
- edges: {
91
- total: 12,
92
- byType: { dataflow: 12 },
93
- byStatus: { active: 12, inactive: 0, error: 0 },
94
- },
95
- events: {
96
- total: 50,
97
- byCategory: { node: 30, edge: 15, validation: 5, system: 0 },
98
- byType: {
99
- node_added: 10,
100
- node_updated: 15,
101
- node_removed: 5,
102
- edge_added: 12,
103
- edge_updated: 3,
104
- edge_removed: 0,
105
- validation_run: 5,
106
- system_start: 0,
107
- system_stop: 0,
108
- custom: 0,
109
- },
110
- rate: { perSecond: 1.0, perMinute: 60, perHour: 3600 },
111
- },
112
- validation: {
113
- violations: 0,
114
- warnings: 0,
115
- healthScore: 1.0,
116
- lastRun: Date.now() - 5000,
117
- },
118
- performance: {
119
- avgEventProcessingTime: 8,
120
- avgValidationTime: 50,
121
- memoryUsage: 25.5,
122
- },
123
- };
124
-
125
- const criticalMetrics: GraphMetrics = {
126
- nodes: {
127
- total: 50,
128
- byType: { process: 20, data: 15, external: 15 },
129
- byStatus: { active: 30, inactive: 10, error: 10 },
130
- },
131
- edges: {
132
- total: 80,
133
- byType: { dataflow: 50, control: 20, dependency: 10 },
134
- byStatus: { active: 50, inactive: 15, error: 15 },
135
- },
136
- events: {
137
- total: 500,
138
- byCategory: { node: 200, edge: 180, validation: 100, system: 20 },
139
- byType: {
140
- node_added: 50,
141
- node_updated: 100,
142
- node_removed: 30,
143
- edge_added: 80,
144
- edge_updated: 70,
145
- edge_removed: 30,
146
- validation_run: 100,
147
- system_start: 10,
148
- system_stop: 10,
149
- custom: 20,
150
- },
151
- rate: { perSecond: 5.2, perMinute: 312, perHour: 18720 },
152
- },
153
- validation: {
154
- violations: 25,
155
- warnings: 40,
156
- healthScore: 0.35,
157
- lastRun: Date.now() - 60000,
158
- },
159
- performance: {
160
- avgEventProcessingTime: 45,
161
- avgValidationTime: 350,
162
- memoryUsage: 85.8,
163
- },
164
- };
165
-
166
- export const Default: Story = {
167
- args: {
168
- metrics: sampleMetrics,
169
- },
170
- };
171
-
172
- export const HealthySystem: Story = {
173
- args: {
174
- metrics: healthyMetrics,
175
- },
176
- };
177
-
178
- export const CriticalSystem: Story = {
179
- args: {
180
- metrics: criticalMetrics,
181
- },
182
- };
183
-
184
- export const MinimalGraph: Story = {
185
- args: {
186
- metrics: {
187
- nodes: {
188
- total: 2,
189
- byType: { process: 1, data: 1 },
190
- byStatus: { active: 2, inactive: 0, error: 0 },
191
- },
192
- edges: {
193
- total: 1,
194
- byType: { dataflow: 1 },
195
- byStatus: { active: 1, inactive: 0, error: 0 },
196
- },
197
- events: {
198
- total: 5,
199
- byCategory: { node: 2, edge: 1, validation: 1, system: 1 },
200
- byType: {
201
- node_added: 2,
202
- node_updated: 0,
203
- node_removed: 0,
204
- edge_added: 1,
205
- edge_updated: 0,
206
- edge_removed: 0,
207
- validation_run: 1,
208
- system_start: 1,
209
- system_stop: 0,
210
- custom: 0,
211
- },
212
- rate: { perSecond: 0.1, perMinute: 6, perHour: 360 },
213
- },
214
- validation: {
215
- violations: 0,
216
- warnings: 1,
217
- healthScore: 0.95,
218
- lastRun: Date.now() - 10000,
219
- },
220
- performance: {
221
- avgEventProcessingTime: 5,
222
- avgValidationTime: 30,
223
- memoryUsage: 12.3,
224
- },
225
- },
226
- },
227
- };