react-dashstream 0.3.3 → 0.3.4
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/dist/AIOPsDashboard.d.ts +6 -0
- package/dist/AIOPsDashboard.d.ts.map +1 -1
- package/dist/components/DatacenterView/DatacenterView.d.ts +19 -1
- package/dist/components/DatacenterView/DatacenterView.d.ts.map +1 -1
- package/dist/data/DataProvider.d.ts +20 -1
- package/dist/data/DataProvider.d.ts.map +1 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2085 -2045
- package/package.json +1 -1
- package/skills/dashstream-3d-dashboard/SKILL.md +1 -0
- package/skills/dashstream-core/SKILL.md +5 -3
- package/skills/dashstream-datacenter-view/SKILL.md +46 -7
- package/skills/dashstream-live-data/SKILL.md +24 -3
package/package.json
CHANGED
|
@@ -56,6 +56,7 @@ Key props (see **dashstream-core** for full `AIOPsDashboardProps`):
|
|
|
56
56
|
| `carouselSpeed` | `number` | `0.006` | Rotation speed |
|
|
57
57
|
| `fontFamily` | `string` | — | CSS font-family |
|
|
58
58
|
| `children` | `ReactNode` | — | `Service` children |
|
|
59
|
+
| `skipDataProvider` | `boolean` | — | When `true`, the shell does not wrap itself in `DataProvider` (parent already provides live-data context). Used with **`DatacenterView`** `liveDataHost="datacenter"` or a custom outer `DataProvider`. See **dashstream-live-data**. |
|
|
59
60
|
|
|
60
61
|
---
|
|
61
62
|
|
|
@@ -33,7 +33,7 @@ For specific features, see sibling skills:
|
|
|
33
33
|
## Package basics
|
|
34
34
|
|
|
35
35
|
> **Package**: `react-dashstream` (npm)
|
|
36
|
-
> **Version**: 0.
|
|
36
|
+
> **Version**: 0.3.3
|
|
37
37
|
> **Peer deps**: `react` ^18 || ^19, `react-dom` ^18 || ^19
|
|
38
38
|
> **License**: MIT
|
|
39
39
|
|
|
@@ -95,7 +95,7 @@ ComponentDialog ← Drill-down with internals + graphs
|
|
|
95
95
|
├─ HistoricalGraphPanel ← Sparkline charts
|
|
96
96
|
└─ CPU3D / Memory3D / DriveBay3D / NetworkBlock3D / ThreadPool3D / Platter3D / Port3D
|
|
97
97
|
|
|
98
|
-
DataProvider ← Polling engine + credentials modal
|
|
98
|
+
DataProvider ← Polling engine + credentials modal (may wrap AIOPsDashboard or be hoisted at DatacenterView; see dashstream-live-data)
|
|
99
99
|
|
|
100
100
|
EventView ← Standalone event console (table view)
|
|
101
101
|
|
|
@@ -195,7 +195,7 @@ SAP sub-component helpers: `getServerSubComponents`, `getServerGraphSeries`, `ge
|
|
|
195
195
|
|
|
196
196
|
### Data layer
|
|
197
197
|
|
|
198
|
-
`DataProvider`, `useAIOpsData`, `useAIOpsDataOptional`, `useQueryResult`, `extractUniqueQueries`, `extractDatacenterMetricQueries`, `defaultDataTransform`
|
|
198
|
+
`DataProvider`, `useAIOpsData`, `useAIOpsDataOptional`, `useQueryResult`, `extractUniqueQueries`, `extractDatacenterMetricQueries`, `mergeLiveDataQueries`, `defaultDataTransform`
|
|
199
199
|
|
|
200
200
|
### Datacenter topology map
|
|
201
201
|
|
|
@@ -260,6 +260,7 @@ interface AIOPsDashboardProps {
|
|
|
260
260
|
dataRefreshInterval?: number; // Default: 60000
|
|
261
261
|
serviceDataBindings?: Record<string, ServiceMetricBinding[]>;
|
|
262
262
|
eventApiConfig?: EventApiConfig; // Enable event-to-dashboard bridge
|
|
263
|
+
skipDataProvider?: boolean; // Parent already wraps DataProvider (e.g. DatacenterView hoist)
|
|
263
264
|
children: React.ReactNode;
|
|
264
265
|
}
|
|
265
266
|
```
|
|
@@ -328,3 +329,4 @@ Output: `dist/index.js` (ESM), `dist/index.d.ts`, `dist/index.css`.
|
|
|
328
329
|
10. **`graphSeries` replaces defaults** — When provided, all auto-generated sparklines are removed.
|
|
329
330
|
11. **Event bridge matching** — Node `name` must match event `host` (case-insensitive) for `eventApiConfig` to highlight nodes automatically.
|
|
330
331
|
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.
|
|
332
|
+
13. **Duplicate `DataProvider`** — If you hoist `DataProvider` (e.g. around `DatacenterView`), set `skipDataProvider` on `AIOPsDashboard` and merge PromQL queries with `mergeLiveDataQueries` so only one provider polls. See **dashstream-live-data** and **dashstream-datacenter-view**.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dashstream-datacenter-view
|
|
3
|
-
description:
|
|
3
|
+
description: DatacenterView topology maps, liveDataHost, deferCredentialsUntilDashboard, metricBindings, drill-down AIOPsDashboard
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: opencode
|
|
6
6
|
metadata:
|
|
@@ -12,8 +12,8 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
- Document `DatacenterView` — SVG topology or geographic map with CSS 3D building markers
|
|
14
14
|
- Explain both array config and declarative JSX composition APIs
|
|
15
|
-
- Cover sites, building variants, connections,
|
|
16
|
-
- Show how drill-down integrates with `AIOPsDashboard`
|
|
15
|
+
- Cover sites, building variants, connections, **`liveDataHost` / `deferCredentialsUntilDashboard`**, `metricBindings`, and geography
|
|
16
|
+
- Show how drill-down integrates with `AIOPsDashboard` and optional hoisted `DataProvider`
|
|
17
17
|
|
|
18
18
|
## When to use me
|
|
19
19
|
|
|
@@ -149,17 +149,52 @@ Pass `dataCenters` with embedded `metrics`. No `DataProvider` required.
|
|
|
149
149
|
|
|
150
150
|
## PromQL (live) metrics on markers
|
|
151
151
|
|
|
152
|
-
1.
|
|
152
|
+
1. Provide a **`DataProvider`** whose `config.queries` list includes every PromQL string used by **`metricBindings`**. Use **`extractDatacenterMetricQueries(metricBindings)`**, or **`mergeLiveDataQueries(metricBindings, aiOpsDashboardProps)`** when you also run dashboard live data from the same provider (see below).
|
|
153
153
|
2. Pass **`metricBindings`**: `Record<buildingId, Partial<Record<keyof DatacenterMetrics, DataBinding>>>` — same `DataBinding` shape as service-level bindings (`string` or `{ query, transform? }`).
|
|
154
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
155
|
|
|
156
|
-
|
|
156
|
+
Map-level bindings use **building `id`**, not service `name`. Service-level **`dataBindings`** inside the drill-down dashboard still key off **`name`** on carousel children.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Hoisted `DataProvider` (map + dashboard, one poll loop)
|
|
161
|
+
|
|
162
|
+
Instead of wrapping `DataProvider` yourself, set:
|
|
163
|
+
|
|
164
|
+
- **`liveDataHost`**: `"dashboard"` (default) — only the drill-down `AIOPsDashboard` mounts `DataProvider` when you open a site (previous behavior).
|
|
165
|
+
- **`liveDataHost`**: `"datacenter"` — `DatacenterView` wraps itself in a **single** `DataProvider` with queries from **`mergeLiveDataQueries(metricBindings, aiOpsDashboardProps)`**. The inner `AIOPsDashboard` receives **`skipDataProvider`** automatically when it would have duplicated live-data wiring.
|
|
166
|
+
|
|
167
|
+
Optional top-level props (fallbacks use `aiOpsDashboardProps` when omitted):
|
|
168
|
+
|
|
169
|
+
- **`dataEndpoint`** / **`dataRefreshInterval`** — PromQL base URL and poll interval for the hoisted provider.
|
|
170
|
+
|
|
171
|
+
### Credentials timing on the map
|
|
172
|
+
|
|
173
|
+
- **`deferCredentialsUntilDashboard`** (default `false`): when **`liveDataHost="datacenter"`**, if `true`, the credentials modal is deferred until the user is in the **drill-down dashboard** phase (`promptCredentials` tracks map vs dashboard). You stay on the map without a key prompt; after credentials are set, both map and dashboard can use the same context.
|
|
174
|
+
|
|
175
|
+
Example (shared endpoint, defer modal until drill-down):
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
<DatacenterView
|
|
179
|
+
liveDataHost="datacenter"
|
|
180
|
+
deferCredentialsUntilDashboard
|
|
181
|
+
metricBindings={mapMetricBindings}
|
|
182
|
+
dataEndpoint="https://prom.example.com/api/v1/query"
|
|
183
|
+
aiOpsDashboardProps={{
|
|
184
|
+
liveData: true,
|
|
185
|
+
dataEndpoint: "https://prom.example.com/api/v1/query",
|
|
186
|
+
dataBindings: { /* service name → props */ },
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{/* topology children */}
|
|
190
|
+
</DatacenterView>
|
|
191
|
+
```
|
|
157
192
|
|
|
158
193
|
---
|
|
159
194
|
|
|
160
195
|
## Drill-down dashboard
|
|
161
196
|
|
|
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.
|
|
197
|
+
`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`, **`skipDataProvider`** (set automatically when `liveDataHost="datacenter"` supplies the provider), etc., for service-level PromQL inside the opened datacenter.
|
|
163
198
|
|
|
164
199
|
---
|
|
165
200
|
|
|
@@ -176,7 +211,11 @@ This path is **independent** of `AIOPsDashboard`'s `dataBindings` (which key off
|
|
|
176
211
|
| `children` | `ReactNode` | — | Declarative topology (`DatacenterSite`, `TowerDC`, …). When set, `dataCenters` is ignored (dev warning if both are passed) |
|
|
177
212
|
| `dataCenters` | `DatacenterBuildingConfig[]` | `[]` | Flat / JSON-friendly config; required unless `children` is used |
|
|
178
213
|
| `connections` | `DatacenterConnection[]` | `[]` | Link lines between building or site ids |
|
|
179
|
-
| `metricBindings` | `DatacenterMetricBindings` | — | Building id → metric field → PromQL `DataBinding`; needs `DataProvider` + `extractDatacenterMetricQueries` |
|
|
214
|
+
| `metricBindings` | `DatacenterMetricBindings` | — | Building id → metric field → PromQL `DataBinding`; needs `DataProvider` + `extractDatacenterMetricQueries` (or hoisted provider via `liveDataHost`) |
|
|
215
|
+
| `dataEndpoint` | `string` | — | PromQL endpoint for map bindings; falls back to `aiOpsDashboardProps.dataEndpoint` |
|
|
216
|
+
| `dataRefreshInterval` | `number` | — | Poll interval for hoisted provider; falls back to `aiOpsDashboardProps.dataRefreshInterval` |
|
|
217
|
+
| `liveDataHost` | `"dashboard" \| "datacenter"` | `"dashboard"` | Where `DataProvider` mounts: per-drill-down vs merged around `DatacenterView` |
|
|
218
|
+
| `deferCredentialsUntilDashboard` | `boolean` | `false` | With `liveDataHost="datacenter"`, defer credentials modal until drill-down dashboard is active |
|
|
180
219
|
| `dataTransform` | `(raw: unknown) => unknown` | `defaultDataTransform` | Applied to each binding unless overridden per binding |
|
|
181
220
|
| `geography` | `DatacenterGeography` | — | `outlinePathD` + optional `referencePoints` (SVG coords) |
|
|
182
221
|
| `showGeography` | `boolean` | `false` | When true, draws outline + reference points |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dashstream-live-data
|
|
3
|
-
description: Wire live PromQL data
|
|
3
|
+
description: Wire live PromQL data via DataProvider, bindings, mergeLiveDataQueries, skipDataProvider, and promptCredentials
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: opencode
|
|
6
6
|
metadata:
|
|
@@ -11,9 +11,9 @@ metadata:
|
|
|
11
11
|
## What I do
|
|
12
12
|
|
|
13
13
|
- Explain the 4 data binding paths: node props, service dialog metrics, component dialog metrics, and hooks
|
|
14
|
-
- Document `DataProvider
|
|
14
|
+
- Document `DataProvider` (`promptCredentials`), `dataBindings`, `serviceDataBindings`, `mergeLiveDataQueries`, `skipDataProvider` on `AIOPsDashboard`, and data hooks
|
|
15
15
|
- Specify the endpoint contract (method, headers, response format)
|
|
16
|
-
- Show patterns for custom transforms
|
|
16
|
+
- Show patterns for custom transforms, multi-component services, and parent-hoisted providers (with **dashstream-datacenter-view**)
|
|
17
17
|
|
|
18
18
|
## When to use me
|
|
19
19
|
|
|
@@ -198,6 +198,7 @@ interface DataContextValue {
|
|
|
198
198
|
lastRefreshError: string | null;
|
|
199
199
|
lastRefreshTime: Date | null;
|
|
200
200
|
credentialsSet: boolean;
|
|
201
|
+
credentials: Credentials | null;
|
|
201
202
|
setCredentials: (creds: Credentials) => void;
|
|
202
203
|
}
|
|
203
204
|
```
|
|
@@ -222,6 +223,26 @@ import { DataProvider, useAIOpsData } from "react-dashstream";
|
|
|
222
223
|
</DataProvider>
|
|
223
224
|
```
|
|
224
225
|
|
|
226
|
+
### `promptCredentials`
|
|
227
|
+
|
|
228
|
+
`DataProvider` accepts optional **`promptCredentials`** (default `true`). When `false`, children render but the **credentials modal is hidden** until `promptCredentials` becomes `true`. Polling still waits until credentials exist. Use this when a parent defers the modal (for example `DatacenterView` with `deferCredentialsUntilDashboard`).
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Provider placement — dashboard vs parent
|
|
233
|
+
|
|
234
|
+
| Placement | Who wraps `DataProvider` | Typical use |
|
|
235
|
+
| --------- | ------------------------ | ----------- |
|
|
236
|
+
| **Default** | `AIOPsDashboard` when `liveData`, `dataEndpoint`, and `dataBindings` are set | Standalone 3D dashboard |
|
|
237
|
+
| **Parent** | Your app or **`DatacenterView`** (`liveDataHost="datacenter"`) | One poll loop for map markers + drill-down services; avoids nested providers |
|
|
238
|
+
|
|
239
|
+
When a parent already mounts `DataProvider` with the **merged** query list:
|
|
240
|
+
|
|
241
|
+
1. Build queries with **`mergeLiveDataQueries(metricBindings, aiOpsDashboardProps)`** (map-level `DatacenterMetricBindings` plus dashboard `dataBindings` / `serviceDataBindings` when `liveData` is enabled).
|
|
242
|
+
2. Pass **`skipDataProvider={true}`** on `AIOPsDashboard` so it does not create a second provider.
|
|
243
|
+
|
|
244
|
+
`DatacenterView` can perform both steps when **`liveDataHost="datacenter"`** — see **dashstream-datacenter-view**.
|
|
245
|
+
|
|
225
246
|
---
|
|
226
247
|
|
|
227
248
|
## Full live-data dashboard example
|