@checkstack/healthcheck-frontend 0.2.0 → 0.4.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 +171 -0
- package/package.json +2 -1
- package/src/api.ts +2 -10
- package/src/auto-charts/schema-parser.ts +1 -1
- package/src/auto-charts/useStrategySchemas.ts +39 -48
- package/src/components/AssertionBuilder.tsx +8 -0
- package/src/components/HealthCheckDiagram.tsx +6 -6
- package/src/components/HealthCheckHistory.tsx +10 -14
- package/src/components/HealthCheckMenuItems.tsx +4 -7
- package/src/components/HealthCheckSystemOverview.tsx +66 -123
- package/src/components/SystemHealthBadge.tsx +36 -27
- package/src/components/SystemHealthCheckAssignment.tsx +196 -215
- package/src/hooks/useCollectors.ts +21 -34
- package/src/hooks/useHealthCheckData.ts +104 -153
- package/src/index.tsx +6 -20
- package/src/pages/HealthCheckConfigPage.tsx +70 -46
- package/src/pages/HealthCheckHistoryDetailPage.tsx +32 -28
- package/src/pages/HealthCheckHistoryPage.tsx +27 -22
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
useApi,
|
|
3
2
|
wrapInSuspense,
|
|
4
|
-
|
|
3
|
+
accessApiRef,
|
|
4
|
+
useApi,
|
|
5
|
+
usePluginClient,
|
|
5
6
|
} from "@checkstack/frontend-api";
|
|
6
|
-
import { healthCheckApiRef } from "../api";
|
|
7
7
|
import {
|
|
8
8
|
PageLayout,
|
|
9
9
|
usePagination,
|
|
10
|
+
usePaginationSync,
|
|
10
11
|
Card,
|
|
11
12
|
CardHeader,
|
|
12
13
|
CardTitle,
|
|
@@ -16,33 +17,37 @@ import {
|
|
|
16
17
|
HealthCheckRunsTable,
|
|
17
18
|
type HealthCheckRunDetailed,
|
|
18
19
|
} from "../components/HealthCheckRunsTable";
|
|
20
|
+
import {
|
|
21
|
+
healthCheckAccess,
|
|
22
|
+
HealthCheckApi,
|
|
23
|
+
} from "@checkstack/healthcheck-common";
|
|
19
24
|
|
|
20
25
|
const HealthCheckHistoryPageContent = () => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const { allowed: canManage, loading:
|
|
24
|
-
|
|
26
|
+
const healthCheckClient = usePluginClient(HealthCheckApi);
|
|
27
|
+
const accessApi = useApi(accessApiRef);
|
|
28
|
+
const { allowed: canManage, loading: accessLoading } = accessApi.useAccess(
|
|
29
|
+
healthCheckAccess.configuration.manage
|
|
30
|
+
);
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
limit: params.limit,
|
|
34
|
-
offset: params.offset,
|
|
35
|
-
}),
|
|
36
|
-
getItems: (response) => response.runs as HealthCheckRunDetailed[],
|
|
37
|
-
getTotal: (response) => response.total,
|
|
38
|
-
defaultLimit: 20,
|
|
32
|
+
// Pagination state
|
|
33
|
+
const pagination = usePagination({ defaultLimit: 20 });
|
|
34
|
+
|
|
35
|
+
// Fetch data with useQuery
|
|
36
|
+
const { data, isLoading } = healthCheckClient.getDetailedHistory.useQuery({
|
|
37
|
+
limit: pagination.limit,
|
|
38
|
+
offset: pagination.offset,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
// Sync total from response
|
|
42
|
+
usePaginationSync(pagination, data?.total);
|
|
43
|
+
|
|
44
|
+
const runs = (data?.runs ?? []) as HealthCheckRunDetailed[];
|
|
45
|
+
|
|
41
46
|
return (
|
|
42
47
|
<PageLayout
|
|
43
48
|
title="Health Check History"
|
|
44
49
|
subtitle="Detailed run history with full result data"
|
|
45
|
-
loading={
|
|
50
|
+
loading={accessLoading}
|
|
46
51
|
allowed={canManage}
|
|
47
52
|
>
|
|
48
53
|
<Card>
|
|
@@ -52,7 +57,7 @@ const HealthCheckHistoryPageContent = () => {
|
|
|
52
57
|
<CardContent>
|
|
53
58
|
<HealthCheckRunsTable
|
|
54
59
|
runs={runs}
|
|
55
|
-
loading={
|
|
60
|
+
loading={isLoading}
|
|
56
61
|
showFilterColumns
|
|
57
62
|
pagination={pagination}
|
|
58
63
|
/>
|