@byline/host-tanstack-start 3.21.0 → 4.0.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/auth/auth-context.d.ts +13 -0
- package/dist/auth/auth-context.js +4 -0
- package/dist/auth/request-scope.d.ts +16 -0
- package/dist/auth/request-scope.js +24 -0
- package/dist/integrations/abilities.js +8 -7
- package/dist/integrations/byline-public-client.d.ts +38 -0
- package/dist/integrations/byline-public-client.js +8 -4
- package/dist/integrations/byline-viewer-client.d.ts +6 -0
- package/dist/integrations/byline-viewer-client.js +22 -17
- 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/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 +2 -4
- package/dist/server-fns/collections/index.d.ts +1 -0
- package/dist/server-fns/collections/index.js +1 -0
- 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 +15 -12
- package/dist/server-fns/collections/update.js +2 -1
- package/dist/vite/client-hook-boundary.d.ts +19 -0
- package/dist/vite/client-hook-boundary.js +20 -0
- package/dist/vite/index.d.ts +8 -0
- package/dist/vite/index.js +1 -0
- package/package.json +15 -9
- 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/auth/auth-context.test.node.ts +87 -0
- package/src/auth/auth-context.ts +18 -0
- package/src/auth/request-scope.test.node.ts +93 -0
- package/src/auth/request-scope.ts +62 -0
- package/src/integrations/abilities.tsx +14 -4
- package/src/integrations/byline-client.ts +6 -4
- package/src/integrations/byline-public-client.ts +18 -4
- package/src/integrations/byline-viewer-client.ts +30 -18
- package/src/integrations/request-context-contract.test.node.ts +131 -0
- package/src/integrations/request-context-factories.test.node.ts +140 -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/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 +2 -1
- package/src/server-fns/collections/get.ts +2 -0
- package/src/server-fns/collections/index.ts +1 -0
- 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 +26 -10
- package/src/server-fns/collections/update.ts +3 -0
- 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
|
@@ -5,6 +5,7 @@ import { getClientConfig } from "@byline/core";
|
|
|
5
5
|
import { useTranslation } from "@byline/i18n/react";
|
|
6
6
|
import { Button, Container, Section, Select, Table } from "@byline/ui/react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
8
9
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
9
10
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
10
11
|
import list_module from "./list.module.js";
|
|
@@ -14,7 +15,11 @@ const ACTION_KEYS = {
|
|
|
14
15
|
'document.path.changed': 'activity.actions.pathChanged',
|
|
15
16
|
'document.locales.changed': 'activity.actions.localesChanged',
|
|
16
17
|
'document.status.changed': 'activity.actions.statusChanged',
|
|
17
|
-
'document.deleted': 'activity.actions.deleted'
|
|
18
|
+
'document.deleted': 'activity.actions.deleted',
|
|
19
|
+
'document.tree.placed': 'activity.actions.treePlaced',
|
|
20
|
+
'document.tree.reparented': 'activity.actions.treeReparented',
|
|
21
|
+
'document.tree.reordered': 'activity.actions.treeReordered',
|
|
22
|
+
'document.tree.removed': 'activity.actions.treeRemoved'
|
|
18
23
|
};
|
|
19
24
|
const ACTION_FILTER_VALUES = [
|
|
20
25
|
'document.created',
|
|
@@ -22,11 +27,16 @@ const ACTION_FILTER_VALUES = [
|
|
|
22
27
|
'document.status.changed',
|
|
23
28
|
'document.path.changed',
|
|
24
29
|
'document.locales.changed',
|
|
25
|
-
'document.deleted'
|
|
30
|
+
'document.deleted',
|
|
31
|
+
'document.tree.placed',
|
|
32
|
+
'document.tree.reparented',
|
|
33
|
+
'document.tree.reordered',
|
|
34
|
+
'document.tree.removed'
|
|
26
35
|
];
|
|
27
36
|
function formatAuditValue(value) {
|
|
28
37
|
if (null == value) return '—';
|
|
29
38
|
if (Array.isArray(value)) return value.length > 0 ? value.join(', ') : '—';
|
|
39
|
+
if ('object' == typeof value) return JSON.stringify(value);
|
|
30
40
|
return String(value);
|
|
31
41
|
}
|
|
32
42
|
const ActivitySystemView = ({ data })=>{
|
|
@@ -44,7 +54,7 @@ const ActivitySystemView = ({ data })=>{
|
|
|
44
54
|
if ('_all' === value) params[key] = void 0;
|
|
45
55
|
else params[key] = value;
|
|
46
56
|
navigate({
|
|
47
|
-
to: '
|
|
57
|
+
to: getAdminRoutePath('activity'),
|
|
48
58
|
search: params
|
|
49
59
|
});
|
|
50
60
|
};
|
|
@@ -106,7 +116,7 @@ const ActivitySystemView = ({ data })=>{
|
|
|
106
116
|
size: "sm",
|
|
107
117
|
variant: "text",
|
|
108
118
|
onClick: ()=>navigate({
|
|
109
|
-
to: '
|
|
119
|
+
to: getAdminRoutePath('activity'),
|
|
110
120
|
search: {}
|
|
111
121
|
}),
|
|
112
122
|
children: t('activity.filters.clear')
|
|
@@ -170,7 +180,7 @@ const ActivitySystemView = ({ data })=>{
|
|
|
170
180
|
}),
|
|
171
181
|
/*#__PURE__*/ jsx(Table.Cell, {
|
|
172
182
|
children: null != col && null != entry.documentId ? /*#__PURE__*/ jsx(Link, {
|
|
173
|
-
to: '
|
|
183
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
174
184
|
params: {
|
|
175
185
|
collection: col.path,
|
|
176
186
|
id: entry.documentId
|
|
@@ -5,6 +5,7 @@ import { useRouter } from "@tanstack/react-router";
|
|
|
5
5
|
import { useTranslation } from "@byline/i18n/react";
|
|
6
6
|
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui/react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
8
9
|
import { deleteAdminRole } from "../../server-fns/admin-roles/index.js";
|
|
9
10
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
10
11
|
import delete_module from "./delete.module.js";
|
|
@@ -28,7 +29,7 @@ function DeleteRole({ role, onClose }) {
|
|
|
28
29
|
onClose?.();
|
|
29
30
|
await router.invalidate();
|
|
30
31
|
navigate({
|
|
31
|
-
to: '
|
|
32
|
+
to: getAdminRoutePath('roles')
|
|
32
33
|
});
|
|
33
34
|
} catch (err) {
|
|
34
35
|
const code = getErrorCode(err);
|
|
@@ -7,6 +7,7 @@ import { LocalDateTime } from "@byline/admin/react";
|
|
|
7
7
|
import { useTranslation } from "@byline/i18n/react";
|
|
8
8
|
import { Button, CloseIcon, Container, DraggableSortable, Drawer, GripperVerticalIcon, IconButton, LoaderEllipsis, PlusIcon, Section, Table, moveItem, useSortable, useToastManager } from "@byline/ui/react";
|
|
9
9
|
import classnames from "classnames";
|
|
10
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
10
11
|
import { reorderAdminRoles } from "../../server-fns/admin-roles/reorder.js";
|
|
11
12
|
import { Link } from "../chrome/loose-router.js";
|
|
12
13
|
import { formatNumber } from "../chrome/utils.js";
|
|
@@ -46,7 +47,7 @@ const DraggableRow = ({ item, disabled })=>{
|
|
|
46
47
|
}),
|
|
47
48
|
/*#__PURE__*/ jsx(Table.Cell, {
|
|
48
49
|
children: /*#__PURE__*/ jsx(Link, {
|
|
49
|
-
to: '
|
|
50
|
+
to: getAdminRoutePath('roles', '$id'),
|
|
50
51
|
params: {
|
|
51
52
|
id: item.id
|
|
52
53
|
},
|
|
@@ -5,6 +5,7 @@ import { useRouter } from "@tanstack/react-router";
|
|
|
5
5
|
import { useTranslation } from "@byline/i18n/react";
|
|
6
6
|
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui/react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
8
9
|
import { deleteAdminUser } from "../../server-fns/admin-users/index.js";
|
|
9
10
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
10
11
|
import delete_module from "./delete.module.js";
|
|
@@ -35,7 +36,7 @@ function DeleteUser({ user, onClose }) {
|
|
|
35
36
|
onClose?.();
|
|
36
37
|
await router.invalidate();
|
|
37
38
|
navigate({
|
|
38
|
-
to: '
|
|
39
|
+
to: getAdminRoutePath('users')
|
|
39
40
|
});
|
|
40
41
|
} catch (err) {
|
|
41
42
|
const code = getErrorCode(err);
|
|
@@ -7,6 +7,7 @@ import { LocalDateTime } from "@byline/admin/react";
|
|
|
7
7
|
import { useTranslation } from "@byline/i18n/react";
|
|
8
8
|
import { CloseIcon, Container, Drawer, IconButton, PlusIcon, Search, Section, Select, Table, useToastManager } from "@byline/ui/react";
|
|
9
9
|
import classnames from "classnames";
|
|
10
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
10
11
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
11
12
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
12
13
|
import { TableHeadingCellSortable } from "../chrome/th-sortable.js";
|
|
@@ -16,7 +17,6 @@ const columnTemplates = [
|
|
|
16
17
|
{
|
|
17
18
|
fieldName: 'given_name',
|
|
18
19
|
labelKey: 'adminUsers.list.columns.givenName',
|
|
19
|
-
path: '/admin/users',
|
|
20
20
|
sortable: true,
|
|
21
21
|
scope: 'col',
|
|
22
22
|
align: 'left',
|
|
@@ -25,7 +25,6 @@ const columnTemplates = [
|
|
|
25
25
|
{
|
|
26
26
|
fieldName: 'family_name',
|
|
27
27
|
labelKey: 'adminUsers.list.columns.familyName',
|
|
28
|
-
path: '/admin/users',
|
|
29
28
|
sortable: true,
|
|
30
29
|
scope: 'col',
|
|
31
30
|
align: 'left',
|
|
@@ -34,7 +33,6 @@ const columnTemplates = [
|
|
|
34
33
|
{
|
|
35
34
|
fieldName: 'email',
|
|
36
35
|
labelKey: 'adminUsers.list.columns.email',
|
|
37
|
-
path: '/admin/users',
|
|
38
36
|
sortable: true,
|
|
39
37
|
scope: 'col',
|
|
40
38
|
align: 'left',
|
|
@@ -43,7 +41,6 @@ const columnTemplates = [
|
|
|
43
41
|
{
|
|
44
42
|
fieldName: 'updated_at',
|
|
45
43
|
labelKey: 'adminUsers.list.columns.updated',
|
|
46
|
-
path: '/admin/users',
|
|
47
44
|
sortable: true,
|
|
48
45
|
scope: 'col',
|
|
49
46
|
align: 'right',
|
|
@@ -52,7 +49,6 @@ const columnTemplates = [
|
|
|
52
49
|
{
|
|
53
50
|
fieldName: 'created_at',
|
|
54
51
|
labelKey: 'adminUsers.list.columns.created',
|
|
55
|
-
path: '/admin/users',
|
|
56
52
|
sortable: true,
|
|
57
53
|
scope: 'col',
|
|
58
54
|
align: 'right',
|
|
@@ -84,7 +80,8 @@ function AdminUsersListView({ data }) {
|
|
|
84
80
|
const [isCreateDrawerOpen, setIsCreateDrawerOpen] = useState(false);
|
|
85
81
|
const tableColumnDefs = useMemo(()=>columnTemplates.map(({ labelKey, ...rest })=>({
|
|
86
82
|
...rest,
|
|
87
|
-
label: t(labelKey)
|
|
83
|
+
label: t(labelKey),
|
|
84
|
+
path: getAdminRoutePath('users')
|
|
88
85
|
})), [
|
|
89
86
|
t
|
|
90
87
|
]);
|
|
@@ -201,7 +198,7 @@ function AdminUsersListView({ data }) {
|
|
|
201
198
|
children: [
|
|
202
199
|
/*#__PURE__*/ jsx(Table.Cell, {
|
|
203
200
|
children: /*#__PURE__*/ jsx(Link, {
|
|
204
|
-
to: '
|
|
201
|
+
to: getAdminRoutePath('users', '$id'),
|
|
205
202
|
params: {
|
|
206
203
|
id: user.id
|
|
207
204
|
},
|
|
@@ -4,6 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { LanguageMenu, useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { Button } from "@byline/ui/react";
|
|
6
6
|
import classnames from "classnames";
|
|
7
|
+
import { getSignInRoutePath } from "../../routes/sign-in-path.js";
|
|
7
8
|
import { adminSignOut } from "../../server-fns/auth/index.js";
|
|
8
9
|
import admin_app_bar_module from "./admin-app-bar.module.js";
|
|
9
10
|
import { AdminDrawerToggle } from "./admin-drawer-toggle.js";
|
|
@@ -29,7 +30,7 @@ function AdminAppBar({ user }) {
|
|
|
29
30
|
} catch (err) {
|
|
30
31
|
console.warn('sign-out request failed', err);
|
|
31
32
|
}
|
|
32
|
-
window.location.assign(
|
|
33
|
+
window.location.assign(getSignInRoutePath());
|
|
33
34
|
}
|
|
34
35
|
return /*#__PURE__*/ jsxs("header", {
|
|
35
36
|
className: classnames('byline-admin-app-bar', admin_app_bar_module.header),
|
|
@@ -9,13 +9,14 @@ import { ActivityIcon, HomeIcon, RolesIcon, SettingsSlidersIcon, Tooltip, UserIc
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import { useSwipeable } from "react-swipeable";
|
|
11
11
|
import { useAbilities } from "../../integrations/abilities.js";
|
|
12
|
+
import { getAdminRoutePath, isAdminRoutePathActive, isRoutePathWithin } from "../../routes/admin-path.js";
|
|
12
13
|
import admin_menu_drawer_module from "./admin-menu-drawer.module.js";
|
|
13
14
|
import { useAdminMenu } from "./admin-menu-provider.js";
|
|
14
15
|
import { Link } from "./loose-router.js";
|
|
15
16
|
import { PreviewToggle } from "./preview-toggle.js";
|
|
16
17
|
const isActive = (currentPath, linkHref)=>{
|
|
17
|
-
if (
|
|
18
|
-
return currentPath
|
|
18
|
+
if (linkHref === getAdminRoutePath()) return isAdminRoutePathActive(currentPath);
|
|
19
|
+
return isRoutePathWithin(currentPath, linkHref);
|
|
19
20
|
};
|
|
20
21
|
function MenuItem({ to, label, icon, pathname, compact }) {
|
|
21
22
|
const iconSpan = /*#__PURE__*/ jsx("span", {
|
|
@@ -84,7 +85,7 @@ function AdminMenuDrawer() {
|
|
|
84
85
|
children: /*#__PURE__*/ jsxs("ul", {
|
|
85
86
|
children: [
|
|
86
87
|
/*#__PURE__*/ jsx(MenuItem, {
|
|
87
|
-
to:
|
|
88
|
+
to: getAdminRoutePath(),
|
|
88
89
|
label: t('chrome.menu.dashboard'),
|
|
89
90
|
icon: /*#__PURE__*/ jsx(HomeIcon, {
|
|
90
91
|
width: "20px",
|
|
@@ -99,7 +100,7 @@ function AdminMenuDrawer() {
|
|
|
99
100
|
className: "menu-separator"
|
|
100
101
|
}),
|
|
101
102
|
canReadUsers && /*#__PURE__*/ jsx(MenuItem, {
|
|
102
|
-
to:
|
|
103
|
+
to: getAdminRoutePath('users'),
|
|
103
104
|
label: t('chrome.menu.adminUsers'),
|
|
104
105
|
icon: /*#__PURE__*/ jsx(UsersIcon, {
|
|
105
106
|
width: "20px",
|
|
@@ -109,7 +110,7 @@ function AdminMenuDrawer() {
|
|
|
109
110
|
compact: compact
|
|
110
111
|
}),
|
|
111
112
|
canReadRoles && /*#__PURE__*/ jsx(MenuItem, {
|
|
112
|
-
to:
|
|
113
|
+
to: getAdminRoutePath('roles'),
|
|
113
114
|
label: t('chrome.menu.adminRoles'),
|
|
114
115
|
icon: /*#__PURE__*/ jsx(RolesIcon, {
|
|
115
116
|
width: "20px",
|
|
@@ -119,7 +120,7 @@ function AdminMenuDrawer() {
|
|
|
119
120
|
compact: compact
|
|
120
121
|
}),
|
|
121
122
|
canReadPermissions && /*#__PURE__*/ jsx(MenuItem, {
|
|
122
|
-
to:
|
|
123
|
+
to: getAdminRoutePath('permissions'),
|
|
123
124
|
label: t('chrome.menu.permissions'),
|
|
124
125
|
icon: /*#__PURE__*/ jsx(SettingsSlidersIcon, {
|
|
125
126
|
width: "20px",
|
|
@@ -129,7 +130,7 @@ function AdminMenuDrawer() {
|
|
|
129
130
|
compact: compact
|
|
130
131
|
}),
|
|
131
132
|
canReadActivity && /*#__PURE__*/ jsx(MenuItem, {
|
|
132
|
-
to:
|
|
133
|
+
to: getAdminRoutePath('activity'),
|
|
133
134
|
label: t('chrome.menu.activity'),
|
|
134
135
|
icon: /*#__PURE__*/ jsx(ActivityIcon, {
|
|
135
136
|
width: "20px",
|
|
@@ -147,7 +148,7 @@ function AdminMenuDrawer() {
|
|
|
147
148
|
compact: compact
|
|
148
149
|
}),
|
|
149
150
|
/*#__PURE__*/ jsx(MenuItem, {
|
|
150
|
-
to:
|
|
151
|
+
to: getAdminRoutePath('account'),
|
|
151
152
|
label: t('chrome.account'),
|
|
152
153
|
icon: /*#__PURE__*/ jsx(UserIcon, {}),
|
|
153
154
|
pathname: pathname,
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { useRouterState } from "@tanstack/react-router";
|
|
5
|
+
import { isAdminRoutePathActive } from "../../routes/admin-path.js";
|
|
5
6
|
import { useMediaQuery } from "./use-media-query.js";
|
|
6
7
|
const MenuContext = /*#__PURE__*/ createContext(void 0);
|
|
7
8
|
function isWideRoute(pathname) {
|
|
8
|
-
return pathname
|
|
9
|
+
return isAdminRoutePathActive(pathname, 'collections');
|
|
9
10
|
}
|
|
10
11
|
function AdminMenuProvider({ children }) {
|
|
11
12
|
const pathname = useRouterState({
|
|
@@ -3,6 +3,7 @@ import { getClientConfig, getWorkflowStatuses } from "@byline/core";
|
|
|
3
3
|
import { useTranslation } from "@byline/i18n/react";
|
|
4
4
|
import { Card, Container, Section } from "@byline/ui/react";
|
|
5
5
|
import classnames from "classnames";
|
|
6
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
6
7
|
import dashboard_module from "./dashboard.module.js";
|
|
7
8
|
import { Link } from "./loose-router.js";
|
|
8
9
|
const TILE_MODIFIER = {
|
|
@@ -29,7 +30,7 @@ function tileModifier(name) {
|
|
|
29
30
|
function StatTile({ ws, count, collectionPath }) {
|
|
30
31
|
const modifier = tileModifier(ws.name);
|
|
31
32
|
return /*#__PURE__*/ jsxs(Link, {
|
|
32
|
-
to: '
|
|
33
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
33
34
|
params: {
|
|
34
35
|
collection: collectionPath
|
|
35
36
|
},
|
|
@@ -63,7 +64,7 @@ function AdminDashboard({ statsMap }) {
|
|
|
63
64
|
return /*#__PURE__*/ jsxs(Card, {
|
|
64
65
|
children: [
|
|
65
66
|
/*#__PURE__*/ jsx(Link, {
|
|
66
|
-
to: '
|
|
67
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
67
68
|
params: {
|
|
68
69
|
collection: collection.path
|
|
69
70
|
},
|
|
@@ -109,7 +110,7 @@ function AdminDashboard({ statsMap }) {
|
|
|
109
110
|
}, ws.name);
|
|
110
111
|
})
|
|
111
112
|
}) : /*#__PURE__*/ jsx(Link, {
|
|
112
|
-
to: '
|
|
113
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
113
114
|
params: {
|
|
114
115
|
collection: collection.path
|
|
115
116
|
},
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { LocaleCode } from '@byline/i18n';
|
|
9
9
|
interface SignInPageProps {
|
|
10
|
-
|
|
10
|
+
redirectTo: string;
|
|
11
11
|
activeLocale: LocaleCode;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -31,5 +31,5 @@ interface SignInPageProps {
|
|
|
31
31
|
* the form's action row can render a plain "Home" link beside the submit
|
|
32
32
|
* button.
|
|
33
33
|
*/
|
|
34
|
-
export declare function SignInPage({
|
|
34
|
+
export declare function SignInPage({ redirectTo, activeLocale }: SignInPageProps): import("react").JSX.Element;
|
|
35
35
|
export {};
|
|
@@ -8,7 +8,7 @@ import { buildLocaleDefinitions } from "../../i18n/locale-definitions.js";
|
|
|
8
8
|
import { bylineAdminServices } from "../../integrations/byline-admin-services.js";
|
|
9
9
|
import { setInterfaceLocaleFn } from "../../server-fns/i18n/index.js";
|
|
10
10
|
import sign_in_page_module from "./sign-in-page.module.js";
|
|
11
|
-
function SignInPage({
|
|
11
|
+
function SignInPage({ redirectTo, activeLocale }) {
|
|
12
12
|
const { i18n, serverURL } = getClientConfig();
|
|
13
13
|
const localeDefinitions = buildLocaleDefinitions(i18n.interface.locales, i18n.interface.localeDefinitions);
|
|
14
14
|
const handleSetLocale = async (next)=>{
|
|
@@ -37,7 +37,7 @@ function SignInPage({ callbackUrl, activeLocale }) {
|
|
|
37
37
|
/*#__PURE__*/ jsx("div", {
|
|
38
38
|
className: classnames('byline-sign-in-page-inner', sign_in_page_module.inner),
|
|
39
39
|
children: /*#__PURE__*/ jsx(SignInForm, {
|
|
40
|
-
|
|
40
|
+
redirectTo: redirectTo,
|
|
41
41
|
homeUrl: serverURL
|
|
42
42
|
})
|
|
43
43
|
})
|
|
@@ -3,6 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { FormRenderer } from "@byline/admin/react";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { Container, Section, useToastManager } from "@byline/ui/react";
|
|
6
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
6
7
|
import { createCollectionDocument } from "../../server-fns/collections/index.js";
|
|
7
8
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
8
9
|
import { useTanStackNavigationGuard } from "./tanstack-navigation-guard.js";
|
|
@@ -30,7 +31,7 @@ const CreateView = ({ collectionDefinition, adminConfig, initialData })=>{
|
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
result?.documentId ? navigate({
|
|
33
|
-
to: '
|
|
34
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
34
35
|
params: {
|
|
35
36
|
collection: path,
|
|
36
37
|
id: result.documentId
|
|
@@ -39,7 +40,7 @@ const CreateView = ({ collectionDefinition, adminConfig, initialData })=>{
|
|
|
39
40
|
action: 'created'
|
|
40
41
|
}
|
|
41
42
|
}) : navigate({
|
|
42
|
-
to: '
|
|
43
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
43
44
|
params: {
|
|
44
45
|
collection: path
|
|
45
46
|
},
|
|
@@ -84,7 +85,7 @@ const CreateView = ({ collectionDefinition, adminConfig, initialData })=>{
|
|
|
84
85
|
headingLabel: labels.singular,
|
|
85
86
|
useNavigationGuard: useTanStackNavigationGuard,
|
|
86
87
|
onCancel: ()=>navigate({
|
|
87
|
-
to: '
|
|
88
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
88
89
|
params: {
|
|
89
90
|
collection: path
|
|
90
91
|
}
|
|
@@ -7,11 +7,16 @@ const ACTION_KEYS = {
|
|
|
7
7
|
'document.path.changed': 'collections.documentHistory.actionPathChanged',
|
|
8
8
|
'document.locales.changed': 'collections.documentHistory.actionLocalesChanged',
|
|
9
9
|
'document.status.changed': 'collections.documentHistory.actionStatusChanged',
|
|
10
|
-
'document.deleted': 'collections.documentHistory.actionDeleted'
|
|
10
|
+
'document.deleted': 'collections.documentHistory.actionDeleted',
|
|
11
|
+
'document.tree.placed': 'collections.documentHistory.actionTreePlaced',
|
|
12
|
+
'document.tree.reparented': 'collections.documentHistory.actionTreeReparented',
|
|
13
|
+
'document.tree.reordered': 'collections.documentHistory.actionTreeReordered',
|
|
14
|
+
'document.tree.removed': 'collections.documentHistory.actionTreeRemoved'
|
|
11
15
|
};
|
|
12
16
|
function formatAuditValue(value) {
|
|
13
17
|
if (null == value) return '—';
|
|
14
18
|
if (Array.isArray(value)) return value.length > 0 ? value.join(', ') : '—';
|
|
19
|
+
if ('object' == typeof value) return JSON.stringify(value);
|
|
15
20
|
return String(value);
|
|
16
21
|
}
|
|
17
22
|
const DocumentHistoryView = ({ data })=>{
|
|
@@ -4,7 +4,8 @@ import { FormRenderer } from "@byline/admin/react";
|
|
|
4
4
|
import { getDefaultStatus, getWorkflowStatuses } from "@byline/core";
|
|
5
5
|
import { useTranslation } from "@byline/i18n/react";
|
|
6
6
|
import { Container, Section, useToastManager } from "@byline/ui/react";
|
|
7
|
-
import {
|
|
7
|
+
import { getAdminRoutePath } from "../../routes/admin-path.js";
|
|
8
|
+
import { copyDocumentToLocale, deleteDocument, deleteDocumentLocale, duplicateCollectionDocument, hasDeleteSideEffectFailures, unpublishDocument, updateCollectionDocumentSystemFields, updateCollectionDocumentWithPatches, updateDocumentStatus } from "../../server-fns/collections/index.js";
|
|
8
9
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
9
10
|
import { useTanStackNavigationGuard } from "./tanstack-navigation-guard.js";
|
|
10
11
|
import { ViewMenu } from "./view-menu.js";
|
|
@@ -25,7 +26,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
25
26
|
const nextStatus = -1 !== currentIndex && currentIndex < workflowStatuses.length - 1 ? workflowStatuses[currentIndex + 1] : void 0;
|
|
26
27
|
const handleLocaleChange = (newLocale)=>{
|
|
27
28
|
navigate({
|
|
28
|
-
to: '
|
|
29
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
29
30
|
params: {
|
|
30
31
|
collection: path,
|
|
31
32
|
id: String(initialData.id)
|
|
@@ -64,7 +65,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
64
65
|
message: description
|
|
65
66
|
});
|
|
66
67
|
navigate({
|
|
67
|
-
to: '
|
|
68
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
68
69
|
params: {
|
|
69
70
|
collection: path,
|
|
70
71
|
id: String(initialData.id)
|
|
@@ -124,7 +125,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
124
125
|
message: description
|
|
125
126
|
});
|
|
126
127
|
navigate({
|
|
127
|
-
to: '
|
|
128
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
128
129
|
params: {
|
|
129
130
|
collection: path,
|
|
130
131
|
id: String(initialData.id)
|
|
@@ -188,7 +189,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
188
189
|
})
|
|
189
190
|
});
|
|
190
191
|
navigate({
|
|
191
|
-
to: '
|
|
192
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
192
193
|
params: {
|
|
193
194
|
collection: path,
|
|
194
195
|
id: result.documentId
|
|
@@ -258,7 +259,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
258
259
|
})
|
|
259
260
|
});
|
|
260
261
|
navigate({
|
|
261
|
-
to: '
|
|
262
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
262
263
|
params: {
|
|
263
264
|
collection: path,
|
|
264
265
|
id: String(initialData.id)
|
|
@@ -321,7 +322,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
321
322
|
message: description
|
|
322
323
|
});
|
|
323
324
|
navigate({
|
|
324
|
-
to: '
|
|
325
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
325
326
|
params: {
|
|
326
327
|
collection: path,
|
|
327
328
|
id: String(initialData.id)
|
|
@@ -355,13 +356,16 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
355
356
|
};
|
|
356
357
|
const handleDelete = async ()=>{
|
|
357
358
|
try {
|
|
358
|
-
await deleteDocument({
|
|
359
|
+
const result = await deleteDocument({
|
|
359
360
|
data: {
|
|
360
361
|
collection: path,
|
|
361
362
|
id: String(initialData.id)
|
|
362
363
|
}
|
|
363
364
|
});
|
|
364
|
-
const
|
|
365
|
+
const hasSideEffectFailures = hasDeleteSideEffectFailures(result);
|
|
366
|
+
const description = hasSideEffectFailures ? t("collections.edit.deletedWithWarningsDescription", {
|
|
367
|
+
label: singular
|
|
368
|
+
}) : t("collections.edit.deletedDescription", {
|
|
365
369
|
label: singular
|
|
366
370
|
});
|
|
367
371
|
toastManager.add({
|
|
@@ -370,8 +374,8 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
370
374
|
}),
|
|
371
375
|
description,
|
|
372
376
|
data: {
|
|
373
|
-
intent: 'success',
|
|
374
|
-
iconType: 'success',
|
|
377
|
+
intent: hasSideEffectFailures ? 'warning' : 'success',
|
|
378
|
+
iconType: hasSideEffectFailures ? 'warning' : 'success',
|
|
375
379
|
icon: true,
|
|
376
380
|
close: true
|
|
377
381
|
}
|
|
@@ -381,7 +385,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
381
385
|
message: description
|
|
382
386
|
});
|
|
383
387
|
navigate({
|
|
384
|
-
to: '
|
|
388
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
385
389
|
params: {
|
|
386
390
|
collection: path
|
|
387
391
|
}
|
|
@@ -453,7 +457,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
453
457
|
message: description
|
|
454
458
|
});
|
|
455
459
|
navigate({
|
|
456
|
-
to: '
|
|
460
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
457
461
|
params: {
|
|
458
462
|
collection: path,
|
|
459
463
|
id: String(initialData.id)
|
|
@@ -523,7 +527,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
523
527
|
nextStatus: nextStatus,
|
|
524
528
|
workflowStatuses: workflowStatuses,
|
|
525
529
|
onCancel: ()=>navigate({
|
|
526
|
-
to: '
|
|
530
|
+
to: getAdminRoutePath('collections', '$collection'),
|
|
527
531
|
params: {
|
|
528
532
|
collection: path
|
|
529
533
|
}
|
|
@@ -6,6 +6,7 @@ import { useBylineAdminServices } from "@byline/admin/services";
|
|
|
6
6
|
import { useTranslation } from "@byline/i18n/react";
|
|
7
7
|
import { Button, CloseIcon, Container, IconButton, Modal, Section, Select, Table } from "@byline/ui/react";
|
|
8
8
|
import classnames from "classnames";
|
|
9
|
+
import { getAdminRouteId, getAdminRoutePath } from "../../routes/admin-path.js";
|
|
9
10
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
10
11
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
11
12
|
import { TableHeadingCellSortable } from "../chrome/th-sortable.js";
|
|
@@ -53,7 +54,7 @@ const AUDIT_ACTION_KEYS = {
|
|
|
53
54
|
};
|
|
54
55
|
const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workflowStatuses, currentDocument, contentLocales, defaultContentLocale })=>{
|
|
55
56
|
const { id, collection } = useParams({
|
|
56
|
-
from: '
|
|
57
|
+
from: getAdminRouteId('collections', '$collection', '$id', 'history')
|
|
57
58
|
});
|
|
58
59
|
const navigate = useNavigate();
|
|
59
60
|
const { getCollectionDocumentVersion } = useBylineAdminServices();
|
|
@@ -75,7 +76,7 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workfl
|
|
|
75
76
|
if ('document' === name) params.tab = 'document';
|
|
76
77
|
else delete params.tab;
|
|
77
78
|
navigate({
|
|
78
|
-
to: '
|
|
79
|
+
to: getAdminRoutePath('collections', '$collection', '$id', 'history'),
|
|
79
80
|
params: {
|
|
80
81
|
collection,
|
|
81
82
|
id
|
|
@@ -89,7 +90,7 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workfl
|
|
|
89
90
|
delete params.page;
|
|
90
91
|
params.page_size = Number.parseInt(value, 10);
|
|
91
92
|
navigate({
|
|
92
|
-
to: '
|
|
93
|
+
to: getAdminRoutePath('collections', '$collection', '$id', 'history'),
|
|
93
94
|
params: {
|
|
94
95
|
collection,
|
|
95
96
|
id
|
|
@@ -252,7 +253,7 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workfl
|
|
|
252
253
|
}),
|
|
253
254
|
children: column.formatter ? renderFormatted(getColumnValue(document, column.fieldName), document, column.formatter) : resolveDisplayValue(getColumnValue(document, column.fieldName), locale, defaultContentLocale) || '------'
|
|
254
255
|
}) : /*#__PURE__*/ jsx(Link, {
|
|
255
|
-
to: '
|
|
256
|
+
to: getAdminRoutePath('collections', '$collection', '$id'),
|
|
256
257
|
params: {
|
|
257
258
|
collection,
|
|
258
259
|
id: document.id
|