react-dashstream 0.3.1 → 0.3.3

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.
@@ -0,0 +1,287 @@
1
+ ---
2
+ name: dashstream-component-dialogs
3
+ description: Configure drill-down dialogs with custom metrics, internals, sparklines, and alerts
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ audience: developers
8
+ workflow: react
9
+ ---
10
+
11
+ ## What I do
12
+
13
+ - Document the ComponentDialog system (gauges, drill-down internals, sparkline graphs)
14
+ - Explain `dialogMetrics`, `subComponents`, and `graphSeries` props
15
+ - Cover automatic threshold-based alerts and custom alert positioning
16
+ - Show how to wire live data into dialog metrics via service props
17
+
18
+ ## When to use me
19
+
20
+ Use this when customizing what appears in the drill-down panel when a user clicks a node — custom gauges, internal 3D sub-components, sparkline charts, or alert callouts.
21
+
22
+ ---
23
+
24
+ ## Component dialog — default gauges
25
+
26
+ The **ComponentDialog** appears when clicking a node. Default gauges are derived from node type:
27
+
28
+ - **Server**: CPU (from `cpuLoad`), Memory (from `memLoad`), Storage
29
+ - **Database**: Capacity (from `capacity`), Memory, Storage
30
+ - **Dispatcher**: Traffic (from `traffic`), Memory, Storage
31
+ - **Message Server**: Queue (from `queueDepth`), Memory, Storage
32
+
33
+ Default thresholds: warn at 70, critical at 85.
34
+
35
+ ---
36
+
37
+ ## Custom dialogMetrics
38
+
39
+ Override default gauges with `dialogMetrics` on any compound node:
40
+
41
+ ```tsx
42
+ <ServerNode
43
+ name="SRV-01"
44
+ status="online"
45
+ cpuLoad={67}
46
+ memLoad={72}
47
+ ex={200} ey={380}
48
+ compactOffset={{ x: -30, y: -20 }}
49
+ zIndex={8}
50
+ dialogMetrics={[
51
+ { id: "cpu", label: "CPU", sublabel: "PROCESSOR", value: 67, unit: "%" },
52
+ { id: "mem", label: "MEMORY", sublabel: "HEAP USAGE", value: 72, unit: "%" },
53
+ { id: "iops", label: "IOPS", sublabel: "DISK OPS", value: 45, unit: "k/s", icon: "disk" },
54
+ {
55
+ id: "threads",
56
+ label: "THREADS",
57
+ sublabel: "ACTIVE",
58
+ value: 82,
59
+ unit: "%",
60
+ warnAt: 60,
61
+ critAt: 80,
62
+ icon: "cpu",
63
+ },
64
+ ]}
65
+ />
66
+ ```
67
+
68
+ ```ts
69
+ interface ComponentDialogMetric {
70
+ id: string; // Unique key
71
+ label: string; // Upper label
72
+ sublabel: string; // Lower label
73
+ value: number; // 0–100
74
+ unit?: string; // Default "%"
75
+ icon?: "cpu" | "mem" | "disk"; // Default "cpu"
76
+ warnAt?: number; // Default 70
77
+ critAt?: number; // Default 85
78
+ color?: string; // Override bar color (bypasses threshold coloring)
79
+ }
80
+ ```
81
+
82
+ All compound nodes accept `dialogMetrics`: `ServerNode`, `DatabaseNode`, `WebDispatcherNode`, `MessageServerNode`.
83
+
84
+ **When provided, all default gauges are removed** — you must define every metric you want shown.
85
+
86
+ ---
87
+
88
+ ## Drill-down internals — custom subComponents
89
+
90
+ When clicking a node, the drill-down shows internal 3D sub-components. Default sub-components are auto-generated per type. Override with `subComponents`:
91
+
92
+ ```tsx
93
+ import { CPU3D, Memory3D, DriveBay3D, ThreadPool3D, NetworkBlock3D, Platter3D, Port3D } from "react-dashstream";
94
+ import type { SubComponentConfig } from "react-dashstream";
95
+
96
+ const internals: SubComponentConfig[] = [
97
+ { id: "cpu-0", label: "CPU-0", status: "online",
98
+ element: <CPU3D label="CPU-0" load={67} color="#00e5ff" /> },
99
+ { id: "heap", label: "HEAP", status: "warning",
100
+ element: <Memory3D label="HEAP" usedPercent={92} color="#8855ee" status="warning" /> },
101
+ { id: "drive", label: "DRIVE-0", status: "online",
102
+ element: <DriveBay3D label="DRIVE-0" color="#00e5ff" activity={true} /> },
103
+ { id: "threads", label: "THREADS", status: "online",
104
+ element: <ThreadPool3D label="THREADS" color="#00e5ff" /> },
105
+ { id: "net", label: "NET", status: "online",
106
+ element: <NetworkBlock3D label="NET" color="#00e5ff" /> },
107
+ ];
108
+
109
+ <ServerNode subComponents={internals} ... />
110
+ ```
111
+
112
+ ```ts
113
+ interface SubComponentConfig {
114
+ id: string; // Unique key
115
+ label: string; // Display name
116
+ status: ComponentStatus; // LED color
117
+ detail?: string; // Fault description
118
+ element: ReactNode; // 3D element to render
119
+ }
120
+ ```
121
+
122
+ All compound nodes accept `subComponents`. **When provided, all auto-generated sub-components are removed.**
123
+
124
+ ---
125
+
126
+ ## Graph series — custom sparklines
127
+
128
+ The drill-down's historical panel shows sparkline charts. Default graphs are auto-generated. Override with `graphSeries`:
129
+
130
+ ```tsx
131
+ import type { GraphSeries } from "react-dashstream";
132
+
133
+ const graphs: GraphSeries[] = [
134
+ { id: "cpu", label: "CPU-0", unit: "%", color: "#00e5ff", data: [45, 52, 67, 71, 68, 55] },
135
+ { id: "mem", label: "HEAP", unit: "%", color: "#8855ee", data: [60, 65, 72, 78, 82, 75] },
136
+ { id: "iops", label: "DISK", unit: "k/s", color: "#ff8c00", data: [12, 15, 22, 18, 25, 20] },
137
+ ];
138
+
139
+ <ServerNode graphSeries={graphs} ... />
140
+ ```
141
+
142
+ ```ts
143
+ interface GraphSeries {
144
+ id: string; // Unique key
145
+ label: string; // Label above sparkline
146
+ unit: string; // Suffix
147
+ color: string; // Line color
148
+ data: number[]; // Points (most recent last)
149
+ }
150
+ ```
151
+
152
+ All compound nodes accept `graphSeries`. **When provided, all auto-generated sparklines are removed.**
153
+
154
+ ---
155
+
156
+ ## Alerts — automatic threshold detection
157
+
158
+ Nodes auto-render `NodeCallout` alerts when metrics breach thresholds:
159
+
160
+ - **Warning** at 70% → orange callout
161
+ - **Critical** at 85% → red callout
162
+
163
+ Sources (checked in priority order):
164
+
165
+ 1. `dialogMetrics` values vs their `warnAt`/`critAt`
166
+ 2. Context values (`cpuLoad`, `memLoad`, `traffic`, `queueDepth`, `capacity`) vs default thresholds
167
+
168
+ ```tsx
169
+ // Auto-alert from cpuLoad > 85
170
+ <ServerNode cpuLoad={92} memLoad={64}
171
+ alert={{ offsetX: -160, offsetY: -60, align: "left" }}
172
+ ... />
173
+
174
+ // Custom message
175
+ <ServerNode cpuLoad={92}
176
+ alert={{ msg: "CPU overload — scale out", offsetX: -160, offsetY: -60, align: "left" }}
177
+ ... />
178
+
179
+ // Custom thresholds via dialogMetrics
180
+ <ServerNode
181
+ dialogMetrics={[
182
+ { id: "cpu", label: "CPU", sublabel: "PROCESSOR", value: 67,
183
+ warnAt: 50, critAt: 75 },
184
+ ]}
185
+ alert={{ offsetX: -160, offsetY: -60, align: "left" }}
186
+ ... />
187
+ ```
188
+
189
+ ### Alert prop shape
190
+
191
+ ```ts
192
+ alert?: {
193
+ msg?: string; // Custom message (auto-generated if omitted)
194
+ offsetX?: number; // X offset from node (default 110)
195
+ offsetY?: number; // Y offset from node (default -30)
196
+ align?: "left" | "right" | "top" | "bottom"; // Default "right"
197
+ internalRef?: string; // Sub-component ID
198
+ }
199
+ ```
200
+
201
+ Alert `align` options: `"left"`, `"right"`, `"top"`, `"bottom"`.
202
+
203
+ ---
204
+
205
+ ## ServiceDialog — static and live metrics
206
+
207
+ The **ServiceDialog** panel shows KPIs when a service is expanded.
208
+
209
+ ### Static metrics via ServiceMeta
210
+
211
+ ```tsx
212
+ const services: ServiceMeta[] = [
213
+ {
214
+ name: "My Service",
215
+ status: "online",
216
+ metrics: [
217
+ { label: "Uptime", value: "99.99%", color: "#00ff88" },
218
+ { label: "Avg Latency", value: "8ms", color: "#00e5ff" },
219
+ ],
220
+ alerts: [
221
+ { level: "info", message: "All Systems Nominal" },
222
+ { level: "warning", message: "High CPU on SRV-01" },
223
+ { level: "critical", message: "DB connection pool exhausted" },
224
+ ],
225
+ },
226
+ ];
227
+ ```
228
+
229
+ ### Live metrics via serviceDataBindings
230
+
231
+ See **dashstream-live-data** for `serviceDataBindings` configuration.
232
+
233
+ ---
234
+
235
+ ## Full example — service with all dialog features
236
+
237
+ ```tsx
238
+ import { CPU3D, Memory3D } from "react-dashstream";
239
+
240
+ function MyService({ name, status, cpuLoad, memLoad, dbCapacity, dbStatus }: any) {
241
+ return (
242
+ <Service
243
+ name={name}
244
+ status={status ?? "online"}
245
+ connections={[
246
+ { from: [330, 200], to: [200, 380], visibleAtPhase: 3 },
247
+ { from: [330, 200], to: [460, 380], visibleAtPhase: 3 },
248
+ ]}
249
+ >
250
+ <ServerNode
251
+ ex={200} ey={380}
252
+ compactOffset={{ x: -30, y: -20 }}
253
+ zIndex={8}
254
+ name="SRV-01"
255
+ subLabel="APP SERVER"
256
+ status={status ?? "online"}
257
+ cpuLoad={cpuLoad ?? 42}
258
+ memLoad={memLoad ?? 60}
259
+ alert={{ offsetX: -160, offsetY: -60, align: "left" }}
260
+ dialogMetrics={[
261
+ { id: "cpu", label: "CPU", sublabel: "PROCESSOR", value: cpuLoad ?? 42 },
262
+ { id: "mem", label: "MEMORY", sublabel: "HEAP", value: memLoad ?? 60 },
263
+ ]}
264
+ subComponents={[
265
+ { id: "cpu", label: "CPU-0", status: "online",
266
+ element: <CPU3D label="CPU-0" load={cpuLoad ?? 42} /> },
267
+ { id: "mem", label: "HEAP", status: "online",
268
+ element: <Memory3D label="HEAP" usedPercent={memLoad ?? 60} /> },
269
+ ]}
270
+ graphSeries={[
271
+ { id: "cpu", label: "CPU", unit: "%", color: "#00e5ff", data: [45, 52, 67, 71, 68] },
272
+ ]}
273
+ />
274
+ <DatabaseNode
275
+ ex={460} ey={380}
276
+ compactOffset={{ x: 30, y: -20 }}
277
+ zIndex={7}
278
+ name="DB-01"
279
+ subLabel="PRIMARY"
280
+ status={dbStatus ?? "online"}
281
+ capacity={dbCapacity ?? 55}
282
+ alert={{ offsetX: 160, offsetY: -60, align: "right" }}
283
+ />
284
+ </Service>
285
+ );
286
+ }
287
+ ```
@@ -0,0 +1,330 @@
1
+ ---
2
+ name: dashstream-core
3
+ description: React DashStream package overview, installation, theming, architecture, exports, and types
4
+ license: MIT
5
+ compatibility: opencode
6
+ metadata:
7
+ audience: developers
8
+ workflow: react
9
+ ---
10
+
11
+ ## What I do
12
+
13
+ - Explain the `react-dashstream` package structure, exports, and type system
14
+ - Guide correct installation and CSS import
15
+ - Document light/dark theming and `ThemeProvider` usage
16
+ - Provide the full architecture tree and source layout
17
+ - List all public exports and common pitfalls
18
+
19
+ ## When to use me
20
+
21
+ Use this when starting a new project with `react-dashstream`, need the import list, want to understand the component hierarchy, or are troubleshooting theme / CSS issues.
22
+
23
+ For specific features, see sibling skills:
24
+
25
+ - **dashstream-3d-dashboard** — `AIOPsDashboard`, services, nodes, positioning
26
+ - **dashstream-live-data** — `DataProvider`, data bindings, hooks, endpoint contract
27
+ - **dashstream-component-dialogs** — drill-down metrics, internals, graph series, alerts
28
+ - **dashstream-event-view** — `EventView`, event API, field mapping
29
+ - **dashstream-datacenter-view** — `DatacenterView`, topology map, geography, buildings
30
+
31
+ ---
32
+
33
+ ## Package basics
34
+
35
+ > **Package**: `react-dashstream` (npm)
36
+ > **Version**: 0.2.0
37
+ > **Peer deps**: `react` ^18 || ^19, `react-dom` ^18 || ^19
38
+ > **License**: MIT
39
+
40
+ React DashStream renders a rotating 3D carousel of infrastructure services using CSS 3D transforms (no WebGL, no canvas). Each service expands into a multi-tiered topology with servers, databases, dispatchers, message servers, and user nodes connected by animated SVG lines. Components can be drilled into to reveal internal sub-components with sparkline graphs and gauges.
41
+
42
+ Two modes:
43
+
44
+ 1. **Static mode** — pass props directly for demo or snapshot views.
45
+ 2. **Live data mode** — poll an HTTP endpoint with PromQL queries and auto-inject resolved values as component props.
46
+
47
+ ---
48
+
49
+ ## Installation and CSS
50
+
51
+ ```bash
52
+ npm install react-dashstream
53
+ ```
54
+
55
+ ```tsx
56
+ import "react-dashstream/dist/index.css";
57
+ import { AIOPsDashboard, Service, ServerNode, DatabaseNode } from "react-dashstream";
58
+ ```
59
+
60
+ **Always import the CSS file** — without it, no styles render.
61
+
62
+ ---
63
+
64
+ ## Light / dark theme
65
+
66
+ The dashboard supports **`"light"`** and **`"dark"`** modes.
67
+
68
+ - **`AIOPsDashboard`** defaults to **light** and exposes a header toggle. Use **`backgroundImage`** (dark) and **`lightBackgroundImage`** (light when set).
69
+ - **Controlled mode:** pass **`theme`** and **`onThemeChange`** (`DashboardTheme`) so parent state owns the mode (e.g. sync app chrome + `EventView`).
70
+ - **`ThemeProvider`** (export) + **`useTheme()`** — wrap subtrees so **`EventView`**, **`CredentialsModal`**, **`ServiceDialog`**, and **`ComponentDialog`** match the dashboard. Without a provider, `useTheme()` defaults to **`"dark"`**; prefer wrapping when using `EventView` or the lock screen next to a light dashboard.
71
+ - **`EventView`** accepts optional **`theme`** to override context.
72
+
73
+ When generating multi-view apps (3D + Event Console + credentials), wrap the root in **`ThemeProvider`** with the same value passed to **`AIOPsDashboard`**'s controlled props.
74
+
75
+ ---
76
+
77
+ ## Architecture
78
+
79
+ ```
80
+ AIOPsDashboard ← Shell: header, state, optional DataProvider
81
+ └─ Carousel ← 3D orbit, rotation, hosts dialogs
82
+ └─ Service ← Per-service container, connections, holo base
83
+ ├─ ServerNode ← Compound: ServiceNode + Server3D
84
+ ├─ DatabaseNode ← Compound: ServiceNode + Database3D
85
+ ├─ WebDispatcherNode ← Compound: ServiceNode + WebDispatcher3D
86
+ ├─ MessageServerNode ← Compound: ServiceNode + MessageServer3D
87
+ ├─ HumanNode ← Compound: ServiceNode + Human3D (SVG)
88
+ ├─ SvgConnection ← Animated dashed topology line
89
+ ├─ SyncBridge ← DB replication indicator
90
+ ├─ NodeCallout ← Alert callout (auto from thresholds)
91
+ └─ HoloBase ← Neon platform (auto-rendered)
92
+
93
+ ServiceDialog ← Service-level KPI panel (auto on expand)
94
+ ComponentDialog ← Drill-down with internals + graphs
95
+ ├─ HistoricalGraphPanel ← Sparkline charts
96
+ └─ CPU3D / Memory3D / DriveBay3D / NetworkBlock3D / ThreadPool3D / Platter3D / Port3D
97
+
98
+ DataProvider ← Polling engine + credentials modal
99
+
100
+ EventView ← Standalone event console (table view)
101
+
102
+ DatacenterView ← SVG topology / optional geography map + drill-down dashboard
103
+ ```
104
+
105
+ ### Source layout
106
+
107
+ ```
108
+ src/
109
+ ├── index.ts # Public API barrel
110
+ ├── AIOPsDashboard.tsx # Dashboard shell + live-data wiring
111
+ ├── types.ts # Shared topology/drill-down types
112
+ ├── theme.ts # Status tokens, holo palette, 3D face helpers
113
+ ├── ThemeContext.ts # DashboardTheme, ThemeProvider, useTheme
114
+ ├── styles.css / index.css # Library + dashboard styles
115
+ ├── data/
116
+ │ ├── DataProvider.tsx # Polling engine, context, hooks
117
+ │ ├── CredentialsModal.tsx # Auth prompt UI
118
+ │ └── index.ts
119
+ ├── components/ # ~30 UI components
120
+ │ ├── Carousel.tsx, Service.tsx, ServiceNode.tsx
121
+ │ ├── ServerNode.tsx, DatabaseNode.tsx, WebDispatcherNode.tsx, etc.
122
+ │ ├── Server3D.tsx, Database3D.tsx, etc.
123
+ │ ├── ServiceDialog.tsx, ComponentDialog.tsx
124
+ │ ├── Internal3DComponents.tsx, HistoricalGraphPanel.tsx
125
+ │ ├── ComponentDrillView.tsx, SvgConnection.tsx, SyncBridge.tsx
126
+ │ ├── NodeCallout.tsx, HoloBase.tsx, CarouselContext.ts
127
+ │ ├── EventView/ # Operations event console
128
+ │ │ ├── EventView.tsx # Table component
129
+ │ │ ├── EventView.css
130
+ │ │ ├── EventAlertsContext.tsx # EventAlertsProvider + per-host alert map
131
+ │ │ ├── fetchEvents.ts # Shared fetch/mapping logic
132
+ │ │ ├── types.ts
133
+ │ │ ├── mockData.ts # 28 realistic mock events
134
+ │ │ └── index.ts
135
+ │ ├── DatacenterView/ # Topology map + CSS 3D building markers
136
+ │ │ ├── DatacenterView.tsx
137
+ │ │ ├── DatacenterView.css
138
+ │ │ ├── buildings.tsx # DatacenterSite, TowerDC, FlatDC, …
139
+ │ │ ├── collectDatacenterTree.ts
140
+ │ │ ├── types.ts
141
+ │ │ └── index.ts
142
+ │ └── index.ts
143
+ ├── services/
144
+ │ ├── SAPService.tsx, ExchangeService.tsx
145
+ │ ├── sapSubComponents.tsx
146
+ │ └── index.ts
147
+ example/
148
+ ├── Dashboard.tsx
149
+ └── services/
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Exports
155
+
156
+ Everything below is exported from `react-dashstream`.
157
+
158
+ ### Default export
159
+
160
+ `AIOPsDashboard` — main dashboard shell component.
161
+
162
+ ### Compound nodes
163
+
164
+ `ServerNode`, `DatabaseNode`, `WebDispatcherNode`, `MessageServerNode`, `HumanNode`
165
+
166
+ ### Layout
167
+
168
+ `Carousel`, `Service`, `ServiceNode`
169
+
170
+ ### 3D models
171
+
172
+ `Server3D`, `Database3D`, `WebDispatcher3D`, `MessageServer3D`, `Human3D`
173
+
174
+ ### Internal 3D components (for drill-down)
175
+
176
+ `CPU3D`, `Memory3D`, `DriveBay3D`, `NetworkBlock3D`, `ThreadPool3D`, `Platter3D`, `Port3D`
177
+
178
+ ### Indicators and connections
179
+
180
+ `SvgConnection`, `SyncBridge`, `NodeCallout`, `HoloBase`
181
+
182
+ ### Dialogs
183
+
184
+ `ServiceDialog`, `ComponentDialog`, `HistoricalGraphPanel`, `ComponentDrillView`
185
+
186
+ ### Pre-built services
187
+
188
+ `SAPService`, `ExchangeService`
189
+
190
+ SAP helpers: `computeSAPServiceStatus`, `computeSAPDialogMetrics`, `computeSAPDialogAlerts`, `SAP_CONNECTIONS`
191
+
192
+ Exchange helpers: `computeExchangeServiceStatus`, `computeExchangeDialogMetrics`, `computeExchangeDialogAlerts`, `EXCHANGE_CONNECTIONS`
193
+
194
+ SAP sub-component helpers: `getServerSubComponents`, `getServerGraphSeries`, `getDispatcherSubComponents`, `getDispatcherGraphSeries`, `getMessageServerSubComponents`, `getMessageServerGraphSeries`, `getDatabaseSubComponents`, `getDatabaseGraphSeries`
195
+
196
+ ### Data layer
197
+
198
+ `DataProvider`, `useAIOpsData`, `useAIOpsDataOptional`, `useQueryResult`, `extractUniqueQueries`, `extractDatacenterMetricQueries`, `defaultDataTransform`
199
+
200
+ ### Datacenter topology map
201
+
202
+ `DatacenterView`, `DatacenterSite`, shape components (`StandardDC`, `TowerDC`, `FlatDC`, `StorageDC`, `GoogleDC`, `MicroDC`, `OfficeDC`), generic `Datacenter`, `collectDatacenterTree`, `getBuildingVariant`, and types `DatacenterViewProps`, `DatacenterBuildingConfig`, `DatacenterBuildingNodeProps`, `DatacenterBuildingVariant`, `DatacenterConnection`, `DatacenterGeography`, `DatacenterMetrics`, `DatacenterProps`, `DatacenterSiteLabels`, `DatacenterSiteProps`, `DatacenterViewPhase`, `CollectedTopology`
203
+
204
+ ### Event alerts
205
+
206
+ `EventAlertsProvider`, `useEventAlerts`, `useEventAlertsOptional`
207
+
208
+ ### Theme
209
+
210
+ `STATUS_CFG`, `HOLO_CYAN` (`"#00e5ff"`), `HOLO_BLUE` (`"#0055cc"`), `HOLO_SURFACE`, `HOLO_GLASS`, `makeFaceStyles(W, H, D)`
211
+
212
+ `ThemeProvider`, `useTheme`, type `DashboardTheme` (`"light" | "dark"`)
213
+
214
+ ### Context hooks
215
+
216
+ `CarouselContext`, `CarouselItemContext`, `useCarouselContext`, `useCarouselItemContext`, `ServiceContext`
217
+
218
+ ### Type exports
219
+
220
+ `AIOPsDashboardProps`, `ServiceMeta`, `ServiceMetricBinding`, `DashboardTheme`, `ComponentStatus`, `StatusCfg`, `FaceName`, `Base3DProps`, `ComponentType`, `ComponentContext`, `ComponentDialogMetric`, `SubComponentConfig`, `GraphSeries`, `SelectedComponent`, `ConnectionConfig`, `ViewState`, `DataBinding`, `DataBindings`, `DatacenterMetricBindings`, `DataProviderConfig`, `Credentials`, `DataContextValue`, `ServiceProps`, `ServiceContextValue`, `ServiceNodeProps`, `CarouselProps`, `ServerNodeProps`, `DatabaseNodeProps`, `HumanNodeProps`, `WebDispatcherNodeProps`, `MessageServerNodeProps`, `SvgConnectionProps`, `SyncBridgeProps`, `NodeCalloutProps`, `ServiceDialogProps`, `ServiceDialogMetric`, `ServiceDialogAlert`, `ComponentDialogProps`, `ComponentDrillViewProps`, `CarouselContextValue`, `CarouselItemContextValue`, `SAPServiceProps`, `SAPServiceOwnProps`, `SAPServiceConfig`, `ExchangeServiceProps`, `ExchangeServiceOwnProps`, `ExchangeServiceConfig`, `EventHostAlert`, `EventAlertsContextValue`, `EventAlertsProviderProps`, `DatacenterViewProps`, `DatacenterBuildingConfig`, `DatacenterBuildingNodeProps`, `DatacenterBuildingVariant`, `DatacenterConnection`, `DatacenterGeography`, `DatacenterMetrics`, `DatacenterProps`, `DatacenterSiteLabels`, `DatacenterSiteProps`, `DatacenterViewPhase`, `CollectedTopology`
221
+
222
+ ---
223
+
224
+ ## Key types quick reference
225
+
226
+ ### ComponentStatus
227
+
228
+ ```ts
229
+ type ComponentStatus = "online" | "warning" | "critical" | "offline";
230
+ ```
231
+
232
+ | Status | Color | Glow |
233
+ | ---------- | --------- | -------- |
234
+ | `online` | `#00e5ff` | cyan |
235
+ | `warning` | `#ff8c00` | orange |
236
+ | `critical` | `#ff2255` | red |
237
+ | `offline` | `#1e3a5a` | dim blue |
238
+
239
+ ### AIOPsDashboardProps
240
+
241
+ `DashboardTheme` is `"light" | "dark"` (exported).
242
+
243
+ ```ts
244
+ interface AIOPsDashboardProps {
245
+ title?: string;
246
+ brandName?: string; // Default: "BUSAUD AIOps"
247
+ brandTag?: string; // Default: "3D MONITOR"
248
+ services?: ServiceMeta[];
249
+ backgroundImage?: string;
250
+ lightBackgroundImage?: string; // Used in light mode when set
251
+ theme?: DashboardTheme; // Controlled theme (pair with onThemeChange)
252
+ onThemeChange?: (theme: DashboardTheme) => void;
253
+ logoUrl?: string;
254
+ carouselSpeed?: number; // Default: 0.006
255
+ fontFamily?: string;
256
+ liveData?: boolean; // Default: false
257
+ dataEndpoint?: string;
258
+ dataBindings?: DataBindings;
259
+ dataTransform?: (raw: unknown) => unknown;
260
+ dataRefreshInterval?: number; // Default: 60000
261
+ serviceDataBindings?: Record<string, ServiceMetricBinding[]>;
262
+ eventApiConfig?: EventApiConfig; // Enable event-to-dashboard bridge
263
+ children: React.ReactNode;
264
+ }
265
+ ```
266
+
267
+ ### ServiceMeta
268
+
269
+ ```ts
270
+ interface ServiceMeta {
271
+ name: string; // Must match child component name
272
+ status: ComponentStatus;
273
+ dbSync?: boolean; // Default: true
274
+ metrics?: ServiceDialogMetric[];
275
+ alerts?: ServiceDialogAlert[];
276
+ }
277
+
278
+ interface ServiceDialogMetric {
279
+ label: string;
280
+ value: string;
281
+ color: string;
282
+ }
283
+
284
+ interface ServiceDialogAlert {
285
+ level: "info" | "warning" | "critical";
286
+ message: string;
287
+ }
288
+ ```
289
+
290
+ ### ConnectionConfig
291
+
292
+ ```ts
293
+ interface ConnectionConfig {
294
+ from: [number, number];
295
+ to: [number, number];
296
+ visibleAtPhase?: number; // Default: 0
297
+ color?: string; // Default: "#00e5ff"
298
+ duration?: string; // Default: "1.2s"
299
+ }
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Build and development
305
+
306
+ ```bash
307
+ npm run dev # Vite dev server (loads example/Dashboard.tsx)
308
+ npm run build # TypeScript check + Vite library build
309
+ npm run build:lib # Vite library build only
310
+ npm run preview # Preview production build
311
+ ```
312
+
313
+ Output: `dist/index.js` (ESM), `dist/index.d.ts`, `dist/index.css`.
314
+
315
+ ---
316
+
317
+ ## Common pitfalls
318
+
319
+ 1. **Missing CSS import** — Always import `react-dashstream/dist/index.css`.
320
+ 2. **Name mismatch** — `name` on child components must exactly match keys in `dataBindings`, `serviceDataBindings`, and `ServiceMeta.name`.
321
+ 3. **Credentials are in-memory only** — Page refresh requires re-entering credentials.
322
+ 4. **Default transform is plain-text** — For JSON endpoints, provide a custom `dataTransform`.
323
+ 5. **Polling only** — No WebSocket/SSE support; uses `setInterval`.
324
+ 6. **`visibleAtPhase` matters** — Nodes without proper values won't animate during expansion.
325
+ 7. **Connection coordinates** — `from`/`to` arrays use `[x, y]` matching `ex`/`ey` of connected nodes.
326
+ 8. **`dialogMetrics` replaces defaults** — When provided, all default gauges (CPU/Memory/Storage) are removed.
327
+ 9. **`subComponents` replaces defaults** — When provided, all auto-generated sub-components are removed.
328
+ 10. **`graphSeries` replaces defaults** — When provided, all auto-generated sparklines are removed.
329
+ 11. **Event bridge matching** — Node `name` must match event `host` (case-insensitive) for `eventApiConfig` to highlight nodes automatically.
330
+ 12. **Theme context** — `EventView` and `CredentialsModal` use `useTheme()`. Without `ThemeProvider`, context defaults to `"dark"`. Wrap the app (or use `EventView`'s `theme` prop) so light dashboards are not paired with a dark event console or lock screen.