@byline/host-tanstack-start 3.21.0 → 4.1.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/dist/admin-shell/admin-activity/list.js +15 -5
- package/dist/admin-shell/admin-roles/delete.js +2 -1
- package/dist/admin-shell/admin-roles/list.js +2 -1
- package/dist/admin-shell/admin-users/delete.js +2 -1
- package/dist/admin-shell/admin-users/list.js +4 -7
- package/dist/admin-shell/chrome/admin-app-bar.js +2 -1
- package/dist/admin-shell/chrome/admin-menu-drawer.js +9 -8
- package/dist/admin-shell/chrome/admin-menu-provider.js +2 -1
- package/dist/admin-shell/chrome/dashboard.js +4 -3
- package/dist/admin-shell/chrome/sign-in-page.d.ts +2 -2
- package/dist/admin-shell/chrome/sign-in-page.js +2 -2
- package/dist/admin-shell/collections/create.js +4 -3
- package/dist/admin-shell/collections/document-history.js +6 -1
- package/dist/admin-shell/collections/edit.js +18 -14
- package/dist/admin-shell/collections/history.js +5 -4
- package/dist/admin-shell/collections/list.js +8 -7
- package/dist/admin-shell/collections/restore-version-modal.js +2 -1
- package/dist/admin-shell/collections/tree-list.js +53 -17
- package/dist/admin-shell/collections/view-menu.js +9 -8
- package/dist/i18n/resolve-locale.js +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/integrations/abilities.js +8 -7
- package/dist/integrations/host-bridge.d.ts +13 -0
- package/dist/integrations/host-bridge.js +22 -0
- package/dist/integrations/serve-uploads.d.ts +1 -0
- package/dist/integrations/serve-uploads.js +1 -0
- package/dist/integrations/start-errors.js +2 -1
- package/dist/routes/admin-path.d.ts +22 -0
- package/dist/routes/admin-path.js +35 -0
- package/dist/routes/create-admin-account-route.js +3 -2
- package/dist/routes/create-admin-activity-route.js +3 -2
- package/dist/routes/create-admin-dashboard-route.js +2 -1
- package/dist/routes/create-admin-layout-route.d.ts +1 -1
- package/dist/routes/create-admin-layout-route.js +3 -1
- package/dist/routes/create-admin-permissions-route.js +3 -2
- package/dist/routes/create-admin-role-edit-route.js +4 -3
- package/dist/routes/create-admin-roles-list-route.js +3 -2
- package/dist/routes/create-admin-user-edit-route.js +4 -3
- package/dist/routes/create-admin-users-list-route.js +3 -2
- package/dist/routes/create-collection-api-route.js +5 -4
- package/dist/routes/create-collection-create-route.js +4 -3
- package/dist/routes/create-collection-edit-route.js +4 -3
- package/dist/routes/create-collection-history-route.js +5 -4
- package/dist/routes/create-collection-list-route.js +3 -2
- package/dist/routes/create-sign-in-route.js +3 -2
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +2 -0
- package/dist/routes/sign-in-path.d.ts +13 -0
- package/dist/routes/sign-in-path.js +19 -0
- package/dist/server-fns/admin-account/change-password.js +1 -1
- package/dist/server-fns/admin-account/get.js +1 -1
- package/dist/server-fns/admin-account/update.js +1 -1
- package/dist/server-fns/admin-activity/get.js +1 -1
- package/dist/server-fns/admin-permissions/get-role-abilities.js +1 -1
- package/dist/server-fns/admin-permissions/list-registered.js +1 -1
- package/dist/server-fns/admin-permissions/set-role-abilities.js +1 -1
- package/dist/server-fns/admin-permissions/who-has.js +1 -1
- package/dist/server-fns/admin-roles/create.js +1 -1
- package/dist/server-fns/admin-roles/delete.js +1 -1
- package/dist/server-fns/admin-roles/get.js +1 -1
- package/dist/server-fns/admin-roles/list.js +1 -1
- package/dist/server-fns/admin-roles/reorder.js +1 -1
- package/dist/server-fns/admin-roles/update.js +1 -1
- package/dist/server-fns/admin-users/create.js +1 -1
- package/dist/server-fns/admin-users/delete.js +1 -1
- package/dist/server-fns/admin-users/disable.js +1 -1
- package/dist/server-fns/admin-users/enable.js +1 -1
- package/dist/server-fns/admin-users/get-user-roles.js +1 -1
- package/dist/server-fns/admin-users/get.js +1 -1
- package/dist/server-fns/admin-users/list.js +1 -1
- package/dist/server-fns/admin-users/set-password.js +1 -1
- package/dist/server-fns/admin-users/set-user-roles.js +1 -1
- package/dist/server-fns/admin-users/update.js +1 -1
- package/dist/server-fns/ai/execute.js +1 -1
- package/dist/server-fns/auth/current-user.js +1 -1
- package/dist/server-fns/auth/sign-in.js +1 -1
- package/dist/server-fns/auth/sign-out.js +1 -2
- package/dist/server-fns/collections/audit.js +1 -1
- package/dist/server-fns/collections/copy-to-locale.js +1 -1
- package/dist/server-fns/collections/create.js +1 -1
- package/dist/server-fns/collections/delete-locale.js +1 -1
- package/dist/server-fns/collections/delete-outcome.d.ts +30 -0
- package/dist/server-fns/collections/delete-outcome.js +34 -0
- package/dist/server-fns/collections/delete.d.ts +1 -4
- package/dist/server-fns/collections/delete.js +3 -5
- package/dist/server-fns/collections/duplicate.js +1 -1
- package/dist/server-fns/collections/get.js +1 -1
- package/dist/server-fns/collections/history.js +1 -1
- package/dist/server-fns/collections/index.d.ts +1 -0
- package/dist/server-fns/collections/index.js +1 -0
- package/dist/server-fns/collections/list.js +1 -1
- package/dist/server-fns/collections/reindex.js +1 -1
- package/dist/server-fns/collections/reorder.js +1 -1
- package/dist/server-fns/collections/restore-version.js +1 -1
- package/dist/server-fns/collections/stats.js +1 -1
- package/dist/server-fns/collections/status.js +1 -1
- package/dist/server-fns/collections/tree-mutation.d.ts +46 -0
- package/dist/server-fns/collections/tree-mutation.js +109 -0
- package/dist/server-fns/collections/tree-read.d.ts +6 -0
- package/dist/server-fns/collections/tree-read.js +15 -0
- package/dist/server-fns/collections/tree.d.ts +5 -4
- package/dist/server-fns/collections/tree.js +16 -13
- package/dist/server-fns/collections/update.js +3 -2
- package/dist/server-fns/collections/upload.js +1 -1
- package/dist/server-fns/i18n/set-locale.js +1 -1
- package/dist/server-fns/preview/disable.js +1 -1
- package/dist/server-fns/preview/enable.js +1 -2
- package/dist/server-fns/preview/state.js +1 -1
- package/dist/vite/client-hook-boundary.d.ts +19 -0
- package/dist/vite/client-hook-boundary.js +20 -0
- package/dist/{integrations/byline-public-client.d.ts → vite/index.d.ts} +1 -2
- package/dist/vite/index.js +1 -0
- package/package.json +15 -14
- package/src/admin-shell/admin-activity/list.tsx +13 -3
- package/src/admin-shell/admin-roles/delete.tsx +2 -1
- package/src/admin-shell/admin-roles/list.tsx +2 -1
- package/src/admin-shell/admin-users/delete.tsx +3 -2
- package/src/admin-shell/admin-users/list.tsx +9 -8
- package/src/admin-shell/chrome/admin-app-bar.tsx +2 -1
- package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -8
- package/src/admin-shell/chrome/admin-menu-provider.tsx +2 -1
- package/src/admin-shell/chrome/dashboard.tsx +4 -3
- package/src/admin-shell/chrome/sign-in-page.tsx +3 -3
- package/src/admin-shell/collections/create.tsx +4 -3
- package/src/admin-shell/collections/document-history.tsx +5 -0
- package/src/admin-shell/collections/edit.tsx +20 -13
- package/src/admin-shell/collections/history.tsx +6 -5
- package/src/admin-shell/collections/list.tsx +8 -7
- package/src/admin-shell/collections/restore-version-modal.tsx +2 -1
- package/src/admin-shell/collections/tree-list.tsx +78 -22
- package/src/admin-shell/collections/view-menu.tsx +9 -8
- package/src/i18n/resolve-locale.ts +1 -1
- package/src/index.ts +5 -6
- package/src/integrations/abilities.tsx +14 -4
- package/src/integrations/host-bridge.ts +56 -0
- package/src/integrations/serve-uploads.ts +6 -0
- package/src/integrations/start-errors.test.node.ts +22 -0
- package/src/integrations/start-errors.ts +1 -0
- package/src/routes/admin-path.test.node.ts +129 -0
- package/src/routes/admin-path.ts +66 -0
- package/src/routes/auth-routes.test.node.ts +39 -0
- package/src/routes/create-admin-account-route.tsx +3 -2
- package/src/routes/create-admin-activity-route.tsx +3 -2
- package/src/routes/create-admin-dashboard-route.tsx +2 -1
- package/src/routes/create-admin-layout-route.tsx +4 -4
- package/src/routes/create-admin-permissions-route.tsx +3 -2
- package/src/routes/create-admin-role-edit-route.tsx +7 -3
- package/src/routes/create-admin-roles-list-route.tsx +3 -2
- package/src/routes/create-admin-user-edit-route.tsx +7 -3
- package/src/routes/create-admin-users-list-route.tsx +3 -2
- package/src/routes/create-collection-api-route.tsx +8 -4
- package/src/routes/create-collection-create-route.tsx +7 -3
- package/src/routes/create-collection-edit-route.tsx +7 -3
- package/src/routes/create-collection-history-route.tsx +8 -4
- package/src/routes/create-collection-list-route.tsx +3 -2
- package/src/routes/create-sign-in-route.tsx +9 -3
- package/src/routes/index.ts +11 -0
- package/src/routes/sign-in-path.test.node.ts +79 -0
- package/src/routes/sign-in-path.ts +36 -0
- package/src/server-fns/admin-account/change-password.ts +1 -1
- package/src/server-fns/admin-account/get.ts +1 -1
- package/src/server-fns/admin-account/update.ts +1 -1
- package/src/server-fns/admin-activity/get.ts +1 -1
- package/src/server-fns/admin-permissions/get-role-abilities.ts +1 -1
- package/src/server-fns/admin-permissions/list-registered.ts +1 -1
- package/src/server-fns/admin-permissions/set-role-abilities.ts +1 -1
- package/src/server-fns/admin-permissions/who-has.ts +1 -1
- package/src/server-fns/admin-roles/create.ts +1 -1
- package/src/server-fns/admin-roles/delete.ts +1 -1
- package/src/server-fns/admin-roles/get.ts +1 -1
- package/src/server-fns/admin-roles/list.ts +1 -1
- package/src/server-fns/admin-roles/reorder.ts +1 -1
- package/src/server-fns/admin-roles/update.ts +1 -1
- package/src/server-fns/admin-users/create.ts +1 -1
- package/src/server-fns/admin-users/delete.ts +1 -1
- package/src/server-fns/admin-users/disable.ts +1 -1
- package/src/server-fns/admin-users/enable.ts +1 -1
- package/src/server-fns/admin-users/get-user-roles.ts +1 -1
- package/src/server-fns/admin-users/get.ts +1 -1
- package/src/server-fns/admin-users/list.ts +1 -1
- package/src/server-fns/admin-users/set-password.ts +1 -1
- package/src/server-fns/admin-users/set-user-roles.ts +1 -1
- package/src/server-fns/admin-users/update.ts +1 -1
- package/src/server-fns/ai/execute.ts +1 -2
- package/src/server-fns/auth/current-user.ts +1 -1
- package/src/server-fns/auth/sign-in.ts +1 -1
- package/src/server-fns/auth/sign-out.ts +5 -3
- package/src/server-fns/collections/audit.ts +1 -1
- package/src/server-fns/collections/copy-to-locale.ts +1 -1
- package/src/server-fns/collections/create.ts +1 -1
- package/src/server-fns/collections/delete-locale.ts +1 -1
- package/src/server-fns/collections/delete-outcome.test.node.ts +72 -0
- package/src/server-fns/collections/delete-outcome.ts +80 -0
- package/src/server-fns/collections/delete.ts +3 -2
- package/src/server-fns/collections/duplicate.ts +1 -1
- package/src/server-fns/collections/get.ts +3 -1
- package/src/server-fns/collections/history.ts +1 -1
- package/src/server-fns/collections/index.ts +1 -0
- package/src/server-fns/collections/list.ts +1 -1
- package/src/server-fns/collections/reindex.ts +1 -1
- package/src/server-fns/collections/reorder.ts +1 -1
- package/src/server-fns/collections/restore-version.ts +1 -1
- package/src/server-fns/collections/stats.ts +2 -1
- package/src/server-fns/collections/status.ts +1 -1
- package/src/server-fns/collections/tree-mutation.test.node.ts +225 -0
- package/src/server-fns/collections/tree-mutation.ts +165 -0
- package/src/server-fns/collections/tree-read.test.node.ts +46 -0
- package/src/server-fns/collections/tree-read.ts +26 -0
- package/src/server-fns/collections/tree.ts +27 -11
- package/src/server-fns/collections/update.ts +4 -1
- package/src/server-fns/collections/upload.ts +1 -1
- package/src/server-fns/i18n/set-locale.ts +1 -1
- package/src/server-fns/preview/disable.ts +1 -1
- package/src/server-fns/preview/enable.ts +1 -2
- package/src/server-fns/preview/state.ts +1 -1
- package/src/vite/client-hook-boundary.test.node.ts +50 -0
- package/src/vite/client-hook-boundary.ts +45 -0
- package/src/vite/index.ts +9 -0
- package/dist/auth/auth-context.d.ts +0 -37
- package/dist/auth/auth-context.js +0 -57
- package/dist/auth/auth-cookies.d.ts +0 -34
- package/dist/auth/auth-cookies.js +0 -46
- package/dist/auth/preview-cookies.d.ts +0 -19
- package/dist/auth/preview-cookies.js +0 -26
- package/dist/integrations/byline-client.d.ts +0 -24
- package/dist/integrations/byline-client.js +0 -25
- package/dist/integrations/byline-public-client.js +0 -15
- package/dist/integrations/byline-viewer-client.d.ts +0 -20
- package/dist/integrations/byline-viewer-client.js +0 -39
- package/src/auth/auth-context.test.node.ts +0 -215
- package/src/auth/auth-context.ts +0 -124
- package/src/auth/auth-cookies.ts +0 -113
- package/src/auth/preview-cookies.ts +0 -73
- package/src/integrations/byline-client.ts +0 -66
- package/src/integrations/byline-public-client.ts +0 -53
- package/src/integrations/byline-viewer-client.ts +0 -99
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "4.1.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -89,10 +89,6 @@
|
|
|
89
89
|
"types": "./dist/server-fns/*.d.ts",
|
|
90
90
|
"import": "./dist/server-fns/*.js"
|
|
91
91
|
},
|
|
92
|
-
"./auth/*": {
|
|
93
|
-
"types": "./dist/auth/*.d.ts",
|
|
94
|
-
"import": "./dist/auth/*.js"
|
|
95
|
-
},
|
|
96
92
|
"./integrations/*": {
|
|
97
93
|
"types": "./dist/integrations/*.d.ts",
|
|
98
94
|
"import": "./dist/integrations/*.js"
|
|
@@ -108,6 +104,10 @@
|
|
|
108
104
|
"./routes/*": {
|
|
109
105
|
"types": "./dist/routes/*.d.ts",
|
|
110
106
|
"import": "./dist/routes/*.js"
|
|
107
|
+
},
|
|
108
|
+
"./vite": {
|
|
109
|
+
"types": "./dist/vite/index.d.ts",
|
|
110
|
+
"import": "./dist/vite/index.js"
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
@@ -117,21 +117,21 @@
|
|
|
117
117
|
"npm-run-all": "^4.1.5",
|
|
118
118
|
"react-json-view-lite": "^2.5.0",
|
|
119
119
|
"react-swipeable": "^7.0.2",
|
|
120
|
-
"uuid": "^14.0.1",
|
|
121
120
|
"zod": "^4.4.3",
|
|
122
|
-
"@byline/
|
|
123
|
-
"@byline/
|
|
124
|
-
"@byline/
|
|
125
|
-
"@byline/
|
|
126
|
-
"@byline/
|
|
127
|
-
"@byline/ui": "
|
|
128
|
-
"@byline/
|
|
121
|
+
"@byline/ai": "4.1.0",
|
|
122
|
+
"@byline/admin": "4.1.0",
|
|
123
|
+
"@byline/auth": "4.1.0",
|
|
124
|
+
"@byline/client": "4.1.0",
|
|
125
|
+
"@byline/i18n": "4.1.0",
|
|
126
|
+
"@byline/ui": "4.1.0",
|
|
127
|
+
"@byline/core": "4.1.0"
|
|
129
128
|
},
|
|
130
129
|
"peerDependencies": {
|
|
131
130
|
"@tanstack/react-router": "^1.167.0",
|
|
132
131
|
"@tanstack/react-start": "^1.167.0",
|
|
133
132
|
"react": "^19.0.0",
|
|
134
|
-
"react-dom": "^19.0.0"
|
|
133
|
+
"react-dom": "^19.0.0",
|
|
134
|
+
"vite": "^8.0.0"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@biomejs/biome": "2.5.2",
|
|
@@ -148,6 +148,7 @@
|
|
|
148
148
|
"rimraf": "^6.1.3",
|
|
149
149
|
"typescript": "^7.0.2",
|
|
150
150
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
151
|
+
"vite": "^8.1.3",
|
|
151
152
|
"vitest": "^4.1.10"
|
|
152
153
|
},
|
|
153
154
|
"publishConfig": {
|
|
@@ -15,6 +15,7 @@ import { useTranslation } from '@byline/i18n/react'
|
|
|
15
15
|
import { Button, Container, Section, Select, Table } from '@byline/ui/react'
|
|
16
16
|
import cx from 'classnames'
|
|
17
17
|
|
|
18
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
18
19
|
import { Link, useNavigate } from '../chrome/loose-router.js'
|
|
19
20
|
import { RouterPager } from '../chrome/router-pager.js'
|
|
20
21
|
import styles from './list.module.css'
|
|
@@ -33,6 +34,10 @@ const ACTION_KEYS: Record<string, string> = {
|
|
|
33
34
|
'document.locales.changed': 'activity.actions.localesChanged',
|
|
34
35
|
'document.status.changed': 'activity.actions.statusChanged',
|
|
35
36
|
'document.deleted': 'activity.actions.deleted',
|
|
37
|
+
'document.tree.placed': 'activity.actions.treePlaced',
|
|
38
|
+
'document.tree.reparented': 'activity.actions.treeReparented',
|
|
39
|
+
'document.tree.reordered': 'activity.actions.treeReordered',
|
|
40
|
+
'document.tree.removed': 'activity.actions.treeRemoved',
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
/** The selectable action types, in display order. `_all` clears the filter. */
|
|
@@ -43,12 +48,17 @@ const ACTION_FILTER_VALUES = [
|
|
|
43
48
|
'document.path.changed',
|
|
44
49
|
'document.locales.changed',
|
|
45
50
|
'document.deleted',
|
|
51
|
+
'document.tree.placed',
|
|
52
|
+
'document.tree.reparented',
|
|
53
|
+
'document.tree.reordered',
|
|
54
|
+
'document.tree.removed',
|
|
46
55
|
] as const
|
|
47
56
|
|
|
48
57
|
/** Render an audit before/after value inline: arrays comma-join, nullish → em-dash. */
|
|
49
58
|
function formatAuditValue(value: unknown): string {
|
|
50
59
|
if (value == null) return '—'
|
|
51
60
|
if (Array.isArray(value)) return value.length > 0 ? value.join(', ') : '—'
|
|
61
|
+
if (typeof value === 'object') return JSON.stringify(value)
|
|
52
62
|
return String(value)
|
|
53
63
|
}
|
|
54
64
|
|
|
@@ -81,7 +91,7 @@ export const ActivitySystemView = ({ data }: { data: SystemActivityResponse }) =
|
|
|
81
91
|
} else {
|
|
82
92
|
params[key] = value
|
|
83
93
|
}
|
|
84
|
-
navigate({ to: '
|
|
94
|
+
navigate({ to: getAdminRoutePath('activity'), search: params })
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
const collectionItems = [
|
|
@@ -134,7 +144,7 @@ export const ActivitySystemView = ({ data }: { data: SystemActivityResponse }) =
|
|
|
134
144
|
<Button
|
|
135
145
|
size="sm"
|
|
136
146
|
variant="text"
|
|
137
|
-
onClick={() => navigate({ to: '
|
|
147
|
+
onClick={() => navigate({ to: getAdminRoutePath('activity'), search: {} })}
|
|
138
148
|
>
|
|
139
149
|
{t('activity.filters.clear')}
|
|
140
150
|
</Button>
|
|
@@ -190,7 +200,7 @@ export const ActivitySystemView = ({ data }: { data: SystemActivityResponse }) =
|
|
|
190
200
|
<Table.Cell>
|
|
191
201
|
{col != null && entry.documentId != null ? (
|
|
192
202
|
<Link
|
|
193
|
-
to={'
|
|
203
|
+
to={getAdminRoutePath('collections', '$collection', '$id')}
|
|
194
204
|
params={{ collection: col.path, id: entry.documentId }}
|
|
195
205
|
>
|
|
196
206
|
{collectionLabel}
|
|
@@ -24,6 +24,7 @@ import { useTranslation } from '@byline/i18n/react'
|
|
|
24
24
|
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui/react'
|
|
25
25
|
import cx from 'classnames'
|
|
26
26
|
|
|
27
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
27
28
|
import { type AdminRoleResponse, deleteAdminRole } from '../../server-fns/admin-roles/index.js'
|
|
28
29
|
import { useNavigate } from '../chrome/loose-router.js'
|
|
29
30
|
import styles from './delete.module.css'
|
|
@@ -52,7 +53,7 @@ export function DeleteRole({ role, onClose }: DeleteRoleProps) {
|
|
|
52
53
|
// forced to re-fetch — without this, TanStack Router can serve
|
|
53
54
|
// the cached pre-delete list.
|
|
54
55
|
await router.invalidate()
|
|
55
|
-
navigate({ to: '
|
|
56
|
+
navigate({ to: getAdminRoutePath('roles') })
|
|
56
57
|
} catch (err) {
|
|
57
58
|
const code = getErrorCode(err)
|
|
58
59
|
if (code === 'admin.roles.versionConflict') {
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
} from '@byline/ui/react'
|
|
47
47
|
import cx from 'classnames'
|
|
48
48
|
|
|
49
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
49
50
|
import { reorderAdminRoles } from '../../server-fns/admin-roles/reorder.js'
|
|
50
51
|
import { Link } from '../chrome/loose-router.js'
|
|
51
52
|
import { formatNumber } from '../chrome/utils.js'
|
|
@@ -97,7 +98,7 @@ const DraggableRow: React.FC<DraggableRowProps> = ({ item, disabled }) => {
|
|
|
97
98
|
</div>
|
|
98
99
|
</Table.Cell>
|
|
99
100
|
<Table.Cell>
|
|
100
|
-
<Link to={'
|
|
101
|
+
<Link to={getAdminRoutePath('roles', '$id')} params={{ id: item.id }}>
|
|
101
102
|
{item.name}
|
|
102
103
|
</Link>
|
|
103
104
|
</Table.Cell>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* component only lays out the content + action row — the modal header
|
|
16
16
|
* and dismiss button are already drawn by the container.
|
|
17
17
|
*
|
|
18
|
-
* On success we navigate
|
|
18
|
+
* On success we navigate back to the configured admin users list; the record that hosts
|
|
19
19
|
* this view no longer exists. The `onSuccess` callback on `PanelProps`
|
|
20
20
|
* is unused here because `delete` produces no updated user.
|
|
21
21
|
*/
|
|
@@ -27,6 +27,7 @@ import { useTranslation } from '@byline/i18n/react'
|
|
|
27
27
|
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui/react'
|
|
28
28
|
import cx from 'classnames'
|
|
29
29
|
|
|
30
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
30
31
|
import { type AdminUserResponse, deleteAdminUser } from '../../server-fns/admin-users/index.js'
|
|
31
32
|
import { useNavigate } from '../chrome/loose-router.js'
|
|
32
33
|
import styles from './delete.module.css'
|
|
@@ -62,7 +63,7 @@ export function DeleteUser({ user, onClose }: DeleteUserProps) {
|
|
|
62
63
|
// forced to re-fetch — without this, TanStack Router can serve
|
|
63
64
|
// the cached pre-delete list.
|
|
64
65
|
await router.invalidate()
|
|
65
|
-
navigate({ to: '
|
|
66
|
+
navigate({ to: getAdminRoutePath('users') })
|
|
66
67
|
} catch (err) {
|
|
67
68
|
const code = getErrorCode(err)
|
|
68
69
|
if (code === 'admin.users.selfDeleteForbidden') {
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from '@byline/ui/react'
|
|
29
29
|
import cx from 'classnames'
|
|
30
30
|
|
|
31
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
31
32
|
import { Link, useNavigate } from '../chrome/loose-router.js'
|
|
32
33
|
import { RouterPager } from '../chrome/router-pager.js'
|
|
33
34
|
import {
|
|
@@ -45,7 +46,7 @@ import type {
|
|
|
45
46
|
// are fixed at module scope; the `label` field is filled in per-render
|
|
46
47
|
// inside the component so it can flow through `t(...)`. Same pattern the
|
|
47
48
|
// account container's `panels` map uses.
|
|
48
|
-
type ColumnTemplate = Omit<TableHeadingCellSortableProps, 'lng' | 'label'> & {
|
|
49
|
+
type ColumnTemplate = Omit<TableHeadingCellSortableProps, 'lng' | 'label' | 'path'> & {
|
|
49
50
|
labelKey: string
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -53,7 +54,6 @@ const columnTemplates: ColumnTemplate[] = [
|
|
|
53
54
|
{
|
|
54
55
|
fieldName: 'given_name',
|
|
55
56
|
labelKey: 'adminUsers.list.columns.givenName',
|
|
56
|
-
path: '/admin/users',
|
|
57
57
|
sortable: true,
|
|
58
58
|
scope: 'col',
|
|
59
59
|
align: 'left',
|
|
@@ -62,7 +62,6 @@ const columnTemplates: ColumnTemplate[] = [
|
|
|
62
62
|
{
|
|
63
63
|
fieldName: 'family_name',
|
|
64
64
|
labelKey: 'adminUsers.list.columns.familyName',
|
|
65
|
-
path: '/admin/users',
|
|
66
65
|
sortable: true,
|
|
67
66
|
scope: 'col',
|
|
68
67
|
align: 'left',
|
|
@@ -71,7 +70,6 @@ const columnTemplates: ColumnTemplate[] = [
|
|
|
71
70
|
{
|
|
72
71
|
fieldName: 'email',
|
|
73
72
|
labelKey: 'adminUsers.list.columns.email',
|
|
74
|
-
path: '/admin/users',
|
|
75
73
|
sortable: true,
|
|
76
74
|
scope: 'col',
|
|
77
75
|
align: 'left',
|
|
@@ -80,7 +78,6 @@ const columnTemplates: ColumnTemplate[] = [
|
|
|
80
78
|
{
|
|
81
79
|
fieldName: 'updated_at',
|
|
82
80
|
labelKey: 'adminUsers.list.columns.updated',
|
|
83
|
-
path: '/admin/users',
|
|
84
81
|
sortable: true,
|
|
85
82
|
scope: 'col',
|
|
86
83
|
align: 'right',
|
|
@@ -89,7 +86,6 @@ const columnTemplates: ColumnTemplate[] = [
|
|
|
89
86
|
{
|
|
90
87
|
fieldName: 'created_at',
|
|
91
88
|
labelKey: 'adminUsers.list.columns.created',
|
|
92
|
-
path: '/admin/users',
|
|
93
89
|
sortable: true,
|
|
94
90
|
scope: 'col',
|
|
95
91
|
align: 'right',
|
|
@@ -136,7 +132,12 @@ export function AdminUsersListView({ data }: { data: AdminUserListResponse }) {
|
|
|
136
132
|
const [isCreateDrawerOpen, setIsCreateDrawerOpen] = useState(false)
|
|
137
133
|
|
|
138
134
|
const tableColumnDefs = useMemo(
|
|
139
|
-
() =>
|
|
135
|
+
() =>
|
|
136
|
+
columnTemplates.map(({ labelKey, ...rest }) => ({
|
|
137
|
+
...rest,
|
|
138
|
+
label: t(labelKey),
|
|
139
|
+
path: getAdminRoutePath('users'),
|
|
140
|
+
})),
|
|
140
141
|
[t]
|
|
141
142
|
)
|
|
142
143
|
|
|
@@ -232,7 +233,7 @@ export function AdminUsersListView({ data }: { data: AdminUserListResponse }) {
|
|
|
232
233
|
})}
|
|
233
234
|
>
|
|
234
235
|
<Table.Cell>
|
|
235
|
-
<Link to={'
|
|
236
|
+
<Link to={getAdminRoutePath('users', '$id')} params={{ id: user.id }}>
|
|
236
237
|
{user.given_name ?? (
|
|
237
238
|
<span
|
|
238
239
|
className={cx('muted byline-admin-users-list-not-set', styles.notSet)}
|
|
@@ -14,6 +14,7 @@ import { LanguageMenu, useTranslation } from '@byline/i18n/react'
|
|
|
14
14
|
import { Button } from '@byline/ui/react'
|
|
15
15
|
import cx from 'classnames'
|
|
16
16
|
|
|
17
|
+
import { getSignInRoutePath } from '../../routes/sign-in-path.js'
|
|
17
18
|
import { adminSignOut, type CurrentAdminUser } from '../../server-fns/auth/index.js'
|
|
18
19
|
import styles from './admin-app-bar.module.css'
|
|
19
20
|
import { AdminDrawerToggle } from './admin-drawer-toggle.js'
|
|
@@ -48,7 +49,7 @@ export function AdminAppBar({ user }: AdminAppBarProps) {
|
|
|
48
49
|
console.warn('sign-out request failed', err)
|
|
49
50
|
}
|
|
50
51
|
// Full-page navigation so the admin guard re-runs with cleared cookies.
|
|
51
|
-
window.location.assign(
|
|
52
|
+
window.location.assign(getSignInRoutePath())
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
return (
|
|
@@ -27,6 +27,11 @@ import cx from 'classnames'
|
|
|
27
27
|
import { useSwipeable } from 'react-swipeable'
|
|
28
28
|
|
|
29
29
|
import { useAbilities } from '../../integrations/abilities.jsx'
|
|
30
|
+
import {
|
|
31
|
+
getAdminRoutePath,
|
|
32
|
+
isAdminRoutePathActive,
|
|
33
|
+
isRoutePathWithin,
|
|
34
|
+
} from '../../routes/admin-path.js'
|
|
30
35
|
import styles from './admin-menu-drawer.module.css'
|
|
31
36
|
import { useAdminMenu } from './admin-menu-provider.jsx'
|
|
32
37
|
import { Link } from './loose-router.js'
|
|
@@ -35,8 +40,8 @@ import { PreviewToggle } from './preview-toggle.jsx'
|
|
|
35
40
|
const isActive = (currentPath: string, linkHref: string): boolean => {
|
|
36
41
|
// Root admin highlights only on exact match so it doesn't stay lit on
|
|
37
42
|
// every admin subpath.
|
|
38
|
-
if (linkHref ===
|
|
39
|
-
return currentPath
|
|
43
|
+
if (linkHref === getAdminRoutePath()) return isAdminRoutePathActive(currentPath)
|
|
44
|
+
return isRoutePathWithin(currentPath, linkHref)
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
interface MenuItemProps {
|
|
@@ -119,7 +124,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
119
124
|
<nav className={cx('byline-admin-menu-drawer admin-menu-drawer', styles.nav)}>
|
|
120
125
|
<ul>
|
|
121
126
|
<MenuItem
|
|
122
|
-
to=
|
|
127
|
+
to={getAdminRoutePath()}
|
|
123
128
|
label={t('chrome.menu.dashboard')}
|
|
124
129
|
icon={<HomeIcon width="20px" height="20px" />}
|
|
125
130
|
pathname={pathname}
|
|
@@ -130,7 +135,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
130
135
|
<li className="menu-separator" />
|
|
131
136
|
{canReadUsers && (
|
|
132
137
|
<MenuItem
|
|
133
|
-
to=
|
|
138
|
+
to={getAdminRoutePath('users')}
|
|
134
139
|
label={t('chrome.menu.adminUsers')}
|
|
135
140
|
icon={<UsersIcon width="20px" height="20px" />}
|
|
136
141
|
pathname={pathname}
|
|
@@ -139,7 +144,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
139
144
|
)}
|
|
140
145
|
{canReadRoles && (
|
|
141
146
|
<MenuItem
|
|
142
|
-
to=
|
|
147
|
+
to={getAdminRoutePath('roles')}
|
|
143
148
|
label={t('chrome.menu.adminRoles')}
|
|
144
149
|
icon={<RolesIcon width="20px" height="20px" />}
|
|
145
150
|
pathname={pathname}
|
|
@@ -148,7 +153,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
148
153
|
)}
|
|
149
154
|
{canReadPermissions && (
|
|
150
155
|
<MenuItem
|
|
151
|
-
to=
|
|
156
|
+
to={getAdminRoutePath('permissions')}
|
|
152
157
|
label={t('chrome.menu.permissions')}
|
|
153
158
|
icon={<SettingsSlidersIcon width="20px" height="20px" />}
|
|
154
159
|
pathname={pathname}
|
|
@@ -157,7 +162,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
157
162
|
)}
|
|
158
163
|
{canReadActivity && (
|
|
159
164
|
<MenuItem
|
|
160
|
-
to=
|
|
165
|
+
to={getAdminRoutePath('activity')}
|
|
161
166
|
label={t('chrome.menu.activity')}
|
|
162
167
|
icon={<ActivityIcon width="20px" height="20px" />}
|
|
163
168
|
pathname={pathname}
|
|
@@ -169,7 +174,7 @@ export function AdminMenuDrawer(): React.JSX.Element | null {
|
|
|
169
174
|
<li className="menu-separator" />
|
|
170
175
|
<PreviewToggle compact={compact} />
|
|
171
176
|
<MenuItem
|
|
172
|
-
to=
|
|
177
|
+
to={getAdminRoutePath('account')}
|
|
173
178
|
label={t('chrome.account')}
|
|
174
179
|
icon={<UserIcon />}
|
|
175
180
|
pathname={pathname}
|
|
@@ -12,6 +12,7 @@ import type React from 'react'
|
|
|
12
12
|
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react'
|
|
13
13
|
import { useRouterState } from '@tanstack/react-router'
|
|
14
14
|
|
|
15
|
+
import { isAdminRoutePathActive } from '../../routes/admin-path.js'
|
|
15
16
|
import { useMediaQuery } from './use-media-query.js'
|
|
16
17
|
|
|
17
18
|
interface AdminMenuContextType {
|
|
@@ -37,7 +38,7 @@ interface AdminMenuProviderProps {
|
|
|
37
38
|
* deliberate open stays open.
|
|
38
39
|
*/
|
|
39
40
|
function isWideRoute(pathname: string): boolean {
|
|
40
|
-
return pathname
|
|
41
|
+
return isAdminRoutePathActive(pathname, 'collections')
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export function AdminMenuProvider({ children }: AdminMenuProviderProps): React.JSX.Element {
|
|
@@ -12,6 +12,7 @@ import { useTranslation } from '@byline/i18n/react'
|
|
|
12
12
|
import { Card, Container, Section } from '@byline/ui/react'
|
|
13
13
|
import cx from 'classnames'
|
|
14
14
|
|
|
15
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
15
16
|
import styles from './dashboard.module.css'
|
|
16
17
|
import { Link } from './loose-router.js'
|
|
17
18
|
import type { CollectionStatusCount } from '../../server-fns/collections/index.js'
|
|
@@ -42,7 +43,7 @@ function StatTile({
|
|
|
42
43
|
const modifier = tileModifier(ws.name)
|
|
43
44
|
return (
|
|
44
45
|
<Link
|
|
45
|
-
to={'
|
|
46
|
+
to={getAdminRoutePath('collections', '$collection')}
|
|
46
47
|
params={{ collection: collectionPath }}
|
|
47
48
|
search={{ status: ws.name }}
|
|
48
49
|
className={cx('byline-dashboard-stat-tile', styles.statTile, modifier.global, modifier.local)}
|
|
@@ -77,7 +78,7 @@ export function AdminDashboard({ statsMap }: AdminDashboardProps) {
|
|
|
77
78
|
return (
|
|
78
79
|
<Card key={collection.path}>
|
|
79
80
|
<Link
|
|
80
|
-
to={'
|
|
81
|
+
to={getAdminRoutePath('collections', '$collection')}
|
|
81
82
|
params={{ collection: collection.path }}
|
|
82
83
|
className={cx('byline-dashboard-card-link', styles.cardLink)}
|
|
83
84
|
>
|
|
@@ -114,7 +115,7 @@ export function AdminDashboard({ statsMap }: AdminDashboardProps) {
|
|
|
114
115
|
</div>
|
|
115
116
|
) : (
|
|
116
117
|
<Link
|
|
117
|
-
to={'
|
|
118
|
+
to={getAdminRoutePath('collections', '$collection')}
|
|
118
119
|
params={{ collection: collection.path }}
|
|
119
120
|
className={cx('byline-dashboard-empty-link', styles.emptyLink)}
|
|
120
121
|
>
|
|
@@ -19,7 +19,7 @@ import { setInterfaceLocaleFn } from '../../server-fns/i18n/index.js'
|
|
|
19
19
|
import styles from './sign-in-page.module.css'
|
|
20
20
|
|
|
21
21
|
interface SignInPageProps {
|
|
22
|
-
|
|
22
|
+
redirectTo: string
|
|
23
23
|
activeLocale: LocaleCode
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -44,7 +44,7 @@ interface SignInPageProps {
|
|
|
44
44
|
* the form's action row can render a plain "Home" link beside the submit
|
|
45
45
|
* button.
|
|
46
46
|
*/
|
|
47
|
-
export function SignInPage({
|
|
47
|
+
export function SignInPage({ redirectTo, activeLocale }: SignInPageProps) {
|
|
48
48
|
const { i18n, serverURL } = getClientConfig()
|
|
49
49
|
const localeDefinitions = buildLocaleDefinitions(
|
|
50
50
|
i18n.interface.locales,
|
|
@@ -68,7 +68,7 @@ export function SignInPage({ callbackUrl, activeLocale }: SignInPageProps) {
|
|
|
68
68
|
<LanguageMenu />
|
|
69
69
|
</div>
|
|
70
70
|
<div className={cx('byline-sign-in-page-inner', styles.inner)}>
|
|
71
|
-
<SignInForm
|
|
71
|
+
<SignInForm redirectTo={redirectTo} homeUrl={serverURL} />
|
|
72
72
|
</div>
|
|
73
73
|
</main>
|
|
74
74
|
</BylineAdminServicesProvider>
|
|
@@ -13,6 +13,7 @@ import type { CollectionAdminConfig, CollectionDefinition } from '@byline/core'
|
|
|
13
13
|
import { useTranslation } from '@byline/i18n/react'
|
|
14
14
|
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
15
15
|
|
|
16
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
16
17
|
import { createCollectionDocument } from '../../server-fns/collections/index.js'
|
|
17
18
|
import { useNavigate } from '../chrome/loose-router.js'
|
|
18
19
|
import { useTanStackNavigationGuard } from './tanstack-navigation-guard.js'
|
|
@@ -66,13 +67,13 @@ export const CreateView = ({
|
|
|
66
67
|
// doesn't return the new document's id.
|
|
67
68
|
if (result?.documentId) {
|
|
68
69
|
navigate({
|
|
69
|
-
to: '
|
|
70
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
70
71
|
params: { collection: path, id: result.documentId } as never,
|
|
71
72
|
search: { action: 'created' },
|
|
72
73
|
})
|
|
73
74
|
} else {
|
|
74
75
|
navigate({
|
|
75
|
-
to: '
|
|
76
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
76
77
|
params: { collection: path },
|
|
77
78
|
search: { action: 'created' },
|
|
78
79
|
})
|
|
@@ -117,7 +118,7 @@ export const CreateView = ({
|
|
|
117
118
|
useNavigationGuard={useTanStackNavigationGuard}
|
|
118
119
|
onCancel={() =>
|
|
119
120
|
navigate({
|
|
120
|
-
to: '
|
|
121
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
121
122
|
params: { collection: path },
|
|
122
123
|
})
|
|
123
124
|
}
|
|
@@ -52,12 +52,17 @@ const ACTION_KEYS: Record<string, string> = {
|
|
|
52
52
|
'document.locales.changed': 'collections.documentHistory.actionLocalesChanged',
|
|
53
53
|
'document.status.changed': 'collections.documentHistory.actionStatusChanged',
|
|
54
54
|
'document.deleted': 'collections.documentHistory.actionDeleted',
|
|
55
|
+
'document.tree.placed': 'collections.documentHistory.actionTreePlaced',
|
|
56
|
+
'document.tree.reparented': 'collections.documentHistory.actionTreeReparented',
|
|
57
|
+
'document.tree.reordered': 'collections.documentHistory.actionTreeReordered',
|
|
58
|
+
'document.tree.removed': 'collections.documentHistory.actionTreeRemoved',
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
/** Render an audit before/after value inline: arrays comma-join, nullish → em-dash. */
|
|
58
62
|
function formatAuditValue(value: unknown): string {
|
|
59
63
|
if (value == null) return '—'
|
|
60
64
|
if (Array.isArray(value)) return value.length > 0 ? value.join(', ') : '—'
|
|
65
|
+
if (typeof value === 'object') return JSON.stringify(value)
|
|
61
66
|
return String(value)
|
|
62
67
|
}
|
|
63
68
|
|
|
@@ -15,11 +15,13 @@ import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
|
15
15
|
import { useTranslation } from '@byline/i18n/react'
|
|
16
16
|
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
17
17
|
|
|
18
|
+
import { getAdminRoutePath } from '../../routes/admin-path.js'
|
|
18
19
|
import {
|
|
19
20
|
copyDocumentToLocale,
|
|
20
21
|
deleteDocument,
|
|
21
22
|
deleteDocumentLocale,
|
|
22
23
|
duplicateCollectionDocument,
|
|
24
|
+
hasDeleteSideEffectFailures,
|
|
23
25
|
unpublishDocument,
|
|
24
26
|
updateCollectionDocumentSystemFields,
|
|
25
27
|
updateCollectionDocumentWithPatches,
|
|
@@ -73,7 +75,7 @@ export const EditView = ({
|
|
|
73
75
|
|
|
74
76
|
const handleLocaleChange = (newLocale: string) => {
|
|
75
77
|
navigate({
|
|
76
|
-
to: '
|
|
78
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
77
79
|
params: { collection: path, id: String(initialData.id) },
|
|
78
80
|
search: { locale: newLocale },
|
|
79
81
|
})
|
|
@@ -98,7 +100,7 @@ export const EditView = ({
|
|
|
98
100
|
setEditState({ status: 'success', message: description })
|
|
99
101
|
// Refresh the page to reflect the new status.
|
|
100
102
|
navigate({
|
|
101
|
-
to: '
|
|
103
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
102
104
|
params: { collection: path, id: String(initialData.id) },
|
|
103
105
|
search: (prev: Record<string, unknown>) => ({ ...prev }),
|
|
104
106
|
})
|
|
@@ -149,7 +151,7 @@ export const EditView = ({
|
|
|
149
151
|
})
|
|
150
152
|
setEditState({ status: 'success', message: description })
|
|
151
153
|
navigate({
|
|
152
|
-
to: '
|
|
154
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
153
155
|
params: { collection: path, id: String(initialData.id) },
|
|
154
156
|
search: (prev: Record<string, unknown>) => ({ ...prev }),
|
|
155
157
|
})
|
|
@@ -196,7 +198,7 @@ export const EditView = ({
|
|
|
196
198
|
})
|
|
197
199
|
// Navigate to the new document's edit view.
|
|
198
200
|
navigate({
|
|
199
|
-
to: '
|
|
201
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
200
202
|
params: { collection: path, id: result.documentId },
|
|
201
203
|
})
|
|
202
204
|
} catch (err) {
|
|
@@ -270,7 +272,7 @@ export const EditView = ({
|
|
|
270
272
|
// Switch the form to the target locale so the editor sees the
|
|
271
273
|
// copied content immediately.
|
|
272
274
|
navigate({
|
|
273
|
-
to: '
|
|
275
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
274
276
|
params: { collection: path, id: String(initialData.id) },
|
|
275
277
|
search: { locale: targetLocale },
|
|
276
278
|
})
|
|
@@ -322,7 +324,7 @@ export const EditView = ({
|
|
|
322
324
|
// The deleted locale may be the one being viewed — land on the default
|
|
323
325
|
// locale (which always survives) so the loader re-fetches a valid view.
|
|
324
326
|
navigate({
|
|
325
|
-
to: '
|
|
327
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
326
328
|
params: { collection: path, id: String(initialData.id) },
|
|
327
329
|
search: { locale: defaultContentLocale },
|
|
328
330
|
})
|
|
@@ -347,14 +349,19 @@ export const EditView = ({
|
|
|
347
349
|
|
|
348
350
|
const handleDelete = async () => {
|
|
349
351
|
try {
|
|
350
|
-
await deleteDocument({
|
|
351
|
-
|
|
352
|
+
const result = await deleteDocument({
|
|
353
|
+
data: { collection: path, id: String(initialData.id) },
|
|
354
|
+
})
|
|
355
|
+
const hasSideEffectFailures = hasDeleteSideEffectFailures(result)
|
|
356
|
+
const description = hasSideEffectFailures
|
|
357
|
+
? t('collections.edit.deletedWithWarningsDescription', { label: singular })
|
|
358
|
+
: t('collections.edit.deletedDescription', { label: singular })
|
|
352
359
|
toastManager.add({
|
|
353
360
|
title: t('collections.edit.deleteTitle', { label: singular }),
|
|
354
361
|
description,
|
|
355
362
|
data: {
|
|
356
|
-
intent: 'success',
|
|
357
|
-
iconType: 'success',
|
|
363
|
+
intent: hasSideEffectFailures ? 'warning' : 'success',
|
|
364
|
+
iconType: hasSideEffectFailures ? 'warning' : 'success',
|
|
358
365
|
icon: true,
|
|
359
366
|
close: true,
|
|
360
367
|
},
|
|
@@ -362,7 +369,7 @@ export const EditView = ({
|
|
|
362
369
|
setEditState({ status: 'success', message: description })
|
|
363
370
|
// Navigate back to the collection list after deletion.
|
|
364
371
|
navigate({
|
|
365
|
-
to: '
|
|
372
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
366
373
|
params: { collection: path },
|
|
367
374
|
})
|
|
368
375
|
} catch (err) {
|
|
@@ -457,7 +464,7 @@ export const EditView = ({
|
|
|
457
464
|
// The new version will have a fresh version ID, draft status, and
|
|
458
465
|
// updated publishedVersion metadata.
|
|
459
466
|
navigate({
|
|
460
|
-
to: '
|
|
467
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
461
468
|
params: { collection: path, id: String(initialData.id) },
|
|
462
469
|
search: (prev: Record<string, unknown>) => ({ ...prev }),
|
|
463
470
|
})
|
|
@@ -524,7 +531,7 @@ export const EditView = ({
|
|
|
524
531
|
workflowStatuses={workflowStatuses}
|
|
525
532
|
onCancel={() =>
|
|
526
533
|
navigate({
|
|
527
|
-
to: '
|
|
534
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
528
535
|
params: { collection: path },
|
|
529
536
|
})
|
|
530
537
|
}
|