@checkstack/dashboard-frontend 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/package.json +17 -16
- package/src/Dashboard.tsx +8 -85
- package/src/components/SystemBadgeDataProvider.tsx +5 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,127 @@
|
|
|
1
1
|
# @checkstack/dashboard-frontend
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 32d52c6: feat: unified notification-subscription manager dialog driven by spec registry
|
|
8
|
+
|
|
9
|
+
Replaces the bell-toggle UX (which only managed a single legacy
|
|
10
|
+
catalog group) with a modal that lists every notification type
|
|
11
|
+
registered against a target — system or group — and exposes both
|
|
12
|
+
per-type toggles and a bulk "Subscribe to all / Unsubscribe from all"
|
|
13
|
+
action. Both surfaces (system detail page header bell, dashboard group
|
|
14
|
+
header bell) now open the same `NotificationSubscriptionsManager`
|
|
15
|
+
component.
|
|
16
|
+
|
|
17
|
+
**Key change vs. the prior slot-based approach**: rows are now driven
|
|
18
|
+
by `notificationClient.listSubscriptionSpecs` — the backend's spec
|
|
19
|
+
registry is the single source of truth. Previously, a row only
|
|
20
|
+
appeared if a frontend plugin had remembered to register a
|
|
21
|
+
`createNotificationSubscriptionExtension`; this caused silent drift
|
|
22
|
+
(healthcheck and dependency registered backend specs without frontend
|
|
23
|
+
extensions, so the dialog counted them but never rendered rows). Now,
|
|
24
|
+
every spec the platform knows about renders a row using the spec's
|
|
25
|
+
`display` metadata (title, description, iconName resolved via
|
|
26
|
+
`DynamicIcon`).
|
|
27
|
+
|
|
28
|
+
**Sub-controls registry** (`@checkstack/notification-frontend`):
|
|
29
|
+
plugins that want sub-granularity (anomaly's per-field mute list,
|
|
30
|
+
future severity / channel filters) call
|
|
31
|
+
`registerSubscriptionSubControls(spec, Component)` at module load —
|
|
32
|
+
the manager looks the component up by `specId` when expanding a row.
|
|
33
|
+
|
|
34
|
+
**Removed (no compat)**:
|
|
35
|
+
|
|
36
|
+
- `createNotificationSubscriptionExtension` (replaced by the
|
|
37
|
+
spec-driven manager + the SubControls registry)
|
|
38
|
+
- `target.slot` field on `NotificationTarget` and the
|
|
39
|
+
`NotificationTargetInput.slot` parameter on
|
|
40
|
+
`defineNotificationTarget`
|
|
41
|
+
- `SystemNotificationSubscriptionsSlot` and
|
|
42
|
+
`GroupNotificationSubscriptionsSlot` from `@checkstack/catalog-common`
|
|
43
|
+
- `SystemNotificationsCard` from the system detail page's main column
|
|
44
|
+
- `SubscribeButton` wiring on dashboard group cards and the system
|
|
45
|
+
detail page header
|
|
46
|
+
|
|
47
|
+
**Migrated frontends**: anomaly (now registers `AnomalyFieldMuteList`
|
|
48
|
+
via the SubControls registry), incident, maintenance — all dropped
|
|
49
|
+
their `createNotificationSubscriptionExtension` calls. healthcheck and
|
|
50
|
+
dependency now show up automatically via the spec registry — no
|
|
51
|
+
frontend changes needed for them to render.
|
|
52
|
+
|
|
53
|
+
The trigger button reflects aggregate state — filled bell when at
|
|
54
|
+
least one spec is subscribed for the resource, ghost bell when none.
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [32d52c6]
|
|
59
|
+
- Updated dependencies [32d52c6]
|
|
60
|
+
- Updated dependencies [32d52c6]
|
|
61
|
+
- Updated dependencies [32d52c6]
|
|
62
|
+
- Updated dependencies [32d52c6]
|
|
63
|
+
- Updated dependencies [32d52c6]
|
|
64
|
+
- Updated dependencies [32d52c6]
|
|
65
|
+
- @checkstack/anomaly-common@1.0.0
|
|
66
|
+
- @checkstack/notification-common@1.0.0
|
|
67
|
+
- @checkstack/notification-frontend@0.3.0
|
|
68
|
+
- @checkstack/catalog-common@2.0.0
|
|
69
|
+
- @checkstack/catalog-frontend@0.9.0
|
|
70
|
+
- @checkstack/incident-common@1.0.0
|
|
71
|
+
- @checkstack/maintenance-common@1.0.0
|
|
72
|
+
- @checkstack/healthcheck-common@1.0.0
|
|
73
|
+
- @checkstack/frontend-api@0.4.1
|
|
74
|
+
- @checkstack/auth-frontend@0.5.32
|
|
75
|
+
- @checkstack/ui@1.7.0
|
|
76
|
+
- @checkstack/command-frontend@0.2.33
|
|
77
|
+
- @checkstack/queue-frontend@0.3.2
|
|
78
|
+
|
|
79
|
+
## 0.5.1
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- 208ad71: Centralize realtime cache invalidation: signals now carry their owning `pluginId` end-to-end, and a single `SignalAutoInvalidator` mounted near the React Query client invalidates `[[pluginId]]` for every incoming signal automatically.
|
|
84
|
+
|
|
85
|
+
**Breaking change to `createSignal`** (`@checkstack/signal-common`): the factory now takes a single object argument with `pluginMetadata`, `event`, and `payloadSchema`. The signal id is constructed as `${pluginMetadata.pluginId}.${event}` and the resulting `Signal` carries a `pluginId` field. The `SignalMessage` wire envelope and `ServerToClientMessage` `signal` variant gained a `pluginId` field so the frontend can route invalidations without parsing the id.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// Before
|
|
89
|
+
export const ANOMALY_STATE_CHANGED = createSignal(
|
|
90
|
+
"anomaly.state_changed",
|
|
91
|
+
z.object({ ... }),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// After
|
|
95
|
+
export const ANOMALY_STATE_CHANGED = createSignal({
|
|
96
|
+
pluginMetadata,
|
|
97
|
+
event: "state_changed",
|
|
98
|
+
payloadSchema: z.object({ ... }),
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**New plugin field**: `FrontendPlugin.foreignSignals?: Signal<unknown>[]` lets a plugin opt its `[[pluginId]]` cache into invalidation when another plugin's signal fires (e.g. `dependency-frontend` declares `[SYSTEM_STATUS_CHANGED]` because dependency payloads embed system status). Same-plugin signals must NOT be listed — they are always auto-invalidated.
|
|
103
|
+
|
|
104
|
+
**Removed boilerplate**: per-component `useSignal(X, () => refetch())` and `useSignal(X, () => queryClient.invalidateQueries(...))` calls have been removed across `incident-frontend`, `maintenance-frontend`, `healthcheck-frontend`, `slo-frontend`, `dependency-frontend`, `satellite-frontend`, `announcement-frontend`, `notification-frontend`, and `dashboard-frontend`. The `NotificationBell` unread count is now derived directly from the `getUnreadCount` query (auto-invalidated) instead of a local state mirror.
|
|
105
|
+
|
|
106
|
+
**User-visible bug fix**: the system detail page anomaly widget (`SystemAnomalyWidget`) now updates in real-time when anomalies change, with no per-widget signal subscription required. The dashboard status page also stays fresh on `ANOMALY_STATE_CHANGED`, `ANOMALY_BASELINE_UPDATED`, and `ANOMALY_TREND_DETECTED`.
|
|
107
|
+
|
|
108
|
+
UI-state consumers that legitimately need a `useSignal` (the dashboard activity terminal, the queue lag alert, and the rolling-preset date refresh in `useHealthCheckData`) keep their handlers; the auto-invalidator runs alongside them.
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [208ad71]
|
|
111
|
+
- @checkstack/signal-frontend@0.1.0
|
|
112
|
+
- @checkstack/frontend-api@0.4.0
|
|
113
|
+
- @checkstack/anomaly-common@0.3.0
|
|
114
|
+
- @checkstack/healthcheck-common@0.13.0
|
|
115
|
+
- @checkstack/incident-common@0.5.0
|
|
116
|
+
- @checkstack/maintenance-common@0.5.0
|
|
117
|
+
- @checkstack/notification-common@0.3.0
|
|
118
|
+
- @checkstack/queue-frontend@0.3.1
|
|
119
|
+
- @checkstack/auth-frontend@0.5.31
|
|
120
|
+
- @checkstack/catalog-common@1.5.3
|
|
121
|
+
- @checkstack/catalog-frontend@0.8.7
|
|
122
|
+
- @checkstack/command-frontend@0.2.32
|
|
123
|
+
- @checkstack/ui@1.6.1
|
|
124
|
+
|
|
3
125
|
## 0.5.0
|
|
4
126
|
|
|
5
127
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/dashboard-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"checkstack": {
|
|
@@ -13,21 +13,22 @@
|
|
|
13
13
|
"lint:code": "eslint . --max-warnings 0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@checkstack/anomaly-common": "0.
|
|
17
|
-
"@checkstack/auth-frontend": "0.5.
|
|
18
|
-
"@checkstack/catalog-common": "1.5.
|
|
19
|
-
"@checkstack/catalog-frontend": "0.8.
|
|
20
|
-
"@checkstack/command-common": "0.2.
|
|
21
|
-
"@checkstack/command-frontend": "0.2.
|
|
22
|
-
"@checkstack/common": "0.
|
|
23
|
-
"@checkstack/frontend-api": "0.
|
|
24
|
-
"@checkstack/healthcheck-common": "0.
|
|
25
|
-
"@checkstack/incident-common": "0.
|
|
26
|
-
"@checkstack/maintenance-common": "0.
|
|
27
|
-
"@checkstack/notification-common": "0.
|
|
28
|
-
"@checkstack/
|
|
29
|
-
"@checkstack/
|
|
30
|
-
"@checkstack/
|
|
16
|
+
"@checkstack/anomaly-common": "0.3.0",
|
|
17
|
+
"@checkstack/auth-frontend": "0.5.31",
|
|
18
|
+
"@checkstack/catalog-common": "1.5.3",
|
|
19
|
+
"@checkstack/catalog-frontend": "0.8.7",
|
|
20
|
+
"@checkstack/command-common": "0.2.9",
|
|
21
|
+
"@checkstack/command-frontend": "0.2.32",
|
|
22
|
+
"@checkstack/common": "0.7.0",
|
|
23
|
+
"@checkstack/frontend-api": "0.4.0",
|
|
24
|
+
"@checkstack/healthcheck-common": "0.13.0",
|
|
25
|
+
"@checkstack/incident-common": "0.5.0",
|
|
26
|
+
"@checkstack/maintenance-common": "0.5.0",
|
|
27
|
+
"@checkstack/notification-common": "0.3.0",
|
|
28
|
+
"@checkstack/notification-frontend": "0.2.36",
|
|
29
|
+
"@checkstack/queue-frontend": "0.3.1",
|
|
30
|
+
"@checkstack/signal-frontend": "0.1.0",
|
|
31
|
+
"@checkstack/ui": "1.6.1",
|
|
31
32
|
"date-fns": "^4.1.0",
|
|
32
33
|
"lucide-react": "^0.344.0",
|
|
33
34
|
"react": "^18.2.0",
|
package/src/Dashboard.tsx
CHANGED
|
@@ -11,12 +11,10 @@ import {
|
|
|
11
11
|
SystemStateBadgesSlot,
|
|
12
12
|
System,
|
|
13
13
|
Group,
|
|
14
|
+
catalogGroupTarget,
|
|
14
15
|
} from "@checkstack/catalog-common";
|
|
15
16
|
import { resolveRoute } from "@checkstack/common";
|
|
16
|
-
import {
|
|
17
|
-
NotificationApi,
|
|
18
|
-
type EnrichedSubscription,
|
|
19
|
-
} from "@checkstack/notification-common";
|
|
17
|
+
import { NotificationSubscriptionsManager } from "@checkstack/notification-frontend";
|
|
20
18
|
import { IncidentApi } from "@checkstack/incident-common";
|
|
21
19
|
import { MaintenanceApi } from "@checkstack/maintenance-common";
|
|
22
20
|
import { AnomalyApi } from "@checkstack/anomaly-common";
|
|
@@ -31,8 +29,6 @@ import {
|
|
|
31
29
|
StatusCard,
|
|
32
30
|
EmptyState,
|
|
33
31
|
LoadingSpinner,
|
|
34
|
-
SubscribeButton,
|
|
35
|
-
useToast,
|
|
36
32
|
AnimatedCounter,
|
|
37
33
|
TerminalFeed,
|
|
38
34
|
type TerminalEntry,
|
|
@@ -56,15 +52,12 @@ import { IncidentOverviewSheet } from "./components/IncidentOverviewSheet";
|
|
|
56
52
|
import { MaintenanceOverviewSheet } from "./components/MaintenanceOverviewSheet";
|
|
57
53
|
import { AnomalyOverviewSheet } from "./components/AnomalyOverviewSheet";
|
|
58
54
|
|
|
59
|
-
const CATALOG_PLUGIN_ID = "catalog";
|
|
60
55
|
const MAX_TERMINAL_ENTRIES = 8;
|
|
61
56
|
|
|
62
57
|
interface GroupWithSystems extends Group {
|
|
63
58
|
systems: System[];
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
const getGroupId = (groupId: string) => `${CATALOG_PLUGIN_ID}.group.${groupId}`;
|
|
67
|
-
|
|
68
61
|
const statusToVariant = (
|
|
69
62
|
status: string,
|
|
70
63
|
): "default" | "success" | "warning" | "error" => {
|
|
@@ -87,24 +80,17 @@ const statusToVariant = (
|
|
|
87
80
|
export const Dashboard: React.FC = () => {
|
|
88
81
|
const { isLowPower } = usePerformance();
|
|
89
82
|
const catalogClient = usePluginClient(CatalogApi);
|
|
90
|
-
const notificationClient = usePluginClient(NotificationApi);
|
|
91
83
|
const incidentClient = usePluginClient(IncidentApi);
|
|
92
84
|
const maintenanceClient = usePluginClient(MaintenanceApi);
|
|
93
85
|
const anomalyClient = usePluginClient(AnomalyApi);
|
|
94
86
|
|
|
95
87
|
const navigate = useNavigate();
|
|
96
|
-
const toast = useToast();
|
|
97
88
|
const authApi = useApi(authApiRef);
|
|
98
89
|
const { data: session } = authApi.useSession();
|
|
99
90
|
|
|
100
91
|
// Terminal feed entries from real healthcheck signals
|
|
101
92
|
const [terminalEntries, setTerminalEntries] = useState<TerminalEntry[]>([]);
|
|
102
93
|
|
|
103
|
-
// Track per-group loading state for subscribe buttons
|
|
104
|
-
const [subscriptionLoading, setSubscriptionLoading] = useState<
|
|
105
|
-
Record<string, boolean>
|
|
106
|
-
>({});
|
|
107
|
-
|
|
108
94
|
const [isIncidentSheetOpen, setIncidentSheetOpen] = useState(false);
|
|
109
95
|
const [isMaintenanceSheetOpen, setMaintenanceSheetOpen] = useState(false);
|
|
110
96
|
const [isAnomalySheetOpen, setAnomalySheetOpen] = useState(false);
|
|
@@ -158,13 +144,6 @@ export const Dashboard: React.FC = () => {
|
|
|
158
144
|
{ staleTime: 30_000 },
|
|
159
145
|
);
|
|
160
146
|
|
|
161
|
-
// Fetch subscriptions (only when logged in)
|
|
162
|
-
const { data: subscriptions = [], refetch: refetchSubscriptions } =
|
|
163
|
-
notificationClient.getSubscriptions.useQuery(
|
|
164
|
-
{},
|
|
165
|
-
{ enabled: !!session, staleTime: 60_000 },
|
|
166
|
-
);
|
|
167
|
-
|
|
168
147
|
// Combined loading state
|
|
169
148
|
const loading =
|
|
170
149
|
entitiesLoading ||
|
|
@@ -172,30 +151,6 @@ export const Dashboard: React.FC = () => {
|
|
|
172
151
|
maintenancesLoading ||
|
|
173
152
|
anomaliesLoading;
|
|
174
153
|
|
|
175
|
-
// -------------------------------------------------------------------------
|
|
176
|
-
// MUTATIONS
|
|
177
|
-
// -------------------------------------------------------------------------
|
|
178
|
-
|
|
179
|
-
const subscribeMutation = notificationClient.subscribe.useMutation({
|
|
180
|
-
onSuccess: () => {
|
|
181
|
-
toast.success("Subscribed to group notifications");
|
|
182
|
-
void refetchSubscriptions();
|
|
183
|
-
},
|
|
184
|
-
onError: (error: Error) => {
|
|
185
|
-
toast.error(error.message || "Failed to subscribe");
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
const unsubscribeMutation = notificationClient.unsubscribe.useMutation({
|
|
190
|
-
onSuccess: () => {
|
|
191
|
-
toast.success("Unsubscribed from group notifications");
|
|
192
|
-
void refetchSubscriptions();
|
|
193
|
-
},
|
|
194
|
-
onError: (error: Error) => {
|
|
195
|
-
toast.error(error.message || "Failed to unsubscribe");
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
|
|
199
154
|
// -------------------------------------------------------------------------
|
|
200
155
|
// COMPUTED DATA
|
|
201
156
|
// -------------------------------------------------------------------------
|
|
@@ -248,39 +203,6 @@ export const Dashboard: React.FC = () => {
|
|
|
248
203
|
navigate(resolveRoute(catalogRoutes.routes.systemDetail, { systemId }));
|
|
249
204
|
};
|
|
250
205
|
|
|
251
|
-
const isSubscribed = (groupId: string) => {
|
|
252
|
-
const fullId = getGroupId(groupId);
|
|
253
|
-
return subscriptions.some(
|
|
254
|
-
(s: EnrichedSubscription) => s.groupId === fullId,
|
|
255
|
-
);
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const handleSubscribe = (groupId: string) => {
|
|
259
|
-
const fullId = getGroupId(groupId);
|
|
260
|
-
setSubscriptionLoading((prev) => ({ ...prev, [groupId]: true }));
|
|
261
|
-
subscribeMutation.mutate(
|
|
262
|
-
{ groupId: fullId },
|
|
263
|
-
{
|
|
264
|
-
onSettled: () => {
|
|
265
|
-
setSubscriptionLoading((prev) => ({ ...prev, [groupId]: false }));
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const handleUnsubscribe = (groupId: string) => {
|
|
272
|
-
const fullId = getGroupId(groupId);
|
|
273
|
-
setSubscriptionLoading((prev) => ({ ...prev, [groupId]: true }));
|
|
274
|
-
unsubscribeMutation.mutate(
|
|
275
|
-
{ groupId: fullId },
|
|
276
|
-
{
|
|
277
|
-
onSettled: () => {
|
|
278
|
-
setSubscriptionLoading((prev) => ({ ...prev, [groupId]: false }));
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
);
|
|
282
|
-
};
|
|
283
|
-
|
|
284
206
|
// -------------------------------------------------------------------------
|
|
285
207
|
// RENDER
|
|
286
208
|
// -------------------------------------------------------------------------
|
|
@@ -324,11 +246,12 @@ export const Dashboard: React.FC = () => {
|
|
|
324
246
|
{group.systems.length === 1 ? "system" : "systems"}
|
|
325
247
|
</span>
|
|
326
248
|
{session && (
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
249
|
+
<NotificationSubscriptionsManager
|
|
250
|
+
target={catalogGroupTarget}
|
|
251
|
+
resource={{
|
|
252
|
+
groupId: group.id,
|
|
253
|
+
groupName: group.name,
|
|
254
|
+
}}
|
|
332
255
|
/>
|
|
333
256
|
)}
|
|
334
257
|
</div>
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import React, { createContext, useContext, useCallback, useMemo } from "react";
|
|
2
|
-
import { usePluginClient
|
|
3
|
-
import { useSignal } from "@checkstack/signal-frontend";
|
|
2
|
+
import { usePluginClient } from "@checkstack/frontend-api";
|
|
4
3
|
import {
|
|
5
4
|
HealthCheckApi,
|
|
6
|
-
SYSTEM_STATUS_CHANGED,
|
|
7
5
|
type SystemHealthStatusResponse,
|
|
8
6
|
} from "@checkstack/healthcheck-common";
|
|
9
7
|
import {
|
|
10
8
|
IncidentApi,
|
|
11
|
-
INCIDENT_UPDATED,
|
|
12
9
|
type IncidentWithSystems,
|
|
13
10
|
} from "@checkstack/incident-common";
|
|
14
11
|
import {
|
|
15
12
|
MaintenanceApi,
|
|
16
|
-
MAINTENANCE_UPDATED,
|
|
17
13
|
type MaintenanceWithSystems,
|
|
18
14
|
} from "@checkstack/maintenance-common";
|
|
19
15
|
|
|
@@ -46,11 +42,14 @@ interface SystemBadgeDataProviderProps {
|
|
|
46
42
|
/**
|
|
47
43
|
* Provider that bulk-fetches badge data (health, incidents, maintenances)
|
|
48
44
|
* for multiple systems using TanStack Query and provides it via context.
|
|
45
|
+
*
|
|
46
|
+
* Realtime invalidation of `[["healthcheck"]]`, `[["incident"]]`, and
|
|
47
|
+
* `[["maintenance"]]` is handled centrally by SignalAutoInvalidator — no
|
|
48
|
+
* per-component signal handlers needed here.
|
|
49
49
|
*/
|
|
50
50
|
export const SystemBadgeDataProvider: React.FC<
|
|
51
51
|
SystemBadgeDataProviderProps
|
|
52
52
|
> = ({ systemIds, children }) => {
|
|
53
|
-
const queryClient = useQueryClient();
|
|
54
53
|
const healthCheckClient = usePluginClient(HealthCheckApi);
|
|
55
54
|
const incidentClient = usePluginClient(IncidentApi);
|
|
56
55
|
const maintenanceClient = usePluginClient(MaintenanceApi);
|
|
@@ -82,56 +81,6 @@ export const SystemBadgeDataProvider: React.FC<
|
|
|
82
81
|
|
|
83
82
|
const loading = healthLoading || incidentLoading || maintenanceLoading;
|
|
84
83
|
|
|
85
|
-
// -------------------------------------------------------------------------
|
|
86
|
-
// SIGNAL HANDLERS - Invalidate queries on updates
|
|
87
|
-
// -------------------------------------------------------------------------
|
|
88
|
-
|
|
89
|
-
const refetchHealth = useCallback(
|
|
90
|
-
(systemId: string) => {
|
|
91
|
-
if (systemIds.includes(systemId)) {
|
|
92
|
-
// Invalidate the bulk query to refetch
|
|
93
|
-
queryClient.invalidateQueries({ queryKey: [["healthcheck"]] });
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
[systemIds, queryClient]
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
useSignal(SYSTEM_STATUS_CHANGED, ({ systemId }) => {
|
|
100
|
-
refetchHealth(systemId);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const refetchIncidents = useCallback(
|
|
104
|
-
(affectedSystemIds: string[]) => {
|
|
105
|
-
const hasAffected = affectedSystemIds.some((id) =>
|
|
106
|
-
systemIds.includes(id)
|
|
107
|
-
);
|
|
108
|
-
if (hasAffected) {
|
|
109
|
-
queryClient.invalidateQueries({ queryKey: [["incident"]] });
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
[systemIds, queryClient]
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
useSignal(INCIDENT_UPDATED, ({ systemIds: affectedIds }) => {
|
|
116
|
-
refetchIncidents(affectedIds);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
const refetchMaintenances = useCallback(
|
|
120
|
-
(affectedSystemIds: string[]) => {
|
|
121
|
-
const hasAffected = affectedSystemIds.some((id) =>
|
|
122
|
-
systemIds.includes(id)
|
|
123
|
-
);
|
|
124
|
-
if (hasAffected) {
|
|
125
|
-
queryClient.invalidateQueries({ queryKey: [["maintenance"]] });
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
[systemIds, queryClient]
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
useSignal(MAINTENANCE_UPDATED, ({ systemIds: affectedIds }) => {
|
|
132
|
-
refetchMaintenances(affectedIds);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
84
|
// -------------------------------------------------------------------------
|
|
136
85
|
// CONTEXT VALUE
|
|
137
86
|
// -------------------------------------------------------------------------
|