@checkstack/dashboard-frontend 0.4.6 → 0.5.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 +49 -0
- package/package.json +12 -10
- package/src/Dashboard.tsx +49 -2
- package/src/components/AnomalyOverviewSheet.tsx +98 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @checkstack/dashboard-frontend
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8d1ef12: ## Anomaly Detection & UI Improvements
|
|
8
|
+
|
|
9
|
+
### Anomaly Detection Enhancements (Phase 2)
|
|
10
|
+
|
|
11
|
+
- **`@checkstack/anomaly-backend`**: Implemented background baseline analyzer jobs and anomaly trend deviation detection mechanics.
|
|
12
|
+
- **`@checkstack/anomaly-common`**: Added new baseline statistical logic and inference rules.
|
|
13
|
+
- **`@checkstack/anomaly-frontend`**: Added new Anomaly Widget and refactored system detail rendering to be more human-readable.
|
|
14
|
+
- **`@checkstack/dashboard-frontend`**: Refined the global anomaly widget and fixed hardcoded access gating to render appropriately.
|
|
15
|
+
- **`@checkstack/healthcheck-backend`**: Connected executor telemetry to the anomaly pipeline.
|
|
16
|
+
- **`@checkstack/healthcheck-frontend`**: Reconciled baseline display consistency in Drawer and charts.
|
|
17
|
+
|
|
18
|
+
### Notification Identifiers
|
|
19
|
+
|
|
20
|
+
- **`@checkstack/incident-backend`**: Resolved system IDs to human-readable System Names within Incident notifications to eliminate ID-only alert content.
|
|
21
|
+
- **`@checkstack/maintenance-backend`**: Adopted the same resolution strategy for Maintenance notifications to keep parity.
|
|
22
|
+
|
|
23
|
+
### UI Experience
|
|
24
|
+
|
|
25
|
+
- **`@checkstack/incident-frontend`**: Fixed the "Back to X" BackLink to properly use `react-router` hook `useNavigate` instead of doing a full application reload.
|
|
26
|
+
- **`@checkstack/healthcheck-frontend`**: Implemented `useNavigate` for seamless SPA back-linking.
|
|
27
|
+
- **`@checkstack/integration-frontend`**: Updated connections and delivery logs links to navigate without hard reloads.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [8d1ef12]
|
|
32
|
+
- Updated dependencies [8d1ef12]
|
|
33
|
+
- Updated dependencies [8d1ef12]
|
|
34
|
+
- Updated dependencies [8d1ef12]
|
|
35
|
+
- Updated dependencies [8d1ef12]
|
|
36
|
+
- @checkstack/healthcheck-common@0.12.0
|
|
37
|
+
- @checkstack/anomaly-common@0.2.0
|
|
38
|
+
- @checkstack/common@0.7.0
|
|
39
|
+
- @checkstack/queue-frontend@0.3.0
|
|
40
|
+
- @checkstack/ui@1.6.0
|
|
41
|
+
- @checkstack/auth-frontend@0.5.30
|
|
42
|
+
- @checkstack/catalog-common@1.5.2
|
|
43
|
+
- @checkstack/catalog-frontend@0.8.6
|
|
44
|
+
- @checkstack/command-common@0.2.9
|
|
45
|
+
- @checkstack/command-frontend@0.2.31
|
|
46
|
+
- @checkstack/frontend-api@0.3.11
|
|
47
|
+
- @checkstack/incident-common@0.4.9
|
|
48
|
+
- @checkstack/maintenance-common@0.4.11
|
|
49
|
+
- @checkstack/notification-common@0.2.9
|
|
50
|
+
- @checkstack/signal-frontend@0.0.16
|
|
51
|
+
|
|
3
52
|
## 0.4.6
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/dashboard-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"checkstack": {
|
|
@@ -13,20 +13,22 @@
|
|
|
13
13
|
"lint:code": "eslint . --max-warnings 0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@checkstack/
|
|
17
|
-
"@checkstack/
|
|
18
|
-
"@checkstack/catalog-
|
|
16
|
+
"@checkstack/anomaly-common": "0.1.0",
|
|
17
|
+
"@checkstack/auth-frontend": "0.5.29",
|
|
18
|
+
"@checkstack/catalog-common": "1.5.1",
|
|
19
|
+
"@checkstack/catalog-frontend": "0.8.5",
|
|
19
20
|
"@checkstack/command-common": "0.2.8",
|
|
20
|
-
"@checkstack/command-frontend": "0.2.
|
|
21
|
+
"@checkstack/command-frontend": "0.2.30",
|
|
21
22
|
"@checkstack/common": "0.6.5",
|
|
22
|
-
"@checkstack/frontend-api": "0.3.
|
|
23
|
+
"@checkstack/frontend-api": "0.3.10",
|
|
23
24
|
"@checkstack/healthcheck-common": "0.11.0",
|
|
24
|
-
"@checkstack/incident-common": "0.4.
|
|
25
|
-
"@checkstack/maintenance-common": "0.4.
|
|
25
|
+
"@checkstack/incident-common": "0.4.8",
|
|
26
|
+
"@checkstack/maintenance-common": "0.4.10",
|
|
26
27
|
"@checkstack/notification-common": "0.2.8",
|
|
27
|
-
"@checkstack/queue-frontend": "0.2.
|
|
28
|
+
"@checkstack/queue-frontend": "0.2.31",
|
|
28
29
|
"@checkstack/signal-frontend": "0.0.15",
|
|
29
|
-
"@checkstack/ui": "1.5.
|
|
30
|
+
"@checkstack/ui": "1.5.1",
|
|
31
|
+
"date-fns": "^4.1.0",
|
|
30
32
|
"lucide-react": "^0.344.0",
|
|
31
33
|
"react": "^18.2.0",
|
|
32
34
|
"react-router-dom": "^6.22.0"
|
package/src/Dashboard.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "@checkstack/notification-common";
|
|
20
20
|
import { IncidentApi } from "@checkstack/incident-common";
|
|
21
21
|
import { MaintenanceApi } from "@checkstack/maintenance-common";
|
|
22
|
+
import { AnomalyApi } from "@checkstack/anomaly-common";
|
|
22
23
|
import { HEALTH_CHECK_RUN_COMPLETED } from "@checkstack/healthcheck-common";
|
|
23
24
|
import { useSignal } from "@checkstack/signal-frontend";
|
|
24
25
|
import {
|
|
@@ -46,12 +47,14 @@ import {
|
|
|
46
47
|
AlertTriangle,
|
|
47
48
|
Wrench,
|
|
48
49
|
Terminal,
|
|
50
|
+
ActivitySquare,
|
|
49
51
|
} from "lucide-react";
|
|
50
52
|
import { authApiRef } from "@checkstack/auth-frontend/api";
|
|
51
53
|
import { QueueLagAlert } from "@checkstack/queue-frontend";
|
|
52
54
|
import { SystemBadgeDataProvider } from "./components/SystemBadgeDataProvider";
|
|
53
55
|
import { IncidentOverviewSheet } from "./components/IncidentOverviewSheet";
|
|
54
56
|
import { MaintenanceOverviewSheet } from "./components/MaintenanceOverviewSheet";
|
|
57
|
+
import { AnomalyOverviewSheet } from "./components/AnomalyOverviewSheet";
|
|
55
58
|
|
|
56
59
|
const CATALOG_PLUGIN_ID = "catalog";
|
|
57
60
|
const MAX_TERMINAL_ENTRIES = 8;
|
|
@@ -87,6 +90,7 @@ export const Dashboard: React.FC = () => {
|
|
|
87
90
|
const notificationClient = usePluginClient(NotificationApi);
|
|
88
91
|
const incidentClient = usePluginClient(IncidentApi);
|
|
89
92
|
const maintenanceClient = usePluginClient(MaintenanceApi);
|
|
93
|
+
const anomalyClient = usePluginClient(AnomalyApi);
|
|
90
94
|
|
|
91
95
|
const navigate = useNavigate();
|
|
92
96
|
const toast = useToast();
|
|
@@ -103,6 +107,7 @@ export const Dashboard: React.FC = () => {
|
|
|
103
107
|
|
|
104
108
|
const [isIncidentSheetOpen, setIncidentSheetOpen] = useState(false);
|
|
105
109
|
const [isMaintenanceSheetOpen, setMaintenanceSheetOpen] = useState(false);
|
|
110
|
+
const [isAnomalySheetOpen, setAnomalySheetOpen] = useState(false);
|
|
106
111
|
|
|
107
112
|
// -------------------------------------------------------------------------
|
|
108
113
|
// DATA QUERIES
|
|
@@ -146,6 +151,13 @@ export const Dashboard: React.FC = () => {
|
|
|
146
151
|
|
|
147
152
|
const maintenancesLoading = inProgressLoading || scheduledLoading;
|
|
148
153
|
|
|
154
|
+
// Fetch active anomalies
|
|
155
|
+
const { data: anomalies = [], isLoading: anomaliesLoading } =
|
|
156
|
+
anomalyClient.getAnomalies.useQuery(
|
|
157
|
+
{ limit: 100, state: "anomaly" },
|
|
158
|
+
{ staleTime: 30_000 },
|
|
159
|
+
);
|
|
160
|
+
|
|
149
161
|
// Fetch subscriptions (only when logged in)
|
|
150
162
|
const { data: subscriptions = [], refetch: refetchSubscriptions } =
|
|
151
163
|
notificationClient.getSubscriptions.useQuery(
|
|
@@ -154,7 +166,11 @@ export const Dashboard: React.FC = () => {
|
|
|
154
166
|
);
|
|
155
167
|
|
|
156
168
|
// Combined loading state
|
|
157
|
-
const loading =
|
|
169
|
+
const loading =
|
|
170
|
+
entitiesLoading ||
|
|
171
|
+
incidentsLoading ||
|
|
172
|
+
maintenancesLoading ||
|
|
173
|
+
anomaliesLoading;
|
|
158
174
|
|
|
159
175
|
// -------------------------------------------------------------------------
|
|
160
176
|
// MUTATIONS
|
|
@@ -188,6 +204,7 @@ export const Dashboard: React.FC = () => {
|
|
|
188
204
|
const systemsCount = systems.length;
|
|
189
205
|
const activeIncidentsCount = incidents.length;
|
|
190
206
|
const activeMaintenancesCount = maintenances.length;
|
|
207
|
+
const activeAnomaliesCount = anomalies.length;
|
|
191
208
|
|
|
192
209
|
// Map groups to include their systems
|
|
193
210
|
const groupsWithSystems = useMemo<GroupWithSystems[]>(() => {
|
|
@@ -373,7 +390,7 @@ export const Dashboard: React.FC = () => {
|
|
|
373
390
|
title="Overview"
|
|
374
391
|
icon={<Activity className="w-5 h-5" />}
|
|
375
392
|
/>
|
|
376
|
-
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-
|
|
393
|
+
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-4">
|
|
377
394
|
<StatusCard
|
|
378
395
|
title="Total Systems"
|
|
379
396
|
value={loading ? "..." : <AnimatedCounter value={systemsCount} />}
|
|
@@ -436,6 +453,30 @@ export const Dashboard: React.FC = () => {
|
|
|
436
453
|
: ""
|
|
437
454
|
}
|
|
438
455
|
/>
|
|
456
|
+
|
|
457
|
+
<StatusCard
|
|
458
|
+
variant={activeAnomaliesCount > 0 ? "gradient" : "default"}
|
|
459
|
+
title="Active Anomalies"
|
|
460
|
+
value={
|
|
461
|
+
loading ? (
|
|
462
|
+
"..."
|
|
463
|
+
) : (
|
|
464
|
+
<AnimatedCounter value={activeAnomaliesCount} />
|
|
465
|
+
)
|
|
466
|
+
}
|
|
467
|
+
description="Unusual behavior detected"
|
|
468
|
+
icon={<ActivitySquare className="w-4 h-4" />}
|
|
469
|
+
onClick={
|
|
470
|
+
activeAnomaliesCount > 0
|
|
471
|
+
? () => setAnomalySheetOpen(true)
|
|
472
|
+
: undefined
|
|
473
|
+
}
|
|
474
|
+
className={
|
|
475
|
+
activeAnomaliesCount > 0
|
|
476
|
+
? "cursor-pointer hover:opacity-90 hover:scale-[1.02] bg-gradient-to-br from-warning/20 to-warning/5 border-warning/30"
|
|
477
|
+
: ""
|
|
478
|
+
}
|
|
479
|
+
/>
|
|
439
480
|
</div>
|
|
440
481
|
</section>
|
|
441
482
|
|
|
@@ -478,6 +519,12 @@ export const Dashboard: React.FC = () => {
|
|
|
478
519
|
maintenances={maintenances}
|
|
479
520
|
systems={systems}
|
|
480
521
|
/>
|
|
522
|
+
<AnomalyOverviewSheet
|
|
523
|
+
open={isAnomalySheetOpen}
|
|
524
|
+
onOpenChange={setAnomalySheetOpen}
|
|
525
|
+
anomalies={anomalies}
|
|
526
|
+
systems={systems}
|
|
527
|
+
/>
|
|
481
528
|
</>
|
|
482
529
|
);
|
|
483
530
|
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Sheet,
|
|
4
|
+
SheetContent,
|
|
5
|
+
SheetHeader,
|
|
6
|
+
SheetTitle,
|
|
7
|
+
SheetBody,
|
|
8
|
+
Badge,
|
|
9
|
+
} from "@checkstack/ui";
|
|
10
|
+
import { Link } from "react-router-dom";
|
|
11
|
+
import {
|
|
12
|
+
catalogRoutes,
|
|
13
|
+
type System,
|
|
14
|
+
} from "@checkstack/catalog-common";
|
|
15
|
+
import { resolveRoute } from "@checkstack/common";
|
|
16
|
+
import { type AnomalyDto } from "@checkstack/anomaly-common";
|
|
17
|
+
import { formatDistanceToNow } from "date-fns";
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onOpenChange: (open: boolean) => void;
|
|
22
|
+
anomalies: AnomalyDto[];
|
|
23
|
+
systems: System[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const AnomalyOverviewSheet: React.FC<Props> = ({
|
|
27
|
+
open,
|
|
28
|
+
onOpenChange,
|
|
29
|
+
anomalies,
|
|
30
|
+
systems,
|
|
31
|
+
}) => {
|
|
32
|
+
// Map of systemId -> systemName
|
|
33
|
+
const systemMap = new Map(systems.map((s) => [s.id, s.name]));
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
37
|
+
<SheetContent>
|
|
38
|
+
<SheetHeader className="flex flex-row items-start justify-between gap-4 pt-6">
|
|
39
|
+
<div className="flex flex-col gap-1 text-left">
|
|
40
|
+
<SheetTitle>Active Anomalies</SheetTitle>
|
|
41
|
+
<p className="text-sm text-muted-foreground">
|
|
42
|
+
Overview of unusual system behavior
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
</SheetHeader>
|
|
46
|
+
|
|
47
|
+
<SheetBody className="flex flex-col gap-3 pb-8">
|
|
48
|
+
{anomalies.length === 0 ? (
|
|
49
|
+
<p className="text-sm text-muted-foreground text-center py-8">
|
|
50
|
+
No active anomalies
|
|
51
|
+
</p>
|
|
52
|
+
) : (
|
|
53
|
+
anomalies.map((anomaly) => {
|
|
54
|
+
const systemName = systemMap.get(anomaly.systemId) || anomaly.systemId;
|
|
55
|
+
const deviationText = anomaly.deviation
|
|
56
|
+
? `${anomaly.deviation.toFixed(1)}σ`
|
|
57
|
+
: "unusual";
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Link
|
|
61
|
+
key={anomaly.id}
|
|
62
|
+
to={resolveRoute(catalogRoutes.routes.systemDetail, { systemId: anomaly.systemId })}
|
|
63
|
+
onClick={() => onOpenChange(false)}
|
|
64
|
+
className="flex flex-col gap-2 rounded-lg border border-border bg-card p-4 hover:border-primary/50 hover:shadow-sm transition-all text-left"
|
|
65
|
+
>
|
|
66
|
+
<div className="flex items-start justify-between gap-4">
|
|
67
|
+
<h4 className="font-medium text-foreground">
|
|
68
|
+
{systemName}
|
|
69
|
+
</h4>
|
|
70
|
+
<Badge variant="warning" className="flex-shrink-0 font-mono">
|
|
71
|
+
{deviationText}
|
|
72
|
+
</Badge>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="flex flex-col gap-1 mt-2">
|
|
75
|
+
<span className="text-[10px] font-semibold text-muted-foreground uppercase tracking-wider">
|
|
76
|
+
Metric
|
|
77
|
+
</span>
|
|
78
|
+
<span className="text-sm font-mono text-foreground break-all">
|
|
79
|
+
{anomaly.fieldPath}
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
<div className="flex items-center justify-between mt-2 pt-2 border-t border-border/50 text-xs text-muted-foreground">
|
|
83
|
+
<span className="font-mono">
|
|
84
|
+
Observed: {anomaly.observedValue} <span className="opacity-70">(~{anomaly.baselineValue})</span>
|
|
85
|
+
</span>
|
|
86
|
+
<span>
|
|
87
|
+
{formatDistanceToNow(new Date(anomaly.startedAt), { addSuffix: true })}
|
|
88
|
+
</span>
|
|
89
|
+
</div>
|
|
90
|
+
</Link>
|
|
91
|
+
);
|
|
92
|
+
})
|
|
93
|
+
)}
|
|
94
|
+
</SheetBody>
|
|
95
|
+
</SheetContent>
|
|
96
|
+
</Sheet>
|
|
97
|
+
);
|
|
98
|
+
};
|