@checkstack/dashboard-frontend 0.5.1 → 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 CHANGED
@@ -1,5 +1,81 @@
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
+
3
79
  ## 0.5.1
4
80
 
5
81
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/dashboard-frontend",
3
- "version": "0.5.1",
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.2.0",
17
- "@checkstack/auth-frontend": "0.5.30",
18
- "@checkstack/catalog-common": "1.5.2",
19
- "@checkstack/catalog-frontend": "0.8.6",
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
20
  "@checkstack/command-common": "0.2.9",
21
- "@checkstack/command-frontend": "0.2.31",
21
+ "@checkstack/command-frontend": "0.2.32",
22
22
  "@checkstack/common": "0.7.0",
23
- "@checkstack/frontend-api": "0.3.11",
24
- "@checkstack/healthcheck-common": "0.12.0",
25
- "@checkstack/incident-common": "0.4.9",
26
- "@checkstack/maintenance-common": "0.4.11",
27
- "@checkstack/notification-common": "0.2.9",
28
- "@checkstack/queue-frontend": "0.3.0",
29
- "@checkstack/signal-frontend": "0.0.16",
30
- "@checkstack/ui": "1.6.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
- <SubscribeButton
328
- isSubscribed={isSubscribed(group.id)}
329
- onSubscribe={() => handleSubscribe(group.id)}
330
- onUnsubscribe={() => handleUnsubscribe(group.id)}
331
- loading={subscriptionLoading[group.id] || false}
249
+ <NotificationSubscriptionsManager
250
+ target={catalogGroupTarget}
251
+ resource={{
252
+ groupId: group.id,
253
+ groupName: group.name,
254
+ }}
332
255
  />
333
256
  )}
334
257
  </div>