react-dashstream 0.3.1 → 0.3.2
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 +16 -1
- package/package.json +2 -2
- package/skills/dashstream-3d-dashboard/SKILL.md +318 -0
- package/skills/dashstream-component-dialogs/SKILL.md +287 -0
- package/skills/dashstream-core/SKILL.md +330 -0
- package/skills/dashstream-datacenter-view/SKILL.md +198 -0
- package/skills/dashstream-event-view/SKILL.md +212 -0
- package/skills/dashstream-live-data/SKILL.md +250 -0
- package/dashstream-skill.md +0 -1208
|
@@ -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.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dashstream-datacenter-view
|
|
3
|
+
description: Build topology maps with DatacenterView, buildings, geography, and drill-down
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
audience: developers
|
|
8
|
+
workflow: react
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What I do
|
|
12
|
+
|
|
13
|
+
- Document `DatacenterView` — SVG topology or geographic map with CSS 3D building markers
|
|
14
|
+
- Explain both array config and declarative JSX composition APIs
|
|
15
|
+
- Cover sites, building variants, connections, metric bindings, and geography
|
|
16
|
+
- Show how drill-down integrates with `AIOPsDashboard`
|
|
17
|
+
|
|
18
|
+
## When to use me
|
|
19
|
+
|
|
20
|
+
Use this when building a datacenter topology map, geographic view, or configuring building markers with drill-down dashboards.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
SVG-based **network topology** (grid) or optional **geographic outline** (consumer-supplied SVG path `d`), CSS **3D building** markers, animated links, and **drill-down** into a nested `AIOPsDashboard` when the user selects a site or building.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Data model
|
|
31
|
+
|
|
32
|
+
- **`DatacenterBuildingConfig`** — one marker on the map (`id`, `name`, `subtitle`, `x` / `y` as **percent** of the 800×600 scene, `status`, `metrics`, `services`, `renderServices`, `variant`, optional `brand`, `isExternal`).
|
|
33
|
+
- **`siteId`** — optional; multiple buildings with the same `siteId` share **one marker**, **combined metrics** (sums / averages for PUE, temperature, uptime), and a **multi-building cluster** visualization (each building's `variant` is shown). Optional **`siteLabels`** (`Record<string, { label: string; subtitle?: string }>`) overrides auto-generated titles. **`DatacenterSite`** can supply `label` / `subtitle` per `siteId`; the **`siteLabels`** prop merges on top (prop wins on conflict).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Minimal usage (array config)
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import "react-dashstream/dist/index.css";
|
|
41
|
+
import { DatacenterView } from "react-dashstream";
|
|
42
|
+
import type { DatacenterBuildingConfig, DatacenterConnection } from "react-dashstream";
|
|
43
|
+
|
|
44
|
+
const dataCenters: DatacenterBuildingConfig[] = [
|
|
45
|
+
/* id, x, y (%), metrics, services, renderServices, variant, siteId? … */
|
|
46
|
+
];
|
|
47
|
+
const connections: DatacenterConnection[] = [];
|
|
48
|
+
|
|
49
|
+
<DatacenterView dataCenters={dataCenters} connections={connections} />
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Declarative JSX topology
|
|
55
|
+
|
|
56
|
+
Instead of a `dataCenters` array, pass `children` using `DatacenterSite` and shape components:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import "react-dashstream/dist/index.css";
|
|
60
|
+
import { DatacenterView, DatacenterSite, TowerDC, FlatDC } from "react-dashstream";
|
|
61
|
+
|
|
62
|
+
<DatacenterView connections={[]}>
|
|
63
|
+
<DatacenterSite siteId="riyadh-hub" x={42} y={38} label="Riyadh hub" subtitle="Primary region">
|
|
64
|
+
<TowerDC
|
|
65
|
+
id="dc-east-1"
|
|
66
|
+
name="East tower"
|
|
67
|
+
subtitle="Tier III"
|
|
68
|
+
status="online"
|
|
69
|
+
metrics={{
|
|
70
|
+
carbonEmissions: 0,
|
|
71
|
+
powerUtilization: 0,
|
|
72
|
+
cooling: 0,
|
|
73
|
+
pue: 1.4,
|
|
74
|
+
uptime: 99.9,
|
|
75
|
+
activeServers: 0,
|
|
76
|
+
temperature: 22,
|
|
77
|
+
networkThroughput: 0,
|
|
78
|
+
}}
|
|
79
|
+
services={[]}
|
|
80
|
+
>
|
|
81
|
+
{/* Service / ServerNode / … drill-down tree */}
|
|
82
|
+
</TowerDC>
|
|
83
|
+
<FlatDC
|
|
84
|
+
id="dc-flat-2"
|
|
85
|
+
name="Flat block"
|
|
86
|
+
subtitle="Storage"
|
|
87
|
+
status="online"
|
|
88
|
+
metrics={{
|
|
89
|
+
carbonEmissions: 0,
|
|
90
|
+
powerUtilization: 0,
|
|
91
|
+
cooling: 0,
|
|
92
|
+
pue: 1.3,
|
|
93
|
+
uptime: 99.5,
|
|
94
|
+
activeServers: 0,
|
|
95
|
+
temperature: 21,
|
|
96
|
+
networkThroughput: 0,
|
|
97
|
+
}}
|
|
98
|
+
services={[]}
|
|
99
|
+
/>
|
|
100
|
+
</DatacenterSite>
|
|
101
|
+
</DatacenterView>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Available building shapes:** `StandardDC`, `TowerDC`, `FlatDC`, `StorageDC`, `GoogleDC`, `MicroDC`, `OfficeDC` (alias of `MicroDC`). Use `Datacenter` with `variant` for a single generic component.
|
|
105
|
+
|
|
106
|
+
Building components render `null` on the map; `children` on each building are the drill-down `Service` tree (same as `renderServices()` in the array API).
|
|
107
|
+
|
|
108
|
+
`collectDatacenterTree(children)` is available if you need the resolved `DatacenterBuildingConfig[]` outside the view.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Connections
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
interface DatacenterConnection {
|
|
116
|
+
from: string; // Building id or siteId
|
|
117
|
+
to: string; // Building id or siteId
|
|
118
|
+
throughput: string; // Label (e.g. "10 Gbps")
|
|
119
|
+
isExternal?: boolean; // External link styling
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## DatacenterMetrics
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
interface DatacenterMetrics {
|
|
129
|
+
carbonEmissions: number;
|
|
130
|
+
powerUtilization: number;
|
|
131
|
+
cooling: number;
|
|
132
|
+
pue: number;
|
|
133
|
+
uptime: number;
|
|
134
|
+
activeServers: number;
|
|
135
|
+
temperature: number;
|
|
136
|
+
networkThroughput: number;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Used on markers and for site-level aggregation.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Mock metrics
|
|
145
|
+
|
|
146
|
+
Pass `dataCenters` with embedded `metrics`. No `DataProvider` required.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## PromQL (live) metrics on markers
|
|
151
|
+
|
|
152
|
+
1. Wrap the tree in **`DataProvider`** with `config.queries` including every query used by `metricBindings`, collected via `extractDatacenterMetricQueries(metricBindings)` (and merge with queries for any nested `AIOPsDashboard` if you use `aiOpsDashboardProps`).
|
|
153
|
+
2. Pass **`metricBindings`**: `Record<buildingId, Partial<Record<keyof DatacenterMetrics, DataBinding>>>` — same `DataBinding` shape as service-level bindings (`string` or `{ query, transform? }`).
|
|
154
|
+
3. `DatacenterView` calls `useAIOpsDataOptional()` and merges transformed numbers over each building's static `metrics` (site-level rows aggregate the merged per-building values).
|
|
155
|
+
|
|
156
|
+
This path is **independent** of `AIOPsDashboard`'s `dataBindings` (which key off service `name` on carousel children).
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Drill-down dashboard
|
|
161
|
+
|
|
162
|
+
`aiOpsDashboardProps` is spread onto the inner `AIOPsDashboard`; `services`, `theme`, `children` (from `renderServices()`), and branding are forced from the selected building so the map stays consistent. Use `aiOpsDashboardProps` for `liveData`, `dataEndpoint`, `dataBindings`, `serviceDataBindings`, etc., for service-level PromQL inside the opened datacenter.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Geography (optional)
|
|
167
|
+
|
|
168
|
+
`showGeography` and `geography: { outlinePathD, referencePoints? }` — the package does **not** ship country assets; the app parses or provides an SVG path `d` string (see `example/SaudiMapView.tsx`).
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## DatacenterViewProps (full reference)
|
|
173
|
+
|
|
174
|
+
| Prop | Type | Default | Notes |
|
|
175
|
+
|------|------|---------|-------|
|
|
176
|
+
| `children` | `ReactNode` | — | Declarative topology (`DatacenterSite`, `TowerDC`, …). When set, `dataCenters` is ignored (dev warning if both are passed) |
|
|
177
|
+
| `dataCenters` | `DatacenterBuildingConfig[]` | `[]` | Flat / JSON-friendly config; required unless `children` is used |
|
|
178
|
+
| `connections` | `DatacenterConnection[]` | `[]` | Link lines between building or site ids |
|
|
179
|
+
| `metricBindings` | `DatacenterMetricBindings` | — | Building id → metric field → PromQL `DataBinding`; needs `DataProvider` + `extractDatacenterMetricQueries` |
|
|
180
|
+
| `dataTransform` | `(raw: unknown) => unknown` | `defaultDataTransform` | Applied to each binding unless overridden per binding |
|
|
181
|
+
| `geography` | `DatacenterGeography` | — | `outlinePathD` + optional `referencePoints` (SVG coords) |
|
|
182
|
+
| `showGeography` | `boolean` | `false` | When true, draws outline + reference points |
|
|
183
|
+
| `mapTitle` | `string` | `"Geography — Operations"` | Header when `showGeography` |
|
|
184
|
+
| `topologyTitle` | `string` | `"Network topology"` | Header when not showing geography |
|
|
185
|
+
| `topologyAffiliatesLabel` | `string` | `"AFFILIATES"` | Label in topology-only mode (affiliates zone) |
|
|
186
|
+
| `brandText` | `string` | `"AIOps"` | Header brand |
|
|
187
|
+
| `headerTag` | `string` | `"COMMAND CENTER"` | Corner tag |
|
|
188
|
+
| `initialBuildingId` | `string` | — | Building id to open when `openDashboardOnMount` is true |
|
|
189
|
+
| `openDashboardOnMount` | `boolean` | `false` | Auto-zoom into `initialBuildingId` |
|
|
190
|
+
| `onNavigateEvents` | `() => void` | — | e.g. switch app view to event console |
|
|
191
|
+
| `theme` | `DashboardTheme` | — | Passed through to drill-down dashboard |
|
|
192
|
+
| `onThemeChange` | `(t) => void` | — | |
|
|
193
|
+
| `backgroundImage` / `lightBackgroundImage` | `string` | — | Drill-down `AIOPsDashboard` backgrounds |
|
|
194
|
+
| `aiOpsDashboardProps` | `Partial<AIOPsDashboardProps>` | — | Spread first; `services`, children, theme, branding overridden from selection |
|
|
195
|
+
| `defaultBuildingBrand` | `string` | `"AIOps"` | Fallback label on 3D building faces |
|
|
196
|
+
| `siteLabels` | `Record<string, DatacenterSiteLabels>` | — | Per-siteId titles for multi-building markers |
|
|
197
|
+
| `showMapScaleControls` | `boolean` | `true` | Size / hover sliders in header (map mode) |
|
|
198
|
+
| `mapFooter` | `ReactNode` | — | Rendered below the map when drill-down is not active |
|