@checkstack/incident-frontend 0.1.0 → 0.2.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,86 @@
|
|
|
1
1
|
# @checkstack/incident-frontend
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9faec1f: # Unified AccessRule Terminology Refactoring
|
|
8
|
+
|
|
9
|
+
This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
|
|
10
|
+
|
|
11
|
+
## Changes
|
|
12
|
+
|
|
13
|
+
### Core Infrastructure (`@checkstack/common`)
|
|
14
|
+
|
|
15
|
+
- Introduced `AccessRule` interface as the primary access control type
|
|
16
|
+
- Added `accessPair()` helper for creating read/manage access rule pairs
|
|
17
|
+
- Added `access()` builder for individual access rules
|
|
18
|
+
- Replaced `Permission` type with `AccessRule` throughout
|
|
19
|
+
|
|
20
|
+
### API Changes
|
|
21
|
+
|
|
22
|
+
- `env.registerPermissions()` → `env.registerAccessRules()`
|
|
23
|
+
- `meta.permissions` → `meta.access` in RPC contracts
|
|
24
|
+
- `usePermission()` → `useAccess()` in frontend hooks
|
|
25
|
+
- Route `permission:` field → `accessRule:` field
|
|
26
|
+
|
|
27
|
+
### UI Changes
|
|
28
|
+
|
|
29
|
+
- "Roles & Permissions" tab → "Roles & Access Rules"
|
|
30
|
+
- "You don't have permission..." → "You don't have access..."
|
|
31
|
+
- All permission-related UI text updated
|
|
32
|
+
|
|
33
|
+
### Documentation & Templates
|
|
34
|
+
|
|
35
|
+
- Updated 18 documentation files with AccessRule terminology
|
|
36
|
+
- Updated 7 scaffolding templates with `accessPair()` pattern
|
|
37
|
+
- All code examples use new AccessRule API
|
|
38
|
+
|
|
39
|
+
## Migration Guide
|
|
40
|
+
|
|
41
|
+
### Backend Plugins
|
|
42
|
+
|
|
43
|
+
```diff
|
|
44
|
+
- import { permissionList } from "./permissions";
|
|
45
|
+
- env.registerPermissions(permissionList);
|
|
46
|
+
+ import { accessRules } from "./access";
|
|
47
|
+
+ env.registerAccessRules(accessRules);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### RPC Contracts
|
|
51
|
+
|
|
52
|
+
```diff
|
|
53
|
+
- .meta({ userType: "user", permissions: [permissions.read.id] })
|
|
54
|
+
+ .meta({ userType: "user", access: [access.read] })
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Frontend Hooks
|
|
58
|
+
|
|
59
|
+
```diff
|
|
60
|
+
- const canRead = accessApi.usePermission(permissions.read.id);
|
|
61
|
+
+ const canRead = accessApi.useAccess(access.read);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Routes
|
|
65
|
+
|
|
66
|
+
```diff
|
|
67
|
+
- permission: permissions.entityRead.id,
|
|
68
|
+
+ accessRule: access.read,
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [9faec1f]
|
|
74
|
+
- Updated dependencies [95eeec7]
|
|
75
|
+
- Updated dependencies [f533141]
|
|
76
|
+
- @checkstack/auth-frontend@0.2.0
|
|
77
|
+
- @checkstack/catalog-common@1.1.0
|
|
78
|
+
- @checkstack/common@0.2.0
|
|
79
|
+
- @checkstack/frontend-api@0.1.0
|
|
80
|
+
- @checkstack/incident-common@0.2.0
|
|
81
|
+
- @checkstack/ui@0.2.0
|
|
82
|
+
- @checkstack/signal-frontend@0.0.6
|
|
83
|
+
|
|
3
84
|
## 0.1.0
|
|
4
85
|
|
|
5
86
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -3,20 +3,17 @@ import { Link } from "react-router-dom";
|
|
|
3
3
|
import { AlertTriangle } from "lucide-react";
|
|
4
4
|
import type { UserMenuItemsContext } from "@checkstack/frontend-api";
|
|
5
5
|
import { DropdownMenuItem } from "@checkstack/ui";
|
|
6
|
-
import {
|
|
6
|
+
import { resolveRoute } from "@checkstack/common";
|
|
7
7
|
import {
|
|
8
8
|
incidentRoutes,
|
|
9
|
-
|
|
9
|
+
incidentAccess,
|
|
10
10
|
pluginMetadata,
|
|
11
11
|
} from "@checkstack/incident-common";
|
|
12
12
|
|
|
13
13
|
export const IncidentMenuItems = ({
|
|
14
|
-
|
|
14
|
+
accessRules: userPerms,
|
|
15
15
|
}: UserMenuItemsContext) => {
|
|
16
|
-
const qualifiedId =
|
|
17
|
-
pluginMetadata,
|
|
18
|
-
permissions.incidentManage
|
|
19
|
-
);
|
|
16
|
+
const qualifiedId = `${pluginMetadata.pluginId}.${incidentAccess.incident.manage.id}`;
|
|
20
17
|
const canManage = userPerms.includes("*") || userPerms.includes(qualifiedId);
|
|
21
18
|
|
|
22
19
|
if (!canManage) {
|
package/src/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
incidentRoutes,
|
|
11
11
|
IncidentApi,
|
|
12
12
|
pluginMetadata,
|
|
13
|
-
|
|
13
|
+
incidentAccess,
|
|
14
14
|
} from "@checkstack/incident-common";
|
|
15
15
|
import {
|
|
16
16
|
SystemDetailsTopSlot,
|
|
@@ -30,7 +30,7 @@ export default createFrontendPlugin({
|
|
|
30
30
|
route: incidentRoutes.routes.config,
|
|
31
31
|
element: <IncidentConfigPage />,
|
|
32
32
|
title: "Incidents",
|
|
33
|
-
|
|
33
|
+
accessRule: incidentAccess.incident.manage,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
route: incidentRoutes.routes.detail,
|
|
@@ -3,7 +3,7 @@ import { useSearchParams } from "react-router-dom";
|
|
|
3
3
|
import {
|
|
4
4
|
useApi,
|
|
5
5
|
rpcApiRef,
|
|
6
|
-
|
|
6
|
+
accessApiRef,
|
|
7
7
|
wrapInSuspense,
|
|
8
8
|
} from "@checkstack/frontend-api";
|
|
9
9
|
import { incidentApiRef } from "../api";
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
IncidentWithSystems,
|
|
12
12
|
IncidentStatus,
|
|
13
13
|
} from "@checkstack/incident-common";
|
|
14
|
+
import { incidentAccess } from "@checkstack/incident-common";
|
|
14
15
|
import { CatalogApi, type System } from "@checkstack/catalog-common";
|
|
15
16
|
import {
|
|
16
17
|
Card,
|
|
@@ -50,14 +51,14 @@ import { IncidentEditor } from "../components/IncidentEditor";
|
|
|
50
51
|
const IncidentConfigPageContent: React.FC = () => {
|
|
51
52
|
const api = useApi(incidentApiRef);
|
|
52
53
|
const rpcApi = useApi(rpcApiRef);
|
|
53
|
-
const
|
|
54
|
+
const accessApi = useApi(accessApiRef);
|
|
54
55
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
55
56
|
|
|
56
57
|
const catalogApi = useMemo(() => rpcApi.forPlugin(CatalogApi), [rpcApi]);
|
|
57
58
|
const toast = useToast();
|
|
58
59
|
|
|
59
|
-
const { allowed: canManage, loading:
|
|
60
|
-
|
|
60
|
+
const { allowed: canManage, loading: accessLoading } =
|
|
61
|
+
accessApi.useAccess(incidentAccess.incident.manage);
|
|
61
62
|
|
|
62
63
|
const [incidents, setIncidents] = useState<IncidentWithSystems[]>([]);
|
|
63
64
|
const [systems, setSystems] = useState<System[]>([]);
|
|
@@ -220,7 +221,7 @@ const IncidentConfigPageContent: React.FC = () => {
|
|
|
220
221
|
<PageLayout
|
|
221
222
|
title="Incident Management"
|
|
222
223
|
subtitle="Track and manage incidents affecting your systems"
|
|
223
|
-
loading={
|
|
224
|
+
loading={accessLoading}
|
|
224
225
|
allowed={canManage}
|
|
225
226
|
actions={
|
|
226
227
|
<Button onClick={handleCreate}>
|
|
@@ -3,7 +3,7 @@ import { useParams, useNavigate, useSearchParams } from "react-router-dom";
|
|
|
3
3
|
import {
|
|
4
4
|
useApi,
|
|
5
5
|
rpcApiRef,
|
|
6
|
-
|
|
6
|
+
accessApiRef,
|
|
7
7
|
wrapInSuspense,
|
|
8
8
|
} from "@checkstack/frontend-api";
|
|
9
9
|
import { useSignal } from "@checkstack/signal-frontend";
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
incidentRoutes,
|
|
14
14
|
INCIDENT_UPDATED,
|
|
15
15
|
type IncidentDetail,
|
|
16
|
+
incidentAccess,
|
|
16
17
|
} from "@checkstack/incident-common";
|
|
17
18
|
import { CatalogApi, type System } from "@checkstack/catalog-common";
|
|
18
19
|
import {
|
|
@@ -50,14 +51,13 @@ const IncidentDetailPageContent: React.FC = () => {
|
|
|
50
51
|
const [searchParams] = useSearchParams();
|
|
51
52
|
const api = useApi(incidentApiRef);
|
|
52
53
|
const rpcApi = useApi(rpcApiRef);
|
|
53
|
-
const
|
|
54
|
+
const accessApi = useApi(accessApiRef);
|
|
54
55
|
const toast = useToast();
|
|
55
56
|
|
|
56
57
|
const catalogApi = useMemo(() => rpcApi.forPlugin(CatalogApi), [rpcApi]);
|
|
57
58
|
|
|
58
|
-
const { allowed: canManage } =
|
|
59
|
-
|
|
60
|
-
"manage"
|
|
59
|
+
const { allowed: canManage } = accessApi.useAccess(
|
|
60
|
+
incidentAccess.incident.manage
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
const [incident, setIncident] = useState<IncidentDetail | undefined>();
|