@checkstack/catalog-frontend 0.8.6 → 0.9.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 +196 -0
- package/package.json +10 -9
- package/src/components/SystemDetailPage.tsx +6 -74
- package/src/index.tsx +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,201 @@
|
|
|
1
1
|
# @checkstack/catalog-frontend
|
|
2
2
|
|
|
3
|
+
## 0.9.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
|
+
- 32d52c6: feat: notification target pattern + per-spec subscriptions
|
|
57
|
+
|
|
58
|
+
Replaces the all-or-nothing catalog system/group notification model with a
|
|
59
|
+
platform-level target pattern. Each notification-emitting plugin declares
|
|
60
|
+
_subscription specs_ against typed _target_ objects exported from the
|
|
61
|
+
target's owning plugin (catalog ships `catalogSystemTarget` and
|
|
62
|
+
`catalogGroupTarget`). Notification-backend handles every per-resource
|
|
63
|
+
group lifecycle, parent-edge inheritance, and legacy-subscription seeding
|
|
64
|
+
— plugins never author groupId helpers, lifecycle hooks, or migration
|
|
65
|
+
code again.
|
|
66
|
+
|
|
67
|
+
**Plugin-author surface area is now ~12 lines per emitter:**
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
// <plugin>-common
|
|
71
|
+
const { defineSubscription } = createSubscriptionFactory(pluginMetadata);
|
|
72
|
+
export const fooSystemSubscription = defineSubscription({
|
|
73
|
+
localId: "system",
|
|
74
|
+
target: catalogSystemTarget,
|
|
75
|
+
display: { title: "Foo Alerts", description: "...", iconName: "Bell" },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// <plugin>-backend register()
|
|
79
|
+
env.registerSubscriptionSpecs([fooSystemSubscription]);
|
|
80
|
+
// ^ feeds the plugin loader's dependency sorter — each spec's
|
|
81
|
+
// target.ownerPlugin becomes an implicit init-order dep, so this
|
|
82
|
+
// plugin automatically waits for catalog (the target owner) to
|
|
83
|
+
// finish init + afterPluginsReady before its own runs.
|
|
84
|
+
|
|
85
|
+
// <plugin>-backend afterPluginsReady
|
|
86
|
+
await notificationClient.registerSubscriptionSpec(
|
|
87
|
+
specToRegistration(fooSystemSubscription)
|
|
88
|
+
);
|
|
89
|
+
// dispatch
|
|
90
|
+
await notificationClient.notifyForSubscription({
|
|
91
|
+
specId: fooSystemSubscription.specId,
|
|
92
|
+
resourceKeys: [systemId],
|
|
93
|
+
title,
|
|
94
|
+
body,
|
|
95
|
+
importance,
|
|
96
|
+
action,
|
|
97
|
+
collapseKey,
|
|
98
|
+
subjects,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// <plugin>-frontend
|
|
102
|
+
createNotificationSubscriptionExtension({ spec: fooSystemSubscription });
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Migrated plugins**: anomaly, incident, maintenance, healthcheck,
|
|
106
|
+
dependency. Each lost its bespoke `notification-groups.ts`,
|
|
107
|
+
`bootstrap*NotificationGroups`, `ensure*Group`, and inheritance walk —
|
|
108
|
+
all of that is now centralized in notification-backend's
|
|
109
|
+
`subscription-engine`.
|
|
110
|
+
|
|
111
|
+
**Plugin loader change** (`@checkstack/backend-api`,
|
|
112
|
+
`@checkstack/backend`): the register-time API gains
|
|
113
|
+
`env.registerSubscriptionSpecs([...specs])`. The dependency sorter
|
|
114
|
+
walks `spec.target.ownerPlugin` for every declared spec and adds the
|
|
115
|
+
target owner as an init-order dependency of the emitting plugin. This
|
|
116
|
+
guarantees that catalog (the owner of the platform's `system` and
|
|
117
|
+
`group` targets) completes init + afterPluginsReady before any
|
|
118
|
+
emitting plugin tries to register its specs against the notification
|
|
119
|
+
service — no string-prefix heuristics, no manual `dependsOnPlugins`
|
|
120
|
+
list, no stub rows. Plugins that fail to declare their specs at
|
|
121
|
+
register time get a clear `Target type X is not registered. Did the
|
|
122
|
+
emitting plugin declare this spec via env.registerSubscriptionSpecs?`
|
|
123
|
+
error from the dispatcher.
|
|
124
|
+
|
|
125
|
+
**Removed** (no backwards compat):
|
|
126
|
+
|
|
127
|
+
- `catalogClient.notifySystemSubscribers` and
|
|
128
|
+
`catalogClient.notifyManySystemSubscribers`
|
|
129
|
+
- `notificationClient.notifyUsers` and `notificationClient.notifyGroups`
|
|
130
|
+
as direct dispatch primitives — replaced by spec-bound
|
|
131
|
+
`notifyForSubscription`
|
|
132
|
+
- catalog's `bootstrapNotificationGroups` (replaced by
|
|
133
|
+
`bootstrapNotificationTargets`)
|
|
134
|
+
|
|
135
|
+
**Enforcement**: the dispatcher rejects calls referencing unregistered
|
|
136
|
+
specIds, specs owned by other plugins, or resourceKeys that haven't been
|
|
137
|
+
pushed via `upsertNotificationResource`. Display metadata for any
|
|
138
|
+
groupId is recoverable via the spec registry, so audit lists render
|
|
139
|
+
correct labels even when an emitter's frontend isn't loaded.
|
|
140
|
+
|
|
141
|
+
**Per-field anomaly mute** keeps working — it now lives inside the
|
|
142
|
+
generic SubscriptionRow's optional `SubControls` panel
|
|
143
|
+
(`AnomalyFieldMuteList`), exposed through the catalog system detail
|
|
144
|
+
page's notifications card.
|
|
145
|
+
|
|
146
|
+
The catalog system detail page renders a "Notifications" card hosting
|
|
147
|
+
`SystemNotificationSubscriptionsSlot`. The matching group surface is
|
|
148
|
+
not yet rendered — group-level subscriptions are wired end-to-end on
|
|
149
|
+
the backend; a follow-up will add the host UI.
|
|
150
|
+
|
|
151
|
+
**Migration of existing subscribers**: target types declare a
|
|
152
|
+
`legacyGroupIdTemplate`; on first registration of each spec,
|
|
153
|
+
notification-backend reads subscribers from the legacy
|
|
154
|
+
`catalog.system.<id>` / `catalog.group.<id>` groups and seeds the new
|
|
155
|
+
spec groups exactly once per (spec × resource) pair, tracked in
|
|
156
|
+
`subscription_migrations`. Anomaly stays opt-in (its target also
|
|
157
|
+
declares the template, but the user-explicit nature of the original
|
|
158
|
+
opt-in flow means the seeding produces the same set of subscribers
|
|
159
|
+
they already had).
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- 32d52c6: Bulk notifications affecting multiple systems and collapse lifecycle events into a single card.
|
|
164
|
+
|
|
165
|
+
Notifications now carry an optional `subjects` array (the entities they affect) and an optional `collapseKey` (so related notifications collapse into one row per recipient). Incidents, maintenances, anomalies, healthchecks, and dependency-impact events route through these new fields, so an incident affecting three systems produces one in-app notification + one external send per subscriber instead of three. Lifecycle updates for the same entity (created → updated → resolved) also collapse, with an expandable "+N updates" timeline.
|
|
166
|
+
|
|
167
|
+
Subject kinds are namespaced as `<pluginId>.<localKind>` and built via type-safe helpers exported from each domain's common package (`createSystemSubject`, `incidentCollapseKey`, etc.). The frontend kind registry (`registerSubjectKind`) lets plugins bind icon + label for their kinds; unknown kinds fall back to a generic chip.
|
|
168
|
+
|
|
169
|
+
All notification strategies (SMTP, Slack, Discord, Teams, Telegram, Pushover, Gotify, Webex, Backstage) render the affected subjects natively in their format (HTML cards, Slack blocks, Discord embed fields, adaptive cards, markdown lists, etc.).
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [32d52c6]
|
|
172
|
+
- Updated dependencies [32d52c6]
|
|
173
|
+
- Updated dependencies [32d52c6]
|
|
174
|
+
- Updated dependencies [32d52c6]
|
|
175
|
+
- Updated dependencies [32d52c6]
|
|
176
|
+
- Updated dependencies [32d52c6]
|
|
177
|
+
- Updated dependencies [32d52c6]
|
|
178
|
+
- @checkstack/notification-common@1.0.0
|
|
179
|
+
- @checkstack/notification-frontend@0.3.0
|
|
180
|
+
- @checkstack/catalog-common@2.0.0
|
|
181
|
+
- @checkstack/frontend-api@0.4.1
|
|
182
|
+
- @checkstack/auth-common@0.6.4
|
|
183
|
+
- @checkstack/auth-frontend@0.5.32
|
|
184
|
+
- @checkstack/ui@1.7.0
|
|
185
|
+
- @checkstack/gitops-frontend@0.3.7
|
|
186
|
+
|
|
187
|
+
## 0.8.7
|
|
188
|
+
|
|
189
|
+
### Patch Changes
|
|
190
|
+
|
|
191
|
+
- Updated dependencies [208ad71]
|
|
192
|
+
- @checkstack/frontend-api@0.4.0
|
|
193
|
+
- @checkstack/notification-common@0.3.0
|
|
194
|
+
- @checkstack/auth-frontend@0.5.31
|
|
195
|
+
- @checkstack/catalog-common@1.5.3
|
|
196
|
+
- @checkstack/gitops-frontend@0.3.6
|
|
197
|
+
- @checkstack/ui@1.6.1
|
|
198
|
+
|
|
3
199
|
## 0.8.6
|
|
4
200
|
|
|
5
201
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/catalog-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"checkstack": {
|
|
@@ -12,14 +12,15 @@
|
|
|
12
12
|
"lint:code": "eslint . --max-warnings 0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@checkstack/auth-common": "0.6.
|
|
16
|
-
"@checkstack/auth-frontend": "0.5.
|
|
17
|
-
"@checkstack/catalog-common": "1.5.
|
|
18
|
-
"@checkstack/common": "0.
|
|
19
|
-
"@checkstack/frontend-api": "0.
|
|
20
|
-
"@checkstack/gitops-frontend": "0.3.
|
|
21
|
-
"@checkstack/notification-common": "0.
|
|
22
|
-
"@checkstack/
|
|
15
|
+
"@checkstack/auth-common": "0.6.3",
|
|
16
|
+
"@checkstack/auth-frontend": "0.5.31",
|
|
17
|
+
"@checkstack/catalog-common": "1.5.3",
|
|
18
|
+
"@checkstack/common": "0.7.0",
|
|
19
|
+
"@checkstack/frontend-api": "0.4.0",
|
|
20
|
+
"@checkstack/gitops-frontend": "0.3.6",
|
|
21
|
+
"@checkstack/notification-common": "0.3.0",
|
|
22
|
+
"@checkstack/notification-frontend": "0.2.36",
|
|
23
|
+
"@checkstack/ui": "1.6.1",
|
|
23
24
|
"@dnd-kit/core": "^6.3.1",
|
|
24
25
|
"@dnd-kit/utilities": "^3.2.2",
|
|
25
26
|
"lucide-react": "^0.344.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { useParams } from "react-router-dom";
|
|
3
3
|
import {
|
|
4
4
|
usePluginClient,
|
|
@@ -10,46 +10,31 @@ import {
|
|
|
10
10
|
SystemDetailsSlot,
|
|
11
11
|
SystemDetailsTopSlot,
|
|
12
12
|
SystemStateBadgesSlot,
|
|
13
|
+
catalogSystemTarget,
|
|
13
14
|
} from "@checkstack/catalog-common";
|
|
14
|
-
import {
|
|
15
|
+
import { NotificationSubscriptionsManager } from "@checkstack/notification-frontend";
|
|
15
16
|
import {
|
|
16
17
|
Card,
|
|
17
18
|
CardContent,
|
|
18
19
|
Page,
|
|
19
20
|
PageContent,
|
|
20
21
|
PageLayout,
|
|
21
|
-
SubscribeButton,
|
|
22
|
-
useToast,
|
|
23
22
|
LoadingSpinner,
|
|
24
23
|
AccessDenied,
|
|
25
24
|
} from "@checkstack/ui";
|
|
26
25
|
import { authApiRef } from "@checkstack/auth-frontend/api";
|
|
27
26
|
|
|
28
27
|
import { Activity, Calendar, Mail, User } from "lucide-react";
|
|
29
|
-
import { extractErrorMessage } from "@checkstack/common";
|
|
30
|
-
|
|
31
|
-
const CATALOG_PLUGIN_ID = "catalog";
|
|
32
28
|
|
|
33
29
|
export const SystemDetailPage: React.FC = () => {
|
|
34
30
|
const { systemId } = useParams<{ systemId: string }>();
|
|
35
31
|
const catalogClient = usePluginClient(CatalogApi);
|
|
36
|
-
const notificationClient = usePluginClient(NotificationApi);
|
|
37
|
-
const toast = useToast();
|
|
38
32
|
const authApi = useApi(authApiRef);
|
|
39
33
|
const { data: session } = authApi.useSession();
|
|
40
34
|
|
|
41
35
|
const [groups, setGroups] = useState<Group[]>([]);
|
|
42
36
|
const [notFound, setNotFound] = useState(false);
|
|
43
37
|
|
|
44
|
-
// Subscription state
|
|
45
|
-
const [isSubscribed, setIsSubscribed] = useState(false);
|
|
46
|
-
const [subscriptionLoading, setSubscriptionLoading] = useState(true);
|
|
47
|
-
|
|
48
|
-
// Construct the full group ID for this system
|
|
49
|
-
const getSystemGroupId = useCallback(() => {
|
|
50
|
-
return `${CATALOG_PLUGIN_ID}.system.${systemId}`;
|
|
51
|
-
}, [systemId]);
|
|
52
|
-
|
|
53
38
|
// Fetch system data with useQuery
|
|
54
39
|
const { data: systemsData, isLoading: systemsLoading } =
|
|
55
40
|
catalogClient.getSystems.useQuery({});
|
|
@@ -68,33 +53,6 @@ export const SystemDetailPage: React.FC = () => {
|
|
|
68
53
|
const system = systemsData?.systems.find((s) => s.id === systemId);
|
|
69
54
|
const loading = systemsLoading || groupsLoading;
|
|
70
55
|
|
|
71
|
-
// Fetch subscriptions with useQuery
|
|
72
|
-
const { data: subscriptions, refetch: refetchSubscriptions } =
|
|
73
|
-
notificationClient.getSubscriptions.useQuery({});
|
|
74
|
-
|
|
75
|
-
// Subscribe/unsubscribe mutations
|
|
76
|
-
const subscribeMutation = notificationClient.subscribe.useMutation({
|
|
77
|
-
onSuccess: () => {
|
|
78
|
-
setIsSubscribed(true);
|
|
79
|
-
toast.success("Subscribed to system notifications");
|
|
80
|
-
void refetchSubscriptions();
|
|
81
|
-
},
|
|
82
|
-
onError: (error) => {
|
|
83
|
-
toast.error(extractErrorMessage(error, "Failed to subscribe"));
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const unsubscribeMutation = notificationClient.unsubscribe.useMutation({
|
|
88
|
-
onSuccess: () => {
|
|
89
|
-
setIsSubscribed(false);
|
|
90
|
-
toast.success("Unsubscribed from system notifications");
|
|
91
|
-
void refetchSubscriptions();
|
|
92
|
-
},
|
|
93
|
-
onError: (error) => {
|
|
94
|
-
toast.error(extractErrorMessage(error, "Failed to unsubscribe"));
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
56
|
// Update not found state
|
|
99
57
|
useEffect(() => {
|
|
100
58
|
if (!systemsLoading && !system && systemId) {
|
|
@@ -112,26 +70,6 @@ export const SystemDetailPage: React.FC = () => {
|
|
|
112
70
|
}
|
|
113
71
|
}, [groupsData, systemId]);
|
|
114
72
|
|
|
115
|
-
// Update subscription status from query
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (subscriptions && systemId) {
|
|
118
|
-
const groupId = getSystemGroupId();
|
|
119
|
-
const hasSubscription = subscriptions.some((s) => s.groupId === groupId);
|
|
120
|
-
setIsSubscribed(hasSubscription);
|
|
121
|
-
setSubscriptionLoading(false);
|
|
122
|
-
}
|
|
123
|
-
}, [subscriptions, systemId, getSystemGroupId]);
|
|
124
|
-
|
|
125
|
-
const handleSubscribe = () => {
|
|
126
|
-
setSubscriptionLoading(true);
|
|
127
|
-
subscribeMutation.mutate({ groupId: getSystemGroupId() });
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const handleUnsubscribe = () => {
|
|
131
|
-
setSubscriptionLoading(true);
|
|
132
|
-
unsubscribeMutation.mutate({ groupId: getSystemGroupId() });
|
|
133
|
-
};
|
|
134
|
-
|
|
135
73
|
if (loading) {
|
|
136
74
|
return (
|
|
137
75
|
<Page>
|
|
@@ -165,15 +103,9 @@ export const SystemDetailPage: React.FC = () => {
|
|
|
165
103
|
<div className="flex items-center gap-2">
|
|
166
104
|
<ExtensionSlot slot={SystemStateBadgesSlot} context={{ system }} />
|
|
167
105
|
{session && (
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
onUnsubscribe={handleUnsubscribe}
|
|
172
|
-
loading={
|
|
173
|
-
subscriptionLoading ||
|
|
174
|
-
subscribeMutation.isPending ||
|
|
175
|
-
unsubscribeMutation.isPending
|
|
176
|
-
}
|
|
106
|
+
<NotificationSubscriptionsManager
|
|
107
|
+
target={catalogSystemTarget}
|
|
108
|
+
resource={{ systemId: system.id, systemName: system.name }}
|
|
177
109
|
/>
|
|
178
110
|
)}
|
|
179
111
|
</div>
|
package/src/index.tsx
CHANGED
|
@@ -9,11 +9,26 @@ import {
|
|
|
9
9
|
catalogAccess,
|
|
10
10
|
} from "@checkstack/catalog-common";
|
|
11
11
|
|
|
12
|
+
import { Server, FolderTree } from "lucide-react";
|
|
13
|
+
import { registerSubjectKind } from "@checkstack/notification-frontend";
|
|
14
|
+
|
|
12
15
|
import { CatalogPage } from "./components/CatalogPage";
|
|
13
16
|
import { CatalogConfigPage } from "./components/CatalogConfigPage";
|
|
14
17
|
import { CatalogUserMenuItems } from "./components/UserMenuItems";
|
|
15
18
|
import { SystemDetailPage } from "./components/SystemDetailPage";
|
|
16
19
|
|
|
20
|
+
// Notification subject kinds emitted by catalog (see catalog-common's
|
|
21
|
+
// `createSystemSubject` / `createGroupSubject`). Registered at module load
|
|
22
|
+
// so the notification bell + page render kind-appropriate icons.
|
|
23
|
+
registerSubjectKind(`${pluginMetadata.pluginId}.system`, {
|
|
24
|
+
label: "System",
|
|
25
|
+
icon: Server,
|
|
26
|
+
});
|
|
27
|
+
registerSubjectKind(`${pluginMetadata.pluginId}.group`, {
|
|
28
|
+
label: "Group",
|
|
29
|
+
icon: FolderTree,
|
|
30
|
+
});
|
|
31
|
+
|
|
17
32
|
export const catalogPlugin = createFrontendPlugin({
|
|
18
33
|
metadata: pluginMetadata,
|
|
19
34
|
// No APIs needed - components use usePluginClient() directly
|