@checkstack/maintenance-frontend 0.0.4 → 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 +165 -0
- package/package.json +2 -1
- package/src/components/MaintenanceEditor.tsx +17 -0
- package/src/components/MaintenanceMenuItems.tsx +4 -7
- package/src/index.tsx +2 -2
- package/src/pages/MaintenanceConfigPage.tsx +13 -11
- package/src/pages/MaintenanceDetailPage.tsx +9 -7
- package/src/pages/SystemMaintenanceHistoryPage.tsx +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,170 @@
|
|
|
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
|
+
|
|
84
|
+
## 0.1.0
|
|
85
|
+
|
|
86
|
+
### Minor Changes
|
|
87
|
+
|
|
88
|
+
- 8e43507: # Teams and Resource-Level Access Control
|
|
89
|
+
|
|
90
|
+
This release introduces a comprehensive Teams system for organizing users and controlling access to resources at a granular level.
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
### Team Management
|
|
95
|
+
|
|
96
|
+
- Create, update, and delete teams with name and description
|
|
97
|
+
- Add/remove users from teams
|
|
98
|
+
- Designate team managers with elevated privileges
|
|
99
|
+
- View team membership and manager status
|
|
100
|
+
|
|
101
|
+
### Resource-Level Access Control
|
|
102
|
+
|
|
103
|
+
- Grant teams access to specific resources (systems, health checks, incidents, maintenances)
|
|
104
|
+
- Configure read-only or manage permissions per team
|
|
105
|
+
- Resource-level "Team Only" mode that restricts access exclusively to team members
|
|
106
|
+
- Separate `resourceAccessSettings` table for resource-level settings (not per-grant)
|
|
107
|
+
- Automatic cleanup of grants when teams are deleted (database cascade)
|
|
108
|
+
|
|
109
|
+
### Middleware Integration
|
|
110
|
+
|
|
111
|
+
- Extended `autoAuthMiddleware` to support resource access checks
|
|
112
|
+
- Single-resource pre-handler validation for detail endpoints
|
|
113
|
+
- Automatic list filtering for collection endpoints
|
|
114
|
+
- S2S endpoints for access verification
|
|
115
|
+
|
|
116
|
+
### Frontend Components
|
|
117
|
+
|
|
118
|
+
- `TeamsTab` component for managing teams in Auth Settings
|
|
119
|
+
- `TeamAccessEditor` component for assigning team access to resources
|
|
120
|
+
- Resource-level "Team Only" toggle in `TeamAccessEditor`
|
|
121
|
+
- Integration into System, Health Check, Incident, and Maintenance editors
|
|
122
|
+
|
|
123
|
+
## Breaking Changes
|
|
124
|
+
|
|
125
|
+
### API Response Format Changes
|
|
126
|
+
|
|
127
|
+
List endpoints now return objects with named keys instead of arrays directly:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// Before
|
|
131
|
+
const systems = await catalogApi.getSystems();
|
|
132
|
+
|
|
133
|
+
// After
|
|
134
|
+
const { systems } = await catalogApi.getSystems();
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Affected endpoints:
|
|
138
|
+
|
|
139
|
+
- `catalog.getSystems` → `{ systems: [...] }`
|
|
140
|
+
- `healthcheck.getConfigurations` → `{ configurations: [...] }`
|
|
141
|
+
- `incident.listIncidents` → `{ incidents: [...] }`
|
|
142
|
+
- `maintenance.listMaintenances` → `{ maintenances: [...] }`
|
|
143
|
+
|
|
144
|
+
### User Identity Enrichment
|
|
145
|
+
|
|
146
|
+
`RealUser` and `ApplicationUser` types now include `teamIds: string[]` field with team memberships.
|
|
147
|
+
|
|
148
|
+
## Documentation
|
|
149
|
+
|
|
150
|
+
See `docs/backend/teams.md` for complete API reference and integration guide.
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- 97c5a6b: Fix Radix UI accessibility warning in dialog components by adding visually hidden DialogDescription components
|
|
155
|
+
- Updated dependencies [8e43507]
|
|
156
|
+
- Updated dependencies [97c5a6b]
|
|
157
|
+
- Updated dependencies [97c5a6b]
|
|
158
|
+
- Updated dependencies [8e43507]
|
|
159
|
+
- Updated dependencies [8e43507]
|
|
160
|
+
- @checkstack/ui@0.1.0
|
|
161
|
+
- @checkstack/auth-frontend@0.1.0
|
|
162
|
+
- @checkstack/catalog-common@1.0.0
|
|
163
|
+
- @checkstack/common@0.1.0
|
|
164
|
+
- @checkstack/maintenance-common@0.1.0
|
|
165
|
+
- @checkstack/frontend-api@0.0.4
|
|
166
|
+
- @checkstack/signal-frontend@0.0.5
|
|
167
|
+
|
|
3
168
|
## 0.0.4
|
|
4
169
|
|
|
5
170
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/maintenance-frontend",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"lint:code": "eslint . --max-warnings 0"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@checkstack/auth-frontend": "workspace:*",
|
|
12
13
|
"@checkstack/catalog-common": "workspace:*",
|
|
13
14
|
"@checkstack/common": "workspace:*",
|
|
14
15
|
"@checkstack/frontend-api": "workspace:*",
|
|
@@ -9,6 +9,7 @@ import type { System } from "@checkstack/catalog-common";
|
|
|
9
9
|
import {
|
|
10
10
|
Dialog,
|
|
11
11
|
DialogContent,
|
|
12
|
+
DialogDescription,
|
|
12
13
|
DialogHeader,
|
|
13
14
|
DialogTitle,
|
|
14
15
|
DialogFooter,
|
|
@@ -24,6 +25,7 @@ import {
|
|
|
24
25
|
import { Plus, MessageSquare, Loader2, AlertCircle } from "lucide-react";
|
|
25
26
|
import { MaintenanceUpdateForm } from "./MaintenanceUpdateForm";
|
|
26
27
|
import { getMaintenanceStatusBadge } from "../utils/badges";
|
|
28
|
+
import { TeamAccessEditor } from "@checkstack/auth-frontend";
|
|
27
29
|
|
|
28
30
|
interface Props {
|
|
29
31
|
open: boolean;
|
|
@@ -173,6 +175,11 @@ export const MaintenanceEditor: React.FC<Props> = ({
|
|
|
173
175
|
<DialogTitle>
|
|
174
176
|
{maintenance ? "Edit Maintenance" : "Create Maintenance"}
|
|
175
177
|
</DialogTitle>
|
|
178
|
+
<DialogDescription className="sr-only">
|
|
179
|
+
{maintenance
|
|
180
|
+
? "Modify the settings for this scheduled maintenance"
|
|
181
|
+
: "Schedule a new maintenance window for your systems"}
|
|
182
|
+
</DialogDescription>
|
|
176
183
|
</DialogHeader>
|
|
177
184
|
|
|
178
185
|
<div className="grid gap-6 py-4 max-h-[70vh] overflow-y-auto">
|
|
@@ -301,6 +308,16 @@ export const MaintenanceEditor: React.FC<Props> = ({
|
|
|
301
308
|
)}
|
|
302
309
|
</div>
|
|
303
310
|
)}
|
|
311
|
+
|
|
312
|
+
{/* Team Access Editor - only shown when editing existing maintenance */}
|
|
313
|
+
{maintenance?.id && (
|
|
314
|
+
<TeamAccessEditor
|
|
315
|
+
resourceType="maintenance.maintenance"
|
|
316
|
+
resourceId={maintenance.id}
|
|
317
|
+
compact
|
|
318
|
+
expanded
|
|
319
|
+
/>
|
|
320
|
+
)}
|
|
304
321
|
</div>
|
|
305
322
|
|
|
306
323
|
<DialogFooter>
|
|
@@ -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
|
[]
|
|
@@ -86,12 +87,13 @@ const MaintenanceConfigPageContent: React.FC = () => {
|
|
|
86
87
|
const loadData = async () => {
|
|
87
88
|
setLoading(true);
|
|
88
89
|
try {
|
|
89
|
-
const [maintenanceList, systemList] =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
const [{ maintenances: maintenanceList }, { systems: systemList }] =
|
|
91
|
+
await Promise.all([
|
|
92
|
+
api.listMaintenances(
|
|
93
|
+
statusFilter === "all" ? undefined : { status: statusFilter }
|
|
94
|
+
),
|
|
95
|
+
catalogApi.getSystems(),
|
|
96
|
+
]);
|
|
95
97
|
setMaintenances(maintenanceList);
|
|
96
98
|
setSystems(systemList);
|
|
97
99
|
} catch (error) {
|
|
@@ -185,7 +187,7 @@ const MaintenanceConfigPageContent: React.FC = () => {
|
|
|
185
187
|
<PageLayout
|
|
186
188
|
title="Planned Maintenances"
|
|
187
189
|
subtitle="Manage scheduled maintenance windows for systems"
|
|
188
|
-
loading={
|
|
190
|
+
loading={accessLoading}
|
|
189
191
|
allowed={canManage}
|
|
190
192
|
actions={
|
|
191
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>();
|
|
@@ -73,7 +75,7 @@ const MaintenanceDetailPageContent: React.FC = () => {
|
|
|
73
75
|
|
|
74
76
|
setLoading(true);
|
|
75
77
|
try {
|
|
76
|
-
const [maintenanceData, systemList] = await Promise.all([
|
|
78
|
+
const [maintenanceData, { systems: systemList }] = await Promise.all([
|
|
77
79
|
api.getMaintenance({ id: maintenanceId }),
|
|
78
80
|
catalogApi.getSystems(),
|
|
79
81
|
]);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useMemo } from "react";
|
|
2
2
|
import { useParams, useNavigate } from "react-router-dom";
|
|
3
|
-
import {
|
|
4
|
-
useApi,
|
|
5
|
-
rpcApiRef,
|
|
6
|
-
wrapInSuspense,
|
|
7
|
-
} from "@checkstack/frontend-api";
|
|
3
|
+
import { useApi, rpcApiRef, wrapInSuspense } from "@checkstack/frontend-api";
|
|
8
4
|
import { resolveRoute } from "@checkstack/common";
|
|
9
5
|
import { maintenanceApiRef } from "../api";
|
|
10
6
|
import { maintenanceRoutes } from "@checkstack/maintenance-common";
|
|
@@ -53,10 +49,11 @@ const SystemMaintenanceHistoryPageContent: React.FC = () => {
|
|
|
53
49
|
const loadData = async () => {
|
|
54
50
|
setLoading(true);
|
|
55
51
|
try {
|
|
56
|
-
const [maintenanceList, systemList] =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
const [{ maintenances: maintenanceList }, { systems: systemList }] =
|
|
53
|
+
await Promise.all([
|
|
54
|
+
api.listMaintenances({ systemId }),
|
|
55
|
+
catalogApi.getSystems(),
|
|
56
|
+
]);
|
|
60
57
|
setMaintenances(maintenanceList);
|
|
61
58
|
const system = systemList.find((s) => s.id === systemId);
|
|
62
59
|
setSystemName(system?.name ?? "Unknown System");
|