@byline/host-tanstack-start 1.1.0 → 1.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/dist/admin-shell/admin-roles/container.js +1 -2
- package/dist/admin-shell/admin-roles/delete.js +1 -1
- package/dist/admin-shell/admin-roles/list.js +1 -2
- package/dist/admin-shell/admin-users/container.js +1 -2
- package/dist/admin-shell/admin-users/delete.js +1 -1
- package/dist/admin-shell/admin-users/list.js +1 -2
- package/dist/admin-shell/chrome/admin-app-bar.js +1 -1
- package/dist/admin-shell/chrome/dashboard.js +1 -1
- package/dist/admin-shell/chrome/drawer-toggle.js +1 -1
- package/dist/admin-shell/chrome/menu-drawer.js +1 -1
- package/dist/admin-shell/chrome/preview-toggle.js +1 -1
- package/dist/admin-shell/chrome/route-error.js +1 -1
- package/dist/admin-shell/chrome/router-pager.d.ts +1 -1
- package/dist/admin-shell/chrome/router-pager.js +1 -1
- package/dist/admin-shell/chrome/th-sortable.js +1 -1
- package/dist/admin-shell/collections/api.js +1 -1
- package/dist/admin-shell/collections/create.js +1 -2
- package/dist/admin-shell/collections/edit.js +1 -2
- package/dist/admin-shell/collections/history.js +82 -6
- package/dist/admin-shell/collections/history.module.js +5 -0
- package/dist/admin-shell/collections/history_module.css +46 -0
- package/dist/admin-shell/collections/list.js +1 -2
- package/dist/admin-shell/collections/preview-link.js +1 -1
- package/dist/admin-shell/collections/restore-version-modal.d.ts +10 -0
- package/dist/admin-shell/collections/restore-version-modal.js +118 -0
- package/dist/admin-shell/collections/restore-version-modal.module.js +10 -0
- package/dist/admin-shell/collections/restore-version-modal_module.css +31 -0
- package/dist/admin-shell/collections/view-menu.js +1 -1
- package/dist/routes/create-admin-account-route.js +1 -2
- package/dist/routes/create-admin-role-edit-route.js +1 -1
- package/dist/routes/create-admin-user-edit-route.js +1 -1
- package/dist/routes/create-collection-list-route.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/restore-version.d.ts +21 -0
- package/dist/server-fns/collections/restore-version.js +41 -0
- package/package.json +10 -10
- package/src/admin-shell/admin-roles/container.tsx +1 -1
- package/src/admin-shell/admin-roles/delete.tsx +1 -1
- package/src/admin-shell/admin-roles/list.tsx +1 -1
- package/src/admin-shell/admin-users/container.tsx +1 -1
- package/src/admin-shell/admin-users/delete.tsx +1 -1
- package/src/admin-shell/admin-users/list.tsx +1 -1
- package/src/admin-shell/chrome/admin-app-bar.tsx +1 -1
- package/src/admin-shell/chrome/dashboard.tsx +1 -1
- package/src/admin-shell/chrome/drawer-toggle.tsx +1 -1
- package/src/admin-shell/chrome/menu-drawer.tsx +1 -1
- package/src/admin-shell/chrome/preview-toggle.tsx +1 -1
- package/src/admin-shell/chrome/route-error.tsx +1 -1
- package/src/admin-shell/chrome/router-pager.tsx +2 -2
- package/src/admin-shell/chrome/th-sortable.tsx +1 -1
- package/src/admin-shell/collections/api.tsx +1 -1
- package/src/admin-shell/collections/create.tsx +1 -1
- package/src/admin-shell/collections/edit.tsx +1 -1
- package/src/admin-shell/collections/history.module.css +50 -1
- package/src/admin-shell/collections/history.tsx +149 -67
- package/src/admin-shell/collections/list.tsx +1 -1
- package/src/admin-shell/collections/preview-link.tsx +1 -1
- package/src/admin-shell/collections/restore-version-modal.module.css +48 -0
- package/src/admin-shell/collections/restore-version-modal.tsx +131 -0
- package/src/admin-shell/collections/view-menu.tsx +1 -1
- package/src/routes/create-admin-account-route.tsx +1 -1
- package/src/routes/create-admin-role-edit-route.tsx +1 -1
- package/src/routes/create-admin-user-edit-route.tsx +1 -1
- package/src/routes/create-collection-list-route.tsx +1 -1
- package/src/server-fns/collections/index.ts +1 -0
- package/src/server-fns/collections/restore-version.ts +59 -0
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "@tanstack/react-router";
|
|
5
|
-
import { Button, CloseIcon, Drawer, IconButton, Modal, useToastManager } from "@byline/ui";
|
|
6
|
-
import { LocalDateTime, RolePermissions, UpdateRole } from "@byline/ui/react";
|
|
5
|
+
import { Button, CloseIcon, Drawer, IconButton, LocalDateTime, Modal, RolePermissions, UpdateRole, useToastManager } from "@byline/ui/react";
|
|
7
6
|
import classnames from "classnames";
|
|
8
7
|
import container_module from "./container.module.js";
|
|
9
8
|
import { DeleteRole } from "./delete.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "@tanstack/react-router";
|
|
5
|
-
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui";
|
|
5
|
+
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui/react";
|
|
6
6
|
import classnames from "classnames";
|
|
7
7
|
import { deleteAdminRole } from "../../server-fns/admin-roles/index.js";
|
|
8
8
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { useRouter } from "@tanstack/react-router";
|
|
5
|
-
import { Button, CloseIcon, Container, DraggableSortable, Drawer, GripperVerticalIcon, IconButton, LoaderEllipsis, PlusIcon, Section, Table, moveItem, useSortable, useToastManager } from "@byline/ui";
|
|
6
|
-
import { CreateAdminRole, LocalDateTime } from "@byline/ui/react";
|
|
5
|
+
import { Button, CloseIcon, Container, CreateAdminRole, DraggableSortable, Drawer, GripperVerticalIcon, IconButton, LoaderEllipsis, LocalDateTime, PlusIcon, Section, Table, moveItem, useSortable, useToastManager } from "@byline/ui/react";
|
|
7
6
|
import classnames from "classnames";
|
|
8
7
|
import { reorderAdminRoles } from "../../server-fns/admin-roles/reorder.js";
|
|
9
8
|
import { Link } from "../chrome/loose-router.js";
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "@tanstack/react-router";
|
|
5
|
-
import { Button, CloseIcon, Drawer, EditIcon, IconButton, Modal, useToastManager } from "@byline/ui";
|
|
6
|
-
import { LocalDateTime, SetPassword, UpdateUser, UserRoles } from "@byline/ui/react";
|
|
5
|
+
import { Button, CloseIcon, Drawer, EditIcon, IconButton, LocalDateTime, Modal, SetPassword, UpdateUser, UserRoles, useToastManager } from "@byline/ui/react";
|
|
7
6
|
import classnames from "classnames";
|
|
8
7
|
import container_module from "./container.module.js";
|
|
9
8
|
import { DeleteUser } from "./delete.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter } from "@tanstack/react-router";
|
|
5
|
-
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui";
|
|
5
|
+
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui/react";
|
|
6
6
|
import classnames from "classnames";
|
|
7
7
|
import { deleteAdminUser } from "../../server-fns/admin-users/index.js";
|
|
8
8
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useRouter, useRouterState } from "@tanstack/react-router";
|
|
5
|
-
import { CloseIcon, Container, Drawer, IconButton, PlusIcon, Search, Section, Select, Table, useToastManager } from "@byline/ui";
|
|
6
|
-
import { CreateAdminUser, LocalDateTime } from "@byline/ui/react";
|
|
5
|
+
import { CloseIcon, Container, CreateAdminUser, Drawer, IconButton, LocalDateTime, PlusIcon, Search, Section, Select, Table, useToastManager } from "@byline/ui/react";
|
|
7
6
|
import classnames from "classnames";
|
|
8
7
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
9
8
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { Button } from "@byline/ui";
|
|
4
|
+
import { Button } from "@byline/ui/react";
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import { adminSignOut } from "../../server-fns/auth/index.js";
|
|
7
7
|
import admin_app_bar_module from "./admin-app-bar.module.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getClientConfig, getWorkflowStatuses } from "@byline/core";
|
|
3
|
-
import { Card, Container, Section } from "@byline/ui";
|
|
3
|
+
import { Card, Container, Section } from "@byline/ui/react";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import dashboard_module from "./dashboard.module.js";
|
|
6
6
|
import { Link } from "./loose-router.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IconButton, Tooltip } from "@byline/ui";
|
|
2
|
+
import { IconButton, Tooltip } from "@byline/ui/react";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import drawer_toggle_module from "./drawer-toggle.module.js";
|
|
5
5
|
import { useAdminMenu } from "./menu-provider.js";
|
|
@@ -3,7 +3,7 @@ import { useRouterState } from "@tanstack/react-router";
|
|
|
3
3
|
import { ADMIN_PERMISSIONS_ABILITIES } from "@byline/admin/admin-permissions";
|
|
4
4
|
import { ADMIN_ROLES_ABILITIES } from "@byline/admin/admin-roles";
|
|
5
5
|
import { ADMIN_USERS_ABILITIES } from "@byline/admin/admin-users";
|
|
6
|
-
import { HomeIcon, RolesIcon, SettingsSlidersIcon, UserIcon, UsersIcon } from "@byline/ui";
|
|
6
|
+
import { HomeIcon, RolesIcon, SettingsSlidersIcon, UserIcon, UsersIcon } from "@byline/ui/react";
|
|
7
7
|
import classnames from "classnames";
|
|
8
8
|
import { useSwipeable } from "react-swipeable";
|
|
9
9
|
import { useAbilities } from "../../integrations/abilities.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import { EyeClosedIcon, EyeOpenIcon } from "@byline/ui";
|
|
3
|
+
import { EyeClosedIcon, EyeOpenIcon } from "@byline/ui/react";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { disablePreviewModeFn, enablePreviewModeFn, getPreviewStateFn } from "../../server-fns/preview/index.js";
|
|
6
6
|
function PreviewToggle({ compact }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRouter } from "@tanstack/react-router";
|
|
3
3
|
import { BylineError, ErrorCodes } from "@byline/core";
|
|
4
|
-
import { Alert, Button, Container, Section } from "@byline/ui";
|
|
4
|
+
import { Alert, Button, Container, Section } from "@byline/ui/react";
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import route_error_module from "./route-error.module.js";
|
|
7
7
|
const ERROR_TITLES = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRouterState } from "@tanstack/react-router";
|
|
3
|
-
import { ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, Pagination } from "@byline/ui";
|
|
3
|
+
import { ChevronLeftDoubleIcon, ChevronLeftIcon, ChevronRightDoubleIcon, ChevronRightIcon, Pagination } from "@byline/ui/react";
|
|
4
4
|
import { Link } from "./loose-router.js";
|
|
5
5
|
function RouterPager({ className, smoothScrollToTop, 'aria-label': ariaLabel, ...rest }) {
|
|
6
6
|
const location = useRouterState({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { Table } from "@byline/ui";
|
|
4
|
+
import { Table } from "@byline/ui/react";
|
|
5
5
|
import classnames from "classnames";
|
|
6
6
|
import { useNavigate } from "./loose-router.js";
|
|
7
7
|
import { SortAscendingIcon, SortDescendingIcon, SortNeutralIcon } from "./sort-icons.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Container, Section } from "@byline/ui";
|
|
2
|
+
import { Container, Section } from "@byline/ui/react";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { JsonView, allExpanded, darkStyles } from "react-json-view-lite";
|
|
5
5
|
import api_module from "./api.module.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Container, Section, useToastManager } from "@byline/ui";
|
|
4
|
-
import { FormRenderer } from "@byline/ui/react";
|
|
3
|
+
import { Container, FormRenderer, Section, useToastManager } from "@byline/ui/react";
|
|
5
4
|
import { createCollectionDocument } from "../../server-fns/collections/index.js";
|
|
6
5
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
7
6
|
import { useTanStackNavigationGuard } from "./tanstack-navigation-guard.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { getDefaultStatus, getWorkflowStatuses } from "@byline/core";
|
|
4
|
-
import { Container, Section, useToastManager } from "@byline/ui";
|
|
5
|
-
import { FormRenderer } from "@byline/ui/react";
|
|
4
|
+
import { Container, FormRenderer, Section, useToastManager } from "@byline/ui/react";
|
|
6
5
|
import { deleteDocument, unpublishDocument, updateCollectionDocumentWithPatches, updateDocumentStatus } from "../../server-fns/collections/index.js";
|
|
7
6
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
8
7
|
import { useTanStackNavigationGuard } from "./tanstack-navigation-guard.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, lazy, useState } from "react";
|
|
3
3
|
import { useParams, useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { Container, IconButton, Section, Select, Table } from "@byline/ui";
|
|
5
|
-
import { StatusBadge, renderFormatted } from "@byline/ui/react";
|
|
4
|
+
import { Button, CloseIcon, Container, IconButton, Modal, Section, Select, StatusBadge, Table, renderFormatted } from "@byline/ui/react";
|
|
6
5
|
import classnames from "classnames";
|
|
7
6
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
8
7
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
9
8
|
import { TableHeadingCellSortable } from "../chrome/th-sortable.js";
|
|
10
9
|
import { formatNumber } from "../chrome/utils.js";
|
|
11
10
|
import history_module from "./history.module.js";
|
|
11
|
+
import { RestoreVersionModal } from "./restore-version-modal.js";
|
|
12
12
|
import { ViewMenu } from "./view-menu.js";
|
|
13
13
|
function getColumnValue(document, fieldName) {
|
|
14
14
|
if (document.fields && fieldName in document.fields) return document.fields[fieldName];
|
|
@@ -52,6 +52,8 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, workflowStatuses
|
|
|
52
52
|
});
|
|
53
53
|
const locale = location.search.locale;
|
|
54
54
|
const [selectedVersion, setSelectedVersion] = useState(null);
|
|
55
|
+
const [restoreTarget, setRestoreTarget] = useState(null);
|
|
56
|
+
const currentVersionId = currentDocument && 'string' == typeof currentDocument.versionId ? currentDocument.versionId : null;
|
|
55
57
|
function handleOnPageSizeChange(value) {
|
|
56
58
|
if ('string' != typeof value || 0 === value.length) return;
|
|
57
59
|
const params = structuredClone(location.search);
|
|
@@ -120,14 +122,26 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, workflowStatuses
|
|
|
120
122
|
scope: "col",
|
|
121
123
|
className: classnames('byline-coll-history-col-version', history_module.colVersion)
|
|
122
124
|
}),
|
|
123
|
-
columns.
|
|
125
|
+
columns.flatMap((column)=>{
|
|
126
|
+
const cell = /*#__PURE__*/ jsx(TableHeadingCellSortable, {
|
|
124
127
|
fieldName: String(column.fieldName),
|
|
125
128
|
label: column.label,
|
|
126
129
|
sortable: column.sortable,
|
|
127
130
|
scope: "col",
|
|
128
131
|
align: column.align,
|
|
129
132
|
className: column.className
|
|
130
|
-
}, String(column.fieldName))
|
|
133
|
+
}, String(column.fieldName));
|
|
134
|
+
if ('title' === column.fieldName) return [
|
|
135
|
+
cell,
|
|
136
|
+
/*#__PURE__*/ jsx("th", {
|
|
137
|
+
scope: "col",
|
|
138
|
+
className: classnames('byline-coll-history-col-restore', history_module.colRestore)
|
|
139
|
+
}, "__restore")
|
|
140
|
+
];
|
|
141
|
+
return [
|
|
142
|
+
cell
|
|
143
|
+
];
|
|
144
|
+
})
|
|
131
145
|
]
|
|
132
146
|
})
|
|
133
147
|
}),
|
|
@@ -154,7 +168,8 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, workflowStatuses
|
|
|
154
168
|
children: versionNumber
|
|
155
169
|
}) : null
|
|
156
170
|
}),
|
|
157
|
-
columns.
|
|
171
|
+
columns.flatMap((column)=>{
|
|
172
|
+
const dataCell = /*#__PURE__*/ jsx(Table.Cell, {
|
|
158
173
|
className: classnames({
|
|
159
174
|
'byline-coll-history-cell-right': 'right' === column.align,
|
|
160
175
|
[history_module.cellRight]: 'right' === column.align,
|
|
@@ -180,7 +195,31 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, workflowStatuses
|
|
|
180
195
|
status: document.status,
|
|
181
196
|
workflowStatuses: workflowStatuses
|
|
182
197
|
}) : resolveDisplayValue(getColumnValue(document, column.fieldName), locale, defaultContentLocale) || ''
|
|
183
|
-
}, String(column.fieldName))
|
|
198
|
+
}, String(column.fieldName));
|
|
199
|
+
if ('title' === column.fieldName) return [
|
|
200
|
+
dataCell,
|
|
201
|
+
/*#__PURE__*/ jsx(Table.Cell, {
|
|
202
|
+
className: classnames('byline-coll-history-restore-cell', history_module.restoreCell),
|
|
203
|
+
children: versionId && versionId !== currentVersionId ? /*#__PURE__*/ jsx(Button, {
|
|
204
|
+
type: "button",
|
|
205
|
+
variant: "outlined",
|
|
206
|
+
size: "xs",
|
|
207
|
+
intent: "noeffect",
|
|
208
|
+
onClick: ()=>setRestoreTarget({
|
|
209
|
+
versionId,
|
|
210
|
+
label: new Date(document.createdAt).toLocaleString(),
|
|
211
|
+
versionNumber
|
|
212
|
+
}),
|
|
213
|
+
className: classnames('byline-coll-history-restore-button', history_module.restoreButton),
|
|
214
|
+
title: "Restore this version as the current draft",
|
|
215
|
+
children: "Restore"
|
|
216
|
+
}) : null
|
|
217
|
+
}, "__restore")
|
|
218
|
+
];
|
|
219
|
+
return [
|
|
220
|
+
dataCell
|
|
221
|
+
];
|
|
222
|
+
})
|
|
184
223
|
]
|
|
185
224
|
}, versionId ?? document.id);
|
|
186
225
|
})
|
|
@@ -245,6 +284,43 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, workflowStatuses
|
|
|
245
284
|
currentDocument: currentDocument,
|
|
246
285
|
locale: locale
|
|
247
286
|
})
|
|
287
|
+
}),
|
|
288
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
289
|
+
isOpen: null != restoreTarget,
|
|
290
|
+
onDismiss: ()=>setRestoreTarget(null),
|
|
291
|
+
closeOnOverlayClick: false,
|
|
292
|
+
children: /*#__PURE__*/ jsxs(Modal.Container, {
|
|
293
|
+
className: classnames('byline-coll-history-restore-modal', history_module.restoreModal),
|
|
294
|
+
children: [
|
|
295
|
+
/*#__PURE__*/ jsxs(Modal.Header, {
|
|
296
|
+
className: classnames('byline-coll-history-restore-modal-head', history_module.restoreModalHead),
|
|
297
|
+
children: [
|
|
298
|
+
/*#__PURE__*/ jsx("h3", {
|
|
299
|
+
className: "m-0",
|
|
300
|
+
children: "Restore version"
|
|
301
|
+
}),
|
|
302
|
+
/*#__PURE__*/ jsx(IconButton, {
|
|
303
|
+
"aria-label": "Close",
|
|
304
|
+
size: "xs",
|
|
305
|
+
onClick: ()=>setRestoreTarget(null),
|
|
306
|
+
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
307
|
+
width: "14px",
|
|
308
|
+
height: "14px",
|
|
309
|
+
svgClassName: "white-icon"
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
}),
|
|
314
|
+
restoreTarget ? /*#__PURE__*/ jsx(RestoreVersionModal, {
|
|
315
|
+
collection: collection,
|
|
316
|
+
documentId: id,
|
|
317
|
+
versionId: restoreTarget.versionId,
|
|
318
|
+
versionLabel: restoreTarget.label,
|
|
319
|
+
versionNumber: restoreTarget.versionNumber,
|
|
320
|
+
onClose: ()=>setRestoreTarget(null)
|
|
321
|
+
}) : null
|
|
322
|
+
]
|
|
323
|
+
})
|
|
248
324
|
})
|
|
249
325
|
]
|
|
250
326
|
});
|
|
@@ -13,6 +13,11 @@ const history_module = {
|
|
|
13
13
|
colVersion: "colVersion-xGf5qV",
|
|
14
14
|
versionButton: "versionButton-DXCZwj",
|
|
15
15
|
titleButton: "titleButton-RPuvJm",
|
|
16
|
+
colRestore: "colRestore-D3b2hI",
|
|
17
|
+
restoreCell: "restoreCell-Exf1wn",
|
|
18
|
+
restoreButton: "restoreButton-axrnAL",
|
|
19
|
+
restoreModal: "restoreModal-tNkjf6",
|
|
20
|
+
restoreModalHead: "restoreModalHead-cJAc46",
|
|
16
21
|
pageSize: "pageSize-yT2Yee"
|
|
17
22
|
};
|
|
18
23
|
export default history_module;
|
|
@@ -113,6 +113,52 @@
|
|
|
113
113
|
opacity: .75;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
:is(.colRestore-D3b2hI, .byline-coll-history-col-restore) {
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
background-color: var(--gray-50);
|
|
119
|
+
width: 1%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:is(:is([data-theme="dark"], .dark) .colRestore-D3b2hI, :is([data-theme="dark"], .dark) .byline-coll-history-col-restore) {
|
|
123
|
+
background-color: oklch(from var(--canvas-800) calc(l * 1.1) c h);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:is(.restoreCell-Exf1wn, .byline-coll-history-restore-cell) {
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:is(.restoreButton-axrnAL, .byline-coll-history-restore-button) {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
transition: opacity .15s;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
tr:hover .restoreButton-axrnAL {
|
|
136
|
+
opacity: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
tr:hover .byline-coll-history-restore-button {
|
|
140
|
+
opacity: 1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.restoreButton-axrnAL:focus {
|
|
144
|
+
opacity: 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.byline-coll-history-restore-button:focus {
|
|
148
|
+
opacity: 1;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:is(.restoreModal-tNkjf6, .byline-coll-history-restore-modal) {
|
|
152
|
+
max-width: 32rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:is(.restoreModalHead-cJAc46, .byline-coll-history-restore-modal-head) {
|
|
156
|
+
justify-content: space-between;
|
|
157
|
+
align-items: center;
|
|
158
|
+
margin-bottom: 1rem;
|
|
159
|
+
display: flex;
|
|
160
|
+
}
|
|
161
|
+
|
|
116
162
|
@media (min-width: 40rem) {
|
|
117
163
|
:is(.pageSize-yT2Yee, .byline-coll-history-page-size) {
|
|
118
164
|
margin-left: auto;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
3
|
import { useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { Container, IconButton, LoaderRing, PlusIcon, Search, Section, Select, Table } from "@byline/ui";
|
|
5
|
-
import { StatusBadge, renderFormatted } from "@byline/ui/react";
|
|
4
|
+
import { Container, IconButton, LoaderRing, PlusIcon, Search, Section, Select, StatusBadge, Table, renderFormatted } from "@byline/ui/react";
|
|
6
5
|
import classnames from "classnames";
|
|
7
6
|
import { Link, useNavigate } from "../chrome/loose-router.js";
|
|
8
7
|
import { RouterPager } from "../chrome/router-pager.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { ExternalLinkIcon, IconButton, useToastManager } from "@byline/ui";
|
|
3
|
+
import { ExternalLinkIcon, IconButton, useToastManager } from "@byline/ui/react";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { enablePreviewModeFn } from "../../server-fns/preview/index.js";
|
|
6
6
|
function resolvePreviewUrl(doc, collectionPath, adminConfig, locale) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface RestoreVersionModalProps {
|
|
2
|
+
collection: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
versionId: string;
|
|
5
|
+
versionLabel: string;
|
|
6
|
+
versionNumber: number;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function RestoreVersionModal({ collection, documentId, versionId, versionLabel, versionNumber, onClose, }: RestoreVersionModalProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useRouter } from "@tanstack/react-router";
|
|
5
|
+
import { Alert, Button, LoaderEllipsis, Modal } from "@byline/ui/react";
|
|
6
|
+
import classnames from "classnames";
|
|
7
|
+
import { restoreDocumentVersion } from "../../server-fns/collections/index.js";
|
|
8
|
+
import { useNavigate } from "../chrome/loose-router.js";
|
|
9
|
+
import restore_version_modal_module from "./restore-version-modal.module.js";
|
|
10
|
+
function RestoreVersionModal({ collection, documentId, versionId, versionLabel, versionNumber, onClose }) {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
const [error, setError] = useState(null);
|
|
14
|
+
const [pending, setPending] = useState(false);
|
|
15
|
+
async function handleRestore() {
|
|
16
|
+
if (pending) return;
|
|
17
|
+
setPending(true);
|
|
18
|
+
setError(null);
|
|
19
|
+
try {
|
|
20
|
+
await restoreDocumentVersion({
|
|
21
|
+
data: {
|
|
22
|
+
collection,
|
|
23
|
+
id: documentId,
|
|
24
|
+
versionId
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
onClose();
|
|
28
|
+
await router.invalidate();
|
|
29
|
+
navigate({
|
|
30
|
+
to: '/admin/collections/$collection/$id',
|
|
31
|
+
params: {
|
|
32
|
+
collection,
|
|
33
|
+
id: documentId
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
} catch (err) {
|
|
37
|
+
const code = getErrorCode(err);
|
|
38
|
+
if ('ERR_INVALID_TRANSITION' === code) setError('This version is already the current version of the document.');
|
|
39
|
+
else if ('ERR_NOT_FOUND' === code) setError('The selected version could not be found. The history may be out of date.');
|
|
40
|
+
else 'ERR_FORBIDDEN' === code || 'ERR_UNAUTHENTICATED' === code ? setError('You do not have permission to restore versions for this collection.') : setError('Could not restore this version. Please try again.');
|
|
41
|
+
setPending(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/ jsxs(Modal.Content, {
|
|
45
|
+
className: classnames('byline-coll-restore-content', restore_version_modal_module.content),
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ jsxs("div", {
|
|
48
|
+
className: classnames('byline-coll-restore-body', restore_version_modal_module.body),
|
|
49
|
+
children: [
|
|
50
|
+
error ? /*#__PURE__*/ jsx(Alert, {
|
|
51
|
+
intent: "danger",
|
|
52
|
+
close: false,
|
|
53
|
+
children: error
|
|
54
|
+
}) : null,
|
|
55
|
+
/*#__PURE__*/ jsxs("p", {
|
|
56
|
+
className: classnames('byline-coll-restore-row', restore_version_modal_module.row),
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ jsx("span", {
|
|
59
|
+
className: "muted",
|
|
60
|
+
children: "Version:"
|
|
61
|
+
}),
|
|
62
|
+
" ",
|
|
63
|
+
versionNumber
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
/*#__PURE__*/ jsxs("p", {
|
|
67
|
+
className: classnames('byline-coll-restore-row', restore_version_modal_module.row),
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ jsx("span", {
|
|
70
|
+
className: "muted",
|
|
71
|
+
children: "Created:"
|
|
72
|
+
}),
|
|
73
|
+
" ",
|
|
74
|
+
versionLabel
|
|
75
|
+
]
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsxs("p", {
|
|
78
|
+
className: classnames('byline-coll-restore-warning', restore_version_modal_module.warning),
|
|
79
|
+
children: [
|
|
80
|
+
"This will create a new draft version of this document with the content from version",
|
|
81
|
+
' ',
|
|
82
|
+
versionNumber,
|
|
83
|
+
", and that draft will become the current version. The existing versions (including any published version) are preserved in history. The restored draft will need to be published through the normal workflow."
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ jsxs("div", {
|
|
89
|
+
className: classnames('byline-coll-restore-actions', restore_version_modal_module.actions),
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ jsx(Button, {
|
|
92
|
+
type: "button",
|
|
93
|
+
intent: "secondary",
|
|
94
|
+
size: "sm",
|
|
95
|
+
onClick: onClose,
|
|
96
|
+
disabled: pending,
|
|
97
|
+
className: classnames('byline-coll-restore-button', restore_version_modal_module.button),
|
|
98
|
+
children: "Cancel"
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsx(Button, {
|
|
101
|
+
size: "sm",
|
|
102
|
+
intent: "primary",
|
|
103
|
+
onClick: handleRestore,
|
|
104
|
+
disabled: pending,
|
|
105
|
+
className: classnames('byline-coll-restore-button', restore_version_modal_module.button),
|
|
106
|
+
children: true === pending ? /*#__PURE__*/ jsx(LoaderEllipsis, {
|
|
107
|
+
size: 42
|
|
108
|
+
}) : 'Restore as Draft'
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function getErrorCode(err) {
|
|
116
|
+
return 'string' == typeof err?.code ? err.code : null;
|
|
117
|
+
}
|
|
118
|
+
export { RestoreVersionModal };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./restore-version-modal_module.css";
|
|
2
|
+
const restore_version_modal_module = {
|
|
3
|
+
content: "content-uRNWdJ",
|
|
4
|
+
body: "body-Ob50BW",
|
|
5
|
+
row: "row-UfzCHH",
|
|
6
|
+
warning: "warning-OXVE7o",
|
|
7
|
+
actions: "actions-w8VRuc",
|
|
8
|
+
button: "button-oKxXB5"
|
|
9
|
+
};
|
|
10
|
+
export default restore_version_modal_module;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
:is(.content-uRNWdJ, .byline-coll-restore-content) {
|
|
2
|
+
gap: .25rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:is(.body-Ob50BW, .byline-coll-restore-body) {
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:is(.row-UfzCHH, .byline-coll-restore-row) {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:is(.warning-OXVE7o, .byline-coll-restore-warning) {
|
|
16
|
+
margin-top: .75rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:is(.actions-w8VRuc, .byline-coll-restore-actions) {
|
|
20
|
+
justify-content: flex-end;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: .5rem;
|
|
23
|
+
margin-top: 1.5rem;
|
|
24
|
+
margin-bottom: 1rem;
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:is(.button-oKxXB5, .byline-coll-restore-button) {
|
|
29
|
+
min-width: 4rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { Button, HistoryIcon, IconButton, Label, Select } from "@byline/ui";
|
|
3
|
+
import { Button, HistoryIcon, IconButton, Label, Select } from "@byline/ui/react";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { useNavigate } from "../chrome/loose-router.js";
|
|
6
6
|
import { PreviewLink } from "./preview-link.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute } from "@tanstack/react-router";
|
|
3
|
-
import { Container, Section } from "@byline/ui";
|
|
4
|
-
import { AccountSelfContainer } from "@byline/ui/react";
|
|
3
|
+
import { AccountSelfContainer, Container, Section } from "@byline/ui/react";
|
|
5
4
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
5
|
import { getAccount } from "../server-fns/admin-account/index.js";
|
|
7
6
|
function displayNameFor(account) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
|
-
import { Container, Section } from "@byline/ui";
|
|
3
|
+
import { Container, Section } from "@byline/ui/react";
|
|
4
4
|
import { RoleContainer } from "../admin-shell/admin-roles/container.js";
|
|
5
5
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
6
|
import { getRoleAbilities, listRegisteredAbilities } from "../server-fns/admin-permissions/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
3
|
-
import { Container, Section } from "@byline/ui";
|
|
3
|
+
import { Container, Section } from "@byline/ui/react";
|
|
4
4
|
import { AccountContainer } from "../admin-shell/admin-users/container.js";
|
|
5
5
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
6
6
|
import { listAdminRoles } from "../server-fns/admin-roles/index.js";
|
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { createFileRoute, notFound } from "@tanstack/react-router";
|
|
4
4
|
import { getCollectionAdminConfig, getCollectionDefinition, getWorkflowStatuses } from "@byline/core";
|
|
5
|
-
import { useToastManager } from "@byline/ui";
|
|
5
|
+
import { useToastManager } from "@byline/ui/react";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
|
|
8
8
|
import { useNavigate } from "../admin-shell/chrome/loose-router.js";
|