@checkstack/healthcheck-frontend 0.1.0 → 0.3.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.
@@ -3,7 +3,7 @@ import { useSearchParams } from "react-router-dom";
3
3
  import {
4
4
  useApi,
5
5
  wrapInSuspense,
6
- permissionApiRef,
6
+ accessApiRef,
7
7
  } from "@checkstack/frontend-api";
8
8
  import { healthCheckApiRef } from "../api";
9
9
  import {
@@ -11,6 +11,7 @@ import {
11
11
  HealthCheckStrategyDto,
12
12
  CreateHealthCheckConfiguration,
13
13
  healthcheckRoutes,
14
+ healthCheckAccess,
14
15
  } from "@checkstack/healthcheck-common";
15
16
  import { HealthCheckList } from "../components/HealthCheckList";
16
17
  import { HealthCheckEditor } from "../components/HealthCheckEditor";
@@ -21,13 +22,12 @@ import { resolveRoute } from "@checkstack/common";
21
22
 
22
23
  const HealthCheckConfigPageContent = () => {
23
24
  const api = useApi(healthCheckApiRef);
24
- const permissionApi = useApi(permissionApiRef);
25
+ const accessApi = useApi(accessApiRef);
25
26
  const [searchParams, setSearchParams] = useSearchParams();
26
- const { allowed: canRead, loading: permissionLoading } =
27
- permissionApi.useResourcePermission("healthcheck", "read");
28
- const { allowed: canManage } = permissionApi.useResourcePermission(
29
- "healthcheck",
30
- "manage"
27
+ const { allowed: canRead, loading: accessLoading } =
28
+ accessApi.useAccess(healthCheckAccess.configuration.read);
29
+ const { allowed: canManage } = accessApi.useAccess(
30
+ healthCheckAccess.configuration.manage
31
31
  );
32
32
 
33
33
  const [configurations, setConfigurations] = useState<
@@ -45,7 +45,7 @@ const HealthCheckConfigPageContent = () => {
45
45
  const [isDeleting, setIsDeleting] = useState(false);
46
46
 
47
47
  const fetchData = async () => {
48
- const [configs, strats] = await Promise.all([
48
+ const [{ configurations: configs }, strats] = await Promise.all([
49
49
  api.getConfigurations(),
50
50
  api.getStrategies(),
51
51
  ]);
@@ -113,7 +113,7 @@ const HealthCheckConfigPageContent = () => {
113
113
  <PageLayout
114
114
  title="Health Checks"
115
115
  subtitle="Manage health check configurations"
116
- loading={permissionLoading}
116
+ loading={accessLoading}
117
117
  allowed={canRead}
118
118
  actions={
119
119
  <div className="flex gap-2">
@@ -2,10 +2,13 @@ import { useState } from "react";
2
2
  import {
3
3
  useApi,
4
4
  wrapInSuspense,
5
- permissionApiRef,
5
+ accessApiRef,
6
6
  } from "@checkstack/frontend-api";
7
7
  import { healthCheckApiRef } from "../api";
8
- import { healthcheckRoutes } from "@checkstack/healthcheck-common";
8
+ import {
9
+ healthcheckRoutes,
10
+ healthCheckAccess,
11
+ } from "@checkstack/healthcheck-common";
9
12
  import { resolveRoute } from "@checkstack/common";
10
13
  import {
11
14
  PageLayout,
@@ -32,9 +35,9 @@ const HealthCheckHistoryDetailPageContent = () => {
32
35
  }>();
33
36
 
34
37
  const api = useApi(healthCheckApiRef);
35
- const permissionApi = useApi(permissionApiRef);
36
- const { allowed: canManage, loading: permissionLoading } =
37
- permissionApi.useResourcePermission("healthcheck", "manage");
38
+ const accessApi = useApi(accessApiRef);
39
+ const { allowed: canManage, loading: accessLoading } =
40
+ accessApi.useAccess(healthCheckAccess.configuration.manage);
38
41
 
39
42
  const [dateRange, setDateRange] = useState<DateRange>(getDefaultDateRange);
40
43
 
@@ -65,7 +68,7 @@ const HealthCheckHistoryDetailPageContent = () => {
65
68
  0,
66
69
  8
67
70
  )}...`}
68
- loading={permissionLoading}
71
+ loading={accessLoading}
69
72
  allowed={canManage}
70
73
  actions={
71
74
  <BackLink to={resolveRoute(healthcheckRoutes.routes.history)}>
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useApi,
3
3
  wrapInSuspense,
4
- permissionApiRef,
4
+ accessApiRef,
5
5
  } from "@checkstack/frontend-api";
6
6
  import { healthCheckApiRef } from "../api";
7
7
  import {
@@ -16,12 +16,13 @@ import {
16
16
  HealthCheckRunsTable,
17
17
  type HealthCheckRunDetailed,
18
18
  } from "../components/HealthCheckRunsTable";
19
+ import { healthCheckAccess } from "@checkstack/healthcheck-common";
19
20
 
20
21
  const HealthCheckHistoryPageContent = () => {
21
22
  const api = useApi(healthCheckApiRef);
22
- const permissionApi = useApi(permissionApiRef);
23
- const { allowed: canManage, loading: permissionLoading } =
24
- permissionApi.useResourcePermission("healthcheck", "manage");
23
+ const accessApi = useApi(accessApiRef);
24
+ const { allowed: canManage, loading: accessLoading } =
25
+ accessApi.useAccess(healthCheckAccess.configuration.manage);
25
26
 
26
27
  const {
27
28
  items: runs,
@@ -42,7 +43,7 @@ const HealthCheckHistoryPageContent = () => {
42
43
  <PageLayout
43
44
  title="Health Check History"
44
45
  subtitle="Detailed run history with full result data"
45
- loading={permissionLoading}
46
+ loading={accessLoading}
46
47
  allowed={canManage}
47
48
  >
48
49
  <Card>