@checkstack/maintenance-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/maintenance-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/maintenance-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 { Wrench } 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
|
maintenanceRoutes,
|
|
9
|
-
|
|
9
|
+
maintenanceAccess,
|
|
10
10
|
pluginMetadata,
|
|
11
11
|
} from "@checkstack/maintenance-common";
|
|
12
12
|
|
|
13
13
|
export const MaintenanceMenuItems = ({
|
|
14
|
-
|
|
14
|
+
accessRules: userPerms,
|
|
15
15
|
}: UserMenuItemsContext) => {
|
|
16
|
-
const qualifiedId =
|
|
17
|
-
pluginMetadata,
|
|
18
|
-
permissions.maintenanceManage
|
|
19
|
-
);
|
|
16
|
+
const qualifiedId = `${pluginMetadata.pluginId}.${maintenanceAccess.maintenance.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
|
maintenanceRoutes,
|
|
11
11
|
MaintenanceApi,
|
|
12
12
|
pluginMetadata,
|
|
13
|
-
|
|
13
|
+
maintenanceAccess,
|
|
14
14
|
} from "@checkstack/maintenance-common";
|
|
15
15
|
import {
|
|
16
16
|
SystemDetailsTopSlot,
|
|
@@ -30,7 +30,7 @@ export default createFrontendPlugin({
|
|
|
30
30
|
route: maintenanceRoutes.routes.config,
|
|
31
31
|
element: <MaintenanceConfigPage />,
|
|
32
32
|
title: "Maintenances",
|
|
33
|
-
|
|
33
|
+
accessRule: maintenanceAccess.maintenance.manage,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
route: maintenanceRoutes.routes.systemHistory,
|
|
@@ -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 { maintenanceApiRef } from "../api";
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
MaintenanceWithSystems,
|
|
12
12
|
MaintenanceStatus,
|
|
13
13
|
} from "@checkstack/maintenance-common";
|
|
14
|
+
import { maintenanceAccess } from "@checkstack/maintenance-common";
|
|
14
15
|
import { CatalogApi, type System } from "@checkstack/catalog-common";
|
|
15
16
|
import {
|
|
16
17
|
Card,
|
|
@@ -51,14 +52,14 @@ import { getMaintenanceStatusBadge } from "../utils/badges";
|
|
|
51
52
|
const MaintenanceConfigPageContent: React.FC = () => {
|
|
52
53
|
const api = useApi(maintenanceApiRef);
|
|
53
54
|
const rpcApi = useApi(rpcApiRef);
|
|
54
|
-
const
|
|
55
|
+
const accessApi = useApi(accessApiRef);
|
|
55
56
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
56
57
|
|
|
57
58
|
const catalogApi = useMemo(() => rpcApi.forPlugin(CatalogApi), [rpcApi]);
|
|
58
59
|
const toast = useToast();
|
|
59
60
|
|
|
60
|
-
const { allowed: canManage, loading:
|
|
61
|
-
|
|
61
|
+
const { allowed: canManage, loading: accessLoading } =
|
|
62
|
+
accessApi.useAccess(maintenanceAccess.maintenance.manage);
|
|
62
63
|
|
|
63
64
|
const [maintenances, setMaintenances] = useState<MaintenanceWithSystems[]>(
|
|
64
65
|
[]
|
|
@@ -186,7 +187,7 @@ const MaintenanceConfigPageContent: React.FC = () => {
|
|
|
186
187
|
<PageLayout
|
|
187
188
|
title="Planned Maintenances"
|
|
188
189
|
subtitle="Manage scheduled maintenance windows for systems"
|
|
189
|
-
loading={
|
|
190
|
+
loading={accessLoading}
|
|
190
191
|
allowed={canManage}
|
|
191
192
|
actions={
|
|
192
193
|
<Button onClick={handleCreate}>
|
|
@@ -9,11 +9,14 @@ import {
|
|
|
9
9
|
useApi,
|
|
10
10
|
rpcApiRef,
|
|
11
11
|
wrapInSuspense,
|
|
12
|
-
|
|
12
|
+
accessApiRef,
|
|
13
13
|
} from "@checkstack/frontend-api";
|
|
14
14
|
import { resolveRoute } from "@checkstack/common";
|
|
15
15
|
import { maintenanceApiRef } from "../api";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
maintenanceRoutes,
|
|
18
|
+
maintenanceAccess,
|
|
19
|
+
} from "@checkstack/maintenance-common";
|
|
17
20
|
import type { MaintenanceDetail } from "@checkstack/maintenance-common";
|
|
18
21
|
import {
|
|
19
22
|
catalogRoutes,
|
|
@@ -53,14 +56,13 @@ const MaintenanceDetailPageContent: React.FC = () => {
|
|
|
53
56
|
const [searchParams] = useSearchParams();
|
|
54
57
|
const api = useApi(maintenanceApiRef);
|
|
55
58
|
const rpcApi = useApi(rpcApiRef);
|
|
56
|
-
const
|
|
59
|
+
const accessApi = useApi(accessApiRef);
|
|
57
60
|
const toast = useToast();
|
|
58
61
|
|
|
59
62
|
const catalogApi = useMemo(() => rpcApi.forPlugin(CatalogApi), [rpcApi]);
|
|
60
63
|
|
|
61
|
-
const { allowed: canManage } =
|
|
62
|
-
|
|
63
|
-
"manage"
|
|
64
|
+
const { allowed: canManage } = accessApi.useAccess(
|
|
65
|
+
maintenanceAccess.maintenance.manage
|
|
64
66
|
);
|
|
65
67
|
|
|
66
68
|
const [maintenance, setMaintenance] = useState<MaintenanceDetail>();
|