@kodacms/admin 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/design-tokens/kodacms.tokens.json +1360 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/AuditView-DCgrAjma.js +1 -0
- package/dist/assets/CollectionView-CY3zK1CE.js +1 -0
- package/dist/assets/CustomComponent-B1mxHHd0.js +1 -0
- package/dist/assets/CustomPageView-BTsy9MC8.js +1 -0
- package/dist/assets/DashboardView-ujWhLuS2.js +1 -0
- package/dist/assets/DeleteDocumentsDialog-D1nx27UG.js +1 -0
- package/dist/assets/DocumentHistoryView-Ko633-Dy.js +1 -0
- package/dist/assets/DocumentView-CPEjwzzo.js +1 -0
- package/dist/assets/GlobalHistoryView-CbwdeYpn.js +1 -0
- package/dist/assets/GlobalView-DcTGexxK.js +1 -0
- package/dist/assets/KAlert-DoR81cyQ.js +1 -0
- package/dist/assets/KCard-DNom764U.js +1 -0
- package/dist/assets/KDropdownMenu-BECk5S9K.js +1 -0
- package/dist/assets/KField-CvINPmYu.js +1 -0
- package/dist/assets/KPagination-DQOzrRaf.js +1 -0
- package/dist/assets/KPasswordInput-EPBXvtXG.js +1 -0
- package/dist/assets/KSeparator-DEbXnpDV.js +1 -0
- package/dist/assets/KTableRow-Dpp2Lk2V.js +1 -0
- package/dist/assets/KTabs-b95D7hep.js +1 -0
- package/dist/assets/KTextarea-CCveuS_I.js +1 -0
- package/dist/assets/Label-m9Ig3v9B.js +1 -0
- package/dist/assets/ListFooter-qYmCWY4R.js +1 -0
- package/dist/assets/LoadError-BRccywgs.js +1 -0
- package/dist/assets/LoginView-DvTtEJxp.js +1 -0
- package/dist/assets/NoAccessView-Bg69btHE.js +1 -0
- package/dist/assets/NotFoundView-qhJ2ixSH.js +1 -0
- package/dist/assets/PageHeader-B3riLtJg.js +1 -0
- package/dist/assets/PopoverAnchor-BwL6g4vt.js +1 -0
- package/dist/assets/PopoverContentImpl-Dq0cbuHV.js +1 -0
- package/dist/assets/PopoverContentModal-BEl8rmbI.js +1 -0
- package/dist/assets/PopoverContentNonModal-D5osgtpx.js +1 -0
- package/dist/assets/RoleView-D9732bW6.js +1 -0
- package/dist/assets/RolesView-Du4NUhQJ.js +1 -0
- package/dist/assets/TooltipContentHoverable-C18vbtIU.js +1 -0
- package/dist/assets/TooltipContentImpl-CCpG79EA.js +1 -0
- package/dist/assets/TooltipContentImpl-DQFjU6ri.js +1 -0
- package/dist/assets/UploadQueueItem-BbG5x7WM.js +6 -0
- package/dist/assets/UserView-iFK1eFT9.js +1 -0
- package/dist/assets/UsersView-B6fCtC-4.js +1 -0
- package/dist/assets/columns-DmJOzXV9.js +1 -0
- package/dist/assets/ellipsis-BNwYKZMS.js +1 -0
- package/dist/assets/error-text-1F8qU3pC.js +1 -0
- package/dist/assets/eye-DyBObYiE.js +1 -0
- package/dist/assets/eye-off-Bd_6erac.js +1 -0
- package/dist/assets/form-layout-Dk2JVUC0.js +1 -0
- package/dist/assets/globals-BMIQQR5f.js +1 -0
- package/dist/assets/index-CGdQZeTs.css +2 -0
- package/dist/assets/index-a4P44W6e.js +14 -0
- package/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/assets/list-query-DcmvyLSO.js +1 -0
- package/dist/assets/rolldown-runtime-P3Pd_6ND.js +1 -0
- package/dist/assets/select-options-osOjd-zR.js +1 -0
- package/dist/assets/useAuditState-D6n8HXQ2.js +1 -0
- package/dist/assets/useDebounced-BVo96C1E.js +1 -0
- package/dist/assets/useHistoryLocale-BWBBUuQi.js +1 -0
- package/dist/assets/useListState-CTgxjU_g.js +1 -0
- package/dist/assets/useLocaleDocument-DkvwSG3X.js +1 -0
- package/dist/assets/usePageHeader-wYdFq9cQ.js +1 -0
- package/dist/assets/useRoleDelete-DFwroHOv.js +1 -0
- package/dist/assets/useSaveShortcut-DFNu_TAL.js +1 -0
- package/dist/assets/useUserDelete-83wa7pqC.js +1 -0
- package/dist/assets/useUsersAccess-1yVnzExk.js +1 -0
- package/dist/assets/users-NiowxtJB.js +1 -0
- package/dist/assets/validate-CEcXMakk.js +1 -0
- package/dist/favicon.svg +12 -0
- package/dist/index.html +16 -0
- package/dist/koda-components.json +4 -0
- package/index.html +15 -0
- package/package.json +68 -4
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.svg +12 -0
- package/src/App.vue +17 -0
- package/src/api/access.ts +110 -0
- package/src/api/admin-config.ts +318 -0
- package/src/api/admin-fields.ts +557 -0
- package/src/api/admin-layout.ts +191 -0
- package/src/api/api-error.ts +78 -0
- package/src/api/audit.ts +170 -0
- package/src/api/client.ts +153 -0
- package/src/api/documents.ts +470 -0
- package/src/api/drafts.ts +115 -0
- package/src/api/error-text.ts +11 -0
- package/src/api/globals.ts +133 -0
- package/src/api/http.ts +24 -0
- package/src/api/locale.ts +48 -0
- package/src/api/permissions.ts +194 -0
- package/src/api/relations.ts +86 -0
- package/src/api/roles.ts +170 -0
- package/src/api/scopes.ts +91 -0
- package/src/api/search-query.ts +33 -0
- package/src/api/search.ts +39 -0
- package/src/api/types.ts +39 -0
- package/src/api/upload.ts +146 -0
- package/src/api/users.ts +88 -0
- package/src/api/versions.ts +206 -0
- package/src/api/where-query.ts +79 -0
- package/src/audit/AuditActionBadge.vue +13 -0
- package/src/audit/AuditActor.vue +34 -0
- package/src/audit/AuditCard.vue +68 -0
- package/src/audit/AuditDrawer.vue +86 -0
- package/src/audit/AuditDrawerActions.vue +70 -0
- package/src/audit/AuditEntryBody.vue +74 -0
- package/src/audit/AuditEntryChanges.vue +88 -0
- package/src/audit/AuditEntryFacts.vue +47 -0
- package/src/audit/AuditFilterBar.vue +55 -0
- package/src/audit/AuditFilterControls.vue +148 -0
- package/src/audit/AuditFiltersDrawer.vue +46 -0
- package/src/audit/AuditHistory.vue +136 -0
- package/src/audit/AuditList.vue +183 -0
- package/src/audit/AuditListStates.vue +70 -0
- package/src/audit/AuditRestoredVersion.vue +66 -0
- package/src/audit/AuditSearch.vue +40 -0
- package/src/audit/AuditTable.vue +116 -0
- package/src/audit/HistoryTabs.vue +48 -0
- package/src/audit/audit-changes.ts +161 -0
- package/src/audit/audit-filters.ts +152 -0
- package/src/audit/audit-view.ts +372 -0
- package/src/audit/useAuditContext.ts +23 -0
- package/src/audit/useAuditFilterOptions.ts +67 -0
- package/src/audit/useAuditState.ts +82 -0
- package/src/brand/KodaMark.vue +42 -0
- package/src/composables/useAccessView.ts +120 -0
- package/src/composables/useDebounced.ts +15 -0
- package/src/composables/usePageHeader.ts +20 -0
- package/src/composables/useSessionCacheReset.ts +23 -0
- package/src/composables/useTheme.ts +79 -0
- package/src/composables/useUsersAccess.ts +13 -0
- package/src/custom/CustomComponent.vue +103 -0
- package/src/custom/CustomComponentNotice.vue +71 -0
- package/src/custom/CustomInserts.vue +36 -0
- package/src/custom/component-name.ts +18 -0
- package/src/custom/error-info.ts +22 -0
- package/src/custom/form-context.ts +44 -0
- package/src/custom/list-context.ts +44 -0
- package/src/custom/place.ts +126 -0
- package/src/custom/registry.ts +101 -0
- package/src/custom/useCustomComponent.ts +136 -0
- package/src/custom/useFormZones.ts +65 -0
- package/src/custom/useListZones.ts +38 -0
- package/src/custom/user-components.ts +20 -0
- package/src/custom/zone-components.ts +53 -0
- package/src/documents/DocumentForm.vue +168 -0
- package/src/documents/DocumentList.vue +190 -0
- package/src/documents/cells/CheckboxCell.vue +16 -0
- package/src/documents/cells/DateCell.vue +26 -0
- package/src/documents/cells/FallbackCell.vue +23 -0
- package/src/documents/cells/FileSizeCell.vue +14 -0
- package/src/documents/cells/IdCell.vue +14 -0
- package/src/documents/cells/MimeCell.vue +15 -0
- package/src/documents/cells/NumberCell.vue +13 -0
- package/src/documents/cells/RelationshipCell.vue +33 -0
- package/src/documents/cells/RowsCell.vue +21 -0
- package/src/documents/cells/SelectCell.vue +23 -0
- package/src/documents/cells/StatusCell.vue +18 -0
- package/src/documents/cells/TextCell.vue +16 -0
- package/src/documents/cells/ThumbnailCell.vue +31 -0
- package/src/documents/cells/UploadCell.vue +53 -0
- package/src/documents/cells/UploadCellThumb.vue +27 -0
- package/src/documents/cells/cell-props.ts +12 -0
- package/src/documents/cells/registry.ts +44 -0
- package/src/documents/cells/select-options.ts +18 -0
- package/src/documents/drafts/DraftActions.vue +62 -0
- package/src/documents/drafts/DraftStatus.vue +100 -0
- package/src/documents/drafts/StatusBadge.vue +23 -0
- package/src/documents/drafts/UnpublishDialog.vue +25 -0
- package/src/documents/drafts/useAutosave.ts +88 -0
- package/src/documents/drafts/useDrafts.ts +73 -0
- package/src/documents/fields/CheckboxControl.vue +13 -0
- package/src/documents/fields/DateControl.vue +22 -0
- package/src/documents/fields/FieldControl.vue +55 -0
- package/src/documents/fields/FieldDescription.vue +34 -0
- package/src/documents/fields/FieldRenderer.vue +92 -0
- package/src/documents/fields/GroupChildren.vue +28 -0
- package/src/documents/fields/GroupErrors.vue +49 -0
- package/src/documents/fields/GroupFields.vue +87 -0
- package/src/documents/fields/JsonControl.vue +20 -0
- package/src/documents/fields/NumberControl.vue +20 -0
- package/src/documents/fields/ReadOnlyControl.vue +18 -0
- package/src/documents/fields/SelectControl.vue +46 -0
- package/src/documents/fields/TextControl.vue +37 -0
- package/src/documents/fields/TextareaControl.vue +18 -0
- package/src/documents/fields/ValueField.vue +87 -0
- package/src/documents/fields/field-control.ts +10 -0
- package/src/documents/fields/registry.ts +56 -0
- package/src/documents/fields/relation/JoinControl.vue +41 -0
- package/src/documents/fields/relation/RelationshipControl.vue +57 -0
- package/src/documents/fields/relation/useRelationPicker.ts +96 -0
- package/src/documents/fields/rows/ArrayFields.vue +72 -0
- package/src/documents/fields/rows/BlocksFields.vue +90 -0
- package/src/documents/fields/rows/RowCard.vue +81 -0
- package/src/documents/fields/rows/RowFields.vue +32 -0
- package/src/documents/fields/rows/RowsFieldset.vue +51 -0
- package/src/documents/fields/rows/row-title.ts +29 -0
- package/src/documents/fields/rows/useRows.ts +32 -0
- package/src/documents/fields/upload/MediaGrid.vue +61 -0
- package/src/documents/fields/upload/MediaLibrary.vue +131 -0
- package/src/documents/fields/upload/MediaPickerDialog.vue +54 -0
- package/src/documents/fields/upload/MediaTile.vue +69 -0
- package/src/documents/fields/upload/MediaUploadArea.vue +60 -0
- package/src/documents/fields/upload/UploadControl.vue +157 -0
- package/src/documents/fields/upload/UploadValueItem.vue +108 -0
- package/src/documents/fields/upload/upload-field.ts +77 -0
- package/src/documents/fields/upload/useFieldUploads.ts +60 -0
- package/src/documents/fields/upload/useMediaLibrary.ts +77 -0
- package/src/documents/fields/useCustomFieldModel.ts +32 -0
- package/src/documents/fields/useFieldLocale.ts +38 -0
- package/src/documents/form/DocumentFields.vue +28 -0
- package/src/documents/form/DocumentHeader.vue +50 -0
- package/src/documents/form/DocumentMeta.vue +99 -0
- package/src/documents/form/UnsavedChangesDialog.vue +27 -0
- package/src/documents/form/created-by.ts +12 -0
- package/src/documents/form/field-errors.ts +29 -0
- package/src/documents/form/field-value.ts +229 -0
- package/src/documents/form/focus-first-error.ts +43 -0
- package/src/documents/form/form-conditions.ts +106 -0
- package/src/documents/form/form-layout.ts +245 -0
- package/src/documents/form/form-values.ts +265 -0
- package/src/documents/form/layout/LayoutBlock.vue +32 -0
- package/src/documents/form/layout/LayoutItems.vue +43 -0
- package/src/documents/form/layout/LayoutLeaf.vue +33 -0
- package/src/documents/form/layout/LayoutRow.vue +60 -0
- package/src/documents/form/layout/LayoutSection.vue +73 -0
- package/src/documents/form/layout/LayoutStack.vue +20 -0
- package/src/documents/form/layout/LayoutTabs.vue +74 -0
- package/src/documents/form/relation-value.ts +160 -0
- package/src/documents/form/rows.ts +24 -0
- package/src/documents/form/save-messages.ts +65 -0
- package/src/documents/form/useDocumentDelete.ts +38 -0
- package/src/documents/form/useDocumentEditor.ts +167 -0
- package/src/documents/form/useDocumentForm.ts +37 -0
- package/src/documents/form/useDocumentRights.ts +45 -0
- package/src/documents/form/useDocumentSubmit.ts +128 -0
- package/src/documents/form/useFieldsForm.ts +238 -0
- package/src/documents/form/useFormLayout.ts +21 -0
- package/src/documents/form/useFormTabs.ts +54 -0
- package/src/documents/form/useLeaveGuard.ts +69 -0
- package/src/documents/form/useSaveShortcut.ts +13 -0
- package/src/documents/form/validate.ts +220 -0
- package/src/documents/list/CellConflictMessage.vue +24 -0
- package/src/documents/list/CellEditor.vue +155 -0
- package/src/documents/list/CellRelationEditor.vue +62 -0
- package/src/documents/list/DeleteDocumentsDialog.vue +42 -0
- package/src/documents/list/DocumentActions.vue +68 -0
- package/src/documents/list/DocumentCard.vue +84 -0
- package/src/documents/list/DocumentCards.vue +31 -0
- package/src/documents/list/DocumentRow.vue +86 -0
- package/src/documents/list/DocumentTable.vue +104 -0
- package/src/documents/list/InlineCell.vue +151 -0
- package/src/documents/list/InlineCheckboxCell.vue +99 -0
- package/src/documents/list/ListCell.vue +39 -0
- package/src/documents/list/ListCellValue.vue +59 -0
- package/src/documents/list/ListFooter.vue +50 -0
- package/src/documents/list/ListSearch.vue +44 -0
- package/src/documents/list/ListStates.vue +73 -0
- package/src/documents/list/ListToolbar.vue +37 -0
- package/src/documents/list/SelectionBar.vue +30 -0
- package/src/documents/list/cell-failure.ts +91 -0
- package/src/documents/list/cell-save.ts +129 -0
- package/src/documents/list/columns.ts +157 -0
- package/src/documents/list/inline-cells.ts +61 -0
- package/src/documents/list/inline-edit-context.ts +14 -0
- package/src/documents/list/inline-edit.ts +302 -0
- package/src/documents/list/list-query.ts +46 -0
- package/src/documents/list/row-overlay.ts +45 -0
- package/src/documents/list/sort.ts +32 -0
- package/src/documents/list/useCellEditorKeys.ts +78 -0
- package/src/documents/list/useCellEditorModel.ts +33 -0
- package/src/documents/list/useCellPopup.ts +94 -0
- package/src/documents/list/useDeleteFlow.ts +42 -0
- package/src/documents/list/useDocumentListData.ts +97 -0
- package/src/documents/list/useInlineEdit.ts +143 -0
- package/src/documents/list/useListInlineEdit.ts +68 -0
- package/src/documents/list/useListNotices.ts +58 -0
- package/src/documents/list/useListState.ts +67 -0
- package/src/documents/list/useRowPublish.ts +150 -0
- package/src/documents/upload/BulkUpload.vue +58 -0
- package/src/documents/upload/DocumentFileCard.vue +106 -0
- package/src/documents/upload/FileActions.vue +57 -0
- package/src/documents/upload/FileDetails.vue +40 -0
- package/src/documents/upload/UploadProgressRow.vue +29 -0
- package/src/documents/upload/UploadQueueItem.vue +150 -0
- package/src/documents/upload/UploadQueueSummary.vue +70 -0
- package/src/documents/upload/file-actions.ts +35 -0
- package/src/documents/upload/upload-logic.ts +209 -0
- package/src/documents/upload/upload-queue.ts +220 -0
- package/src/documents/upload/useDocumentFile.ts +93 -0
- package/src/documents/upload/useFileBlob.ts +132 -0
- package/src/documents/upload/useShownFile.ts +77 -0
- package/src/documents/versions/DiffOmitted.vue +34 -0
- package/src/documents/versions/DiffTree.vue +76 -0
- package/src/documents/versions/DiffValue.vue +101 -0
- package/src/documents/versions/HistoryLink.vue +17 -0
- package/src/documents/versions/RestoreVersionDialog.vue +58 -0
- package/src/documents/versions/VersionCard.vue +111 -0
- package/src/documents/versions/VersionHistory.vue +127 -0
- package/src/documents/versions/VersionSnapshot.vue +145 -0
- package/src/documents/versions/diff-view.ts +153 -0
- package/src/documents/versions/text-diff.ts +66 -0
- package/src/documents/versions/useRestoreFlow.ts +55 -0
- package/src/env.d.ts +17 -0
- package/src/format.ts +58 -0
- package/src/globals/GlobalForm.vue +139 -0
- package/src/globals/GlobalHeader.vue +39 -0
- package/src/globals/GlobalMeta.vue +67 -0
- package/src/globals/useGlobalEditor.ts +118 -0
- package/src/globals/useGlobalForm.ts +32 -0
- package/src/globals/useGlobalSubmit.ts +75 -0
- package/src/layout/AppBarMobile.vue +42 -0
- package/src/layout/AppLayout.vue +40 -0
- package/src/layout/AppTopbar.vue +28 -0
- package/src/layout/LoadError.vue +19 -0
- package/src/layout/MobileNavDrawer.vue +45 -0
- package/src/layout/PageHeader.vue +19 -0
- package/src/layout/ThemeToggle.vue +28 -0
- package/src/layout/palette/AppCommandPalette.vue +32 -0
- package/src/layout/palette/palette-actions.ts +54 -0
- package/src/layout/palette/palette-commands.ts +156 -0
- package/src/layout/palette/palette-documents.ts +73 -0
- package/src/layout/palette/palette-groups.ts +90 -0
- package/src/layout/palette/palette-hotkey.ts +39 -0
- package/src/layout/palette/recent-documents.ts +123 -0
- package/src/layout/palette/useCommandPalette.ts +75 -0
- package/src/layout/palette/useDocumentSearch.ts +88 -0
- package/src/layout/palette/useRememberDocument.ts +30 -0
- package/src/layout/sidebar/SidebarAdmin.vue +50 -0
- package/src/layout/sidebar/SidebarBrand.vue +14 -0
- package/src/layout/sidebar/SidebarCollections.vue +55 -0
- package/src/layout/sidebar/SidebarGlobals.vue +23 -0
- package/src/layout/sidebar/SidebarGroup.vue +14 -0
- package/src/layout/sidebar/SidebarItem.vue +47 -0
- package/src/layout/sidebar/SidebarNav.vue +37 -0
- package/src/layout/sidebar/SidebarUser.vue +43 -0
- package/src/layout/sidebar/SidebarViews.vue +26 -0
- package/src/layout/sidebar/view-icons.ts +112 -0
- package/src/localization/FallbackHint.vue +41 -0
- package/src/localization/LocaleNotice.vue +42 -0
- package/src/localization/LocaleSwitcher.vue +40 -0
- package/src/localization/fallback-value.ts +76 -0
- package/src/localization/list-locale.ts +37 -0
- package/src/localization/locale-form.ts +64 -0
- package/src/localization/locale.ts +286 -0
- package/src/localization/useContentLocale.ts +47 -0
- package/src/localization/useHistoryLocale.ts +30 -0
- package/src/localization/useListFallbacks.ts +49 -0
- package/src/localization/useLocaleDocument.ts +116 -0
- package/src/main.ts +21 -0
- package/src/public/__snapshots__/public-api.spec.ts.snap +456 -0
- package/src/public/composables/useApi.ts +155 -0
- package/src/public/composables/useCell.ts +38 -0
- package/src/public/composables/useCurrentUser.ts +16 -0
- package/src/public/composables/useDocument.ts +108 -0
- package/src/public/composables/useField.ts +136 -0
- package/src/public/composables/useList.ts +38 -0
- package/src/public/composables/useLocale.ts +29 -0
- package/src/public/composables/useToast.ts +19 -0
- package/src/public/index.ts +59 -0
- package/src/public/types.ts +183 -0
- package/src/public/ui.ts +85 -0
- package/src/roles/CopyRoleDialog.vue +32 -0
- package/src/roles/DeleteRoleDialog.vue +26 -0
- package/src/roles/MatrixFlags.vue +77 -0
- package/src/roles/MatrixTable.vue +101 -0
- package/src/roles/PermissionMatrix.vue +112 -0
- package/src/roles/RoleActions.vue +47 -0
- package/src/roles/RoleCard.vue +54 -0
- package/src/roles/RoleForm.vue +150 -0
- package/src/roles/RoleFormFields.vue +43 -0
- package/src/roles/RoleList.vue +77 -0
- package/src/roles/RoleMeta.vue +74 -0
- package/src/roles/RoleTable.vue +74 -0
- package/src/roles/role-form.ts +135 -0
- package/src/roles/role-matrix.ts +284 -0
- package/src/roles/useRoleCopy.ts +61 -0
- package/src/roles/useRoleDelete.ts +39 -0
- package/src/roles/useRoleForm.ts +122 -0
- package/src/router/guards.ts +57 -0
- package/src/router/index.ts +160 -0
- package/src/router/redirect.ts +9 -0
- package/src/runtime/runtime-config.ts +32 -0
- package/src/stores/auth.ts +205 -0
- package/src/stores/shell.ts +24 -0
- package/src/stores/uploads.ts +81 -0
- package/src/styles/main.css +40 -0
- package/src/styles/motion.css +328 -0
- package/src/styles/tokens.css +347 -0
- package/src/ui/KAlert.vue +80 -0
- package/src/ui/KAvatar.vue +43 -0
- package/src/ui/KBadge.vue +56 -0
- package/src/ui/KBreadcrumbs.vue +56 -0
- package/src/ui/KButton.vue +136 -0
- package/src/ui/KCalendar.vue +79 -0
- package/src/ui/KCard.vue +106 -0
- package/src/ui/KCellMessage.vue +57 -0
- package/src/ui/KCellTextarea.vue +92 -0
- package/src/ui/KCheckbox.vue +87 -0
- package/src/ui/KCollapsible.vue +100 -0
- package/src/ui/KCombobox.vue +173 -0
- package/src/ui/KComboboxOptions.vue +68 -0
- package/src/ui/KCommandItem.vue +53 -0
- package/src/ui/KCommandPalette.vue +215 -0
- package/src/ui/KDatePicker.vue +165 -0
- package/src/ui/KDrawer.vue +108 -0
- package/src/ui/KDropdownMenu.vue +60 -0
- package/src/ui/KDropzone.vue +163 -0
- package/src/ui/KEmptyState.vue +68 -0
- package/src/ui/KField.vue +103 -0
- package/src/ui/KInput.vue +89 -0
- package/src/ui/KKbd.vue +24 -0
- package/src/ui/KModal.vue +92 -0
- package/src/ui/KMultiSelect.vue +141 -0
- package/src/ui/KPagination.vue +65 -0
- package/src/ui/KPasswordInput.vue +33 -0
- package/src/ui/KPopover.vue +110 -0
- package/src/ui/KProgress.vue +61 -0
- package/src/ui/KRadioGroup.vue +90 -0
- package/src/ui/KSearchTrigger.vue +51 -0
- package/src/ui/KSegmented.vue +104 -0
- package/src/ui/KSelect.vue +124 -0
- package/src/ui/KSeparator.vue +33 -0
- package/src/ui/KSkeleton.vue +35 -0
- package/src/ui/KSpinner.vue +17 -0
- package/src/ui/KSwitch.vue +65 -0
- package/src/ui/KTab.vue +65 -0
- package/src/ui/KTabList.vue +18 -0
- package/src/ui/KTabPanel.vue +18 -0
- package/src/ui/KTable.vue +43 -0
- package/src/ui/KTableBody.vue +9 -0
- package/src/ui/KTableCell.vue +228 -0
- package/src/ui/KTableHeader.vue +39 -0
- package/src/ui/KTableHeaderCell.vue +94 -0
- package/src/ui/KTableRow.vue +49 -0
- package/src/ui/KTabs.vue +24 -0
- package/src/ui/KTag.vue +29 -0
- package/src/ui/KTextarea.vue +50 -0
- package/src/ui/KThumbnail.vue +100 -0
- package/src/ui/KToaster.vue +70 -0
- package/src/ui/KTooltip.vue +55 -0
- package/src/ui/command-palette.ts +41 -0
- package/src/ui/control-classes.ts +48 -0
- package/src/ui/cx.ts +6 -0
- package/src/ui/date-value.ts +48 -0
- package/src/ui/field-context.ts +61 -0
- package/src/ui/index.ts +88 -0
- package/src/ui/options.ts +6 -0
- package/src/ui/pagination.ts +38 -0
- package/src/ui/shortcut.ts +104 -0
- package/src/ui/table-grid.ts +277 -0
- package/src/ui/toast.ts +59 -0
- package/src/ui/useFileDrop.ts +70 -0
- package/src/users/DeleteUserDialog.vue +26 -0
- package/src/users/UserActions.vue +46 -0
- package/src/users/UserCard.vue +44 -0
- package/src/users/UserForm.vue +134 -0
- package/src/users/UserFormFields.vue +93 -0
- package/src/users/UserList.vue +107 -0
- package/src/users/UserMeta.vue +70 -0
- package/src/users/UserRoleBadge.vue +10 -0
- package/src/users/UserTable.vue +84 -0
- package/src/users/useRoleOptions.ts +50 -0
- package/src/users/useUserDelete.ts +39 -0
- package/src/users/useUserForm.ts +74 -0
- package/src/users/user-columns.ts +12 -0
- package/src/users/user-form.ts +167 -0
- package/src/views/AuditView.vue +57 -0
- package/src/views/CollectionView.vue +103 -0
- package/src/views/CustomPageView.vue +53 -0
- package/src/views/DashboardView.vue +91 -0
- package/src/views/DocumentHistoryView.vue +158 -0
- package/src/views/DocumentView.vue +173 -0
- package/src/views/GlobalHistoryView.vue +136 -0
- package/src/views/GlobalView.vue +115 -0
- package/src/views/LoginView.vue +41 -0
- package/src/views/NoAccessView.vue +34 -0
- package/src/views/NotFoundView.vue +27 -0
- package/src/views/RoleView.vue +93 -0
- package/src/views/RolesView.vue +66 -0
- package/src/views/UserView.vue +68 -0
- package/src/views/UsersView.vue +59 -0
- package/src/views/dashboard/CollectionCard.vue +21 -0
- package/src/views/dashboard/DashboardCardTitle.vue +18 -0
- package/src/views/dashboard/DashboardWidgets.vue +35 -0
- package/src/views/dashboard/GlobalCard.vue +24 -0
- package/src/views/login/LoginForm.vue +93 -0
- package/src/views/login/login-errors.ts +42 -0
- package/tsconfig.components.json +26 -0
- package/vite/koda-admin.ts +274 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { QueryValue } from './client.js';
|
|
2
|
+
|
|
3
|
+
/** Оператор условия where (src/koda/where/where-fields.ts). */
|
|
4
|
+
export type WhereOperator =
|
|
5
|
+
| 'equals'
|
|
6
|
+
| 'not_equals'
|
|
7
|
+
| 'in'
|
|
8
|
+
| 'not_in'
|
|
9
|
+
| 'exists'
|
|
10
|
+
| 'like'
|
|
11
|
+
| 'contains'
|
|
12
|
+
| 'greater_than'
|
|
13
|
+
| 'greater_than_equal'
|
|
14
|
+
| 'less_than'
|
|
15
|
+
| 'less_than_equal';
|
|
16
|
+
|
|
17
|
+
/** Значение в условии: строка, число, булево; у `in`/`not_in` — список. */
|
|
18
|
+
export type WhereValue =
|
|
19
|
+
string | number | boolean | readonly (string | number)[];
|
|
20
|
+
|
|
21
|
+
/** Условие на поле: `{ equals: 'draft' }`, `{ in: ['a', 'b'] }`. */
|
|
22
|
+
export type WhereCondition = Partial<Record<WhereOperator, WhereValue>>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Условие запроса (M08), как в REST: поле (путь через точку: `seo.title`) → оператор → значение,
|
|
26
|
+
* плюс `and` / `or` списками условий.
|
|
27
|
+
*/
|
|
28
|
+
export interface Where {
|
|
29
|
+
and?: Where[];
|
|
30
|
+
or?: Where[];
|
|
31
|
+
[path: string]: WhereCondition | Where[] | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Условие, которое нельзя передать в query: без него запрос вернул бы лишние документы. */
|
|
35
|
+
export class WhereQueryError extends Error {
|
|
36
|
+
override name = 'WhereQueryError';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* where → плоские ключи qs: `where[_status][equals]=draft`, `where[or][0][title][like]=x`,
|
|
41
|
+
* списки — по индексу (`where[id][in][0]=…`): сервер разбирает qs (src/common/http/query-parser.ts).
|
|
42
|
+
* `undefined` пропускается. Пустой список (`{ id: { in: [] } }`) и пустая строка в query не
|
|
43
|
+
* передаются (qs их теряет) — запрос ушёл бы без условия и вернул бы всё: вместо этого
|
|
44
|
+
* `WhereQueryError` (пустой выбор проверяйте до запроса). Пустое условие внутри where
|
|
45
|
+
* (`{ title: {} }`, `or: [{}]`) — тоже ошибка: выпав, оно сменило бы смысл `or`.
|
|
46
|
+
*/
|
|
47
|
+
export function whereQuery(
|
|
48
|
+
where: Where | undefined,
|
|
49
|
+
prefix = 'where',
|
|
50
|
+
): Record<string, QueryValue> {
|
|
51
|
+
const result: Record<string, QueryValue> = {};
|
|
52
|
+
const walk = (node: unknown, key: string): void => {
|
|
53
|
+
if (node === undefined) return;
|
|
54
|
+
if (Array.isArray(node)) {
|
|
55
|
+
if (node.length === 0)
|
|
56
|
+
throw new WhereQueryError(
|
|
57
|
+
`where: пустой список в «${key}» нельзя передать в запросе — без условия он вернул бы все документы; проверьте пустой список до запроса`,
|
|
58
|
+
);
|
|
59
|
+
node.forEach((item: unknown, i) => walk(item, `${key}[${i}]`));
|
|
60
|
+
} else if (typeof node === 'object' && node !== null) {
|
|
61
|
+
const defined = Object.values(node).some((v) => v !== undefined);
|
|
62
|
+
// Пустое условие внутри where (`{ title: {} }`, `or: [{}]`) выпало бы и сменило смысл
|
|
63
|
+
if (!defined && key !== prefix)
|
|
64
|
+
throw new WhereQueryError(
|
|
65
|
+
`where: пустое условие в «${key}» — укажите оператор или уберите условие`,
|
|
66
|
+
);
|
|
67
|
+
for (const [name, value] of Object.entries(node))
|
|
68
|
+
walk(value, `${key}[${name}]`);
|
|
69
|
+
} else if (node === '' || node === null) {
|
|
70
|
+
throw new WhereQueryError(
|
|
71
|
+
`where: пустое значение в «${key}» нельзя передать в запросе — для «нет значения» используйте { exists: false }`,
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
result[key] = node as QueryValue;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
walk(where ?? {}, prefix);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { KBadge } from '../ui/index.js';
|
|
4
|
+
import { actionView } from './audit-view.js';
|
|
5
|
+
|
|
6
|
+
/** Действие записи журнала — KBadge с тоном из заметок к макету (Изменение — info и т.д.). */
|
|
7
|
+
const props = defineProps<{ action: string }>();
|
|
8
|
+
const view = computed(() => actionView(props.action));
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<KBadge :tone="view.tone">{{ view.label }}</KBadge>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { AuditActor } from '../api/audit.js';
|
|
4
|
+
import { KAvatar } from '../ui/index.js';
|
|
5
|
+
import { actorName } from './audit-view.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Автор записи: KAvatar с инициалами + имя; гость («Аноним») и код («Система») — аватар-иконка,
|
|
9
|
+
* имя fg-muted. `withEmail` — email под именем (шторка; приходит только Администратору).
|
|
10
|
+
*/
|
|
11
|
+
const props = defineProps<{ actor: AuditActor; withEmail?: boolean }>();
|
|
12
|
+
const isUser = computed(() => props.actor.type === 'user');
|
|
13
|
+
const name = computed(() => actorName(props.actor));
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<span class="flex min-w-0 items-center gap-2">
|
|
18
|
+
<KAvatar size="sm" :name="isUser ? name : undefined" />
|
|
19
|
+
<span class="flex min-w-0 flex-col">
|
|
20
|
+
<span
|
|
21
|
+
:class="[
|
|
22
|
+
'truncate typo-body',
|
|
23
|
+
isUser ? 'text-fg-default' : 'text-fg-muted',
|
|
24
|
+
]"
|
|
25
|
+
>{{ name }}</span
|
|
26
|
+
>
|
|
27
|
+
<span
|
|
28
|
+
v-if="withEmail && actor.email"
|
|
29
|
+
class="truncate typo-caption text-fg-muted"
|
|
30
|
+
>{{ actor.email }}</span
|
|
31
|
+
>
|
|
32
|
+
</span>
|
|
33
|
+
</span>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { useRoute } from 'vue-router';
|
|
4
|
+
import type { AuditEntry } from '../api/audit.js';
|
|
5
|
+
import { formatDateTime, formatTimeOfDay } from '../format.js';
|
|
6
|
+
import { KCard } from '../ui/index.js';
|
|
7
|
+
import AuditActionBadge from './AuditActionBadge.vue';
|
|
8
|
+
import {
|
|
9
|
+
actorName,
|
|
10
|
+
entryCaption,
|
|
11
|
+
entryLink,
|
|
12
|
+
entryNote,
|
|
13
|
+
entryTitle,
|
|
14
|
+
} from './audit-view.js';
|
|
15
|
+
import { useAuditContext } from './useAuditContext.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Запись журнала карточкой на мобильном (KCard Interactive): вся карточка — ссылка на ту же
|
|
19
|
+
* страницу с `?entry=<id>` (шторка подробностей). Журнал: заголовок, раздел с пометкой, бейдж,
|
|
20
|
+
* автор · время. История (`history`): дата и время, подробности из meta, бейдж, автор.
|
|
21
|
+
*/
|
|
22
|
+
const props = defineProps<{ entry: AuditEntry; history?: boolean }>();
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
const { config, access } = useAuditContext();
|
|
25
|
+
// Сущность можно открыть — заголовок цветом ссылки, как в таблице (переход — в шторке)
|
|
26
|
+
const linked = computed(
|
|
27
|
+
() =>
|
|
28
|
+
!props.history &&
|
|
29
|
+
entryLink(props.entry, config.value, access.value) !== undefined,
|
|
30
|
+
);
|
|
31
|
+
const to = computed(() => ({
|
|
32
|
+
query: { ...route.query, entry: props.entry.id },
|
|
33
|
+
}));
|
|
34
|
+
const title = computed(() =>
|
|
35
|
+
props.history
|
|
36
|
+
? (formatDateTime(props.entry.createdAt) ?? '')
|
|
37
|
+
: entryTitle(props.entry),
|
|
38
|
+
);
|
|
39
|
+
const description = computed(() =>
|
|
40
|
+
props.history
|
|
41
|
+
? (entryNote(props.entry) ?? '—')
|
|
42
|
+
: entryCaption(props.entry, config.value),
|
|
43
|
+
);
|
|
44
|
+
const byline = computed(() =>
|
|
45
|
+
props.history
|
|
46
|
+
? actorName(props.entry.actor)
|
|
47
|
+
: `${actorName(props.entry.actor)} · ${formatTimeOfDay(props.entry.createdAt)}`,
|
|
48
|
+
);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<KCard
|
|
53
|
+
:to="to"
|
|
54
|
+
:title="title"
|
|
55
|
+
:description="description"
|
|
56
|
+
:data-entry="entry.id"
|
|
57
|
+
>
|
|
58
|
+
<template #title>
|
|
59
|
+
<span :class="linked && 'text-accent-text'">{{ title }}</span>
|
|
60
|
+
</template>
|
|
61
|
+
<span class="flex min-w-0 flex-wrap items-center gap-2">
|
|
62
|
+
<AuditActionBadge :action="entry.action" />
|
|
63
|
+
<span class="min-w-0 truncate typo-caption text-fg-muted">{{
|
|
64
|
+
byline
|
|
65
|
+
}}</span>
|
|
66
|
+
</span>
|
|
67
|
+
</KCard>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { ApiError } from '../api/api-error.js';
|
|
4
|
+
import { type AuditEntry, useAuditEntry } from '../api/audit.js';
|
|
5
|
+
import LoadError from '../layout/LoadError.vue';
|
|
6
|
+
import { KDrawer, KEmptyState, KSkeleton } from '../ui/index.js';
|
|
7
|
+
import AuditDrawerActions from './AuditDrawerActions.vue';
|
|
8
|
+
import AuditEntryBody from './AuditEntryBody.vue';
|
|
9
|
+
import { entryTitle } from './audit-view.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Шторка подробностей записи журнала (KDrawer справа, 400; на мобильном — во всю ширину).
|
|
13
|
+
* Открыта, пока в URL есть `?entry=<id>`. Запись из списка (`preview`) рисуется сразу,
|
|
14
|
+
* «было → стало» — после `GET /_audit/:id`. Записи нет или она не видна (404) — «не найдена».
|
|
15
|
+
*/
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
entryId?: string;
|
|
18
|
+
preview?: AuditEntry;
|
|
19
|
+
history?: boolean;
|
|
20
|
+
}>();
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
close: [];
|
|
23
|
+
documentEntries: [slug: string, id: string];
|
|
24
|
+
openEntry: [id: string];
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const { data: detail, error, refetch } = useAuditEntry(() => props.entryId);
|
|
28
|
+
const entry = computed<AuditEntry | undefined>(() =>
|
|
29
|
+
detail.value?.id === props.entryId
|
|
30
|
+
? detail.value
|
|
31
|
+
: props.preview?.id === props.entryId
|
|
32
|
+
? props.preview
|
|
33
|
+
: undefined,
|
|
34
|
+
);
|
|
35
|
+
const notFound = computed(
|
|
36
|
+
() => error.value instanceof ApiError && error.value.status === 404,
|
|
37
|
+
);
|
|
38
|
+
const title = computed(() =>
|
|
39
|
+
entry.value
|
|
40
|
+
? entryTitle(entry.value)
|
|
41
|
+
: notFound.value
|
|
42
|
+
? 'Запись не найдена'
|
|
43
|
+
: 'Запись журнала',
|
|
44
|
+
);
|
|
45
|
+
const open = computed({
|
|
46
|
+
get: () => props.entryId !== undefined,
|
|
47
|
+
set: (value) => {
|
|
48
|
+
if (!value) emit('close');
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<KDrawer v-model:open="open" :title="title">
|
|
55
|
+
<KEmptyState
|
|
56
|
+
v-if="notFound"
|
|
57
|
+
:heading-level="3"
|
|
58
|
+
title="Запись не найдена"
|
|
59
|
+
description="Её удалили по сроку хранения или у вас нет к ней доступа."
|
|
60
|
+
/>
|
|
61
|
+
<LoadError
|
|
62
|
+
v-else-if="error && !entry"
|
|
63
|
+
title="Не удалось загрузить запись"
|
|
64
|
+
:message="error.message"
|
|
65
|
+
@retry="refetch()"
|
|
66
|
+
/>
|
|
67
|
+
<AuditEntryBody
|
|
68
|
+
v-else-if="entry"
|
|
69
|
+
:entry="entry"
|
|
70
|
+
:detail="detail?.id === entryId ? detail : undefined"
|
|
71
|
+
/>
|
|
72
|
+
<div v-else class="flex flex-col gap-3" aria-busy="true">
|
|
73
|
+
<KSkeleton class="w-40" />
|
|
74
|
+
<KSkeleton shape="block" class="h-40" />
|
|
75
|
+
<span class="sr-only">Загрузка…</span>
|
|
76
|
+
</div>
|
|
77
|
+
<template v-if="entry" #footer>
|
|
78
|
+
<AuditDrawerActions
|
|
79
|
+
:entry="entry"
|
|
80
|
+
:history="history"
|
|
81
|
+
@document-entries="(slug, id) => emit('documentEntries', slug, id)"
|
|
82
|
+
@open-entry="emit('openEntry', $event)"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
</KDrawer>
|
|
86
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { RouterLink } from 'vue-router';
|
|
4
|
+
import { type AuditEntry, useCascadeOwnerEntry } from '../api/audit.js';
|
|
5
|
+
import { KButton } from '../ui/index.js';
|
|
6
|
+
import { authUserLink, cascadeFrom, entryLink } from './audit-view.js';
|
|
7
|
+
import { useAuditContext } from './useAuditContext.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Действия шторки (футер): «Записи документа» — журнал с фильтром по документу (не в истории
|
|
11
|
+
* документа — там он и так); открыть документ, global, роль или пользователя — если можно; у
|
|
12
|
+
* каскада — «Запись удаления владельца» (отдельный запрос; записи нет или не видна — кнопки нет).
|
|
13
|
+
*/
|
|
14
|
+
const props = defineProps<{ entry: AuditEntry; history?: boolean }>();
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
documentEntries: [slug: string, id: string];
|
|
17
|
+
openEntry: [id: string];
|
|
18
|
+
}>();
|
|
19
|
+
const { config, access } = useAuditContext();
|
|
20
|
+
|
|
21
|
+
const cascade = computed(() =>
|
|
22
|
+
props.entry.action === 'delete' ? cascadeFrom(props.entry) : undefined,
|
|
23
|
+
);
|
|
24
|
+
const owner = useCascadeOwnerEntry(cascade);
|
|
25
|
+
const target = computed(() => {
|
|
26
|
+
const to =
|
|
27
|
+
entryLink(props.entry, config.value, access.value) ??
|
|
28
|
+
authUserLink(props.entry, access.value);
|
|
29
|
+
if (!to) return undefined;
|
|
30
|
+
const label: Record<string, string> = {
|
|
31
|
+
collection: 'Открыть документ',
|
|
32
|
+
global: 'Открыть global',
|
|
33
|
+
user: 'Открыть пользователя',
|
|
34
|
+
auth: 'Открыть пользователя',
|
|
35
|
+
role: 'Открыть роль',
|
|
36
|
+
};
|
|
37
|
+
return { to, label: label[props.entry.entityType] ?? 'Открыть' };
|
|
38
|
+
});
|
|
39
|
+
const documentEntries = computed(() =>
|
|
40
|
+
!props.history &&
|
|
41
|
+
props.entry.entityType === 'collection' &&
|
|
42
|
+
props.entry.entitySlug &&
|
|
43
|
+
props.entry.entityId
|
|
44
|
+
? { slug: props.entry.entitySlug, id: props.entry.entityId }
|
|
45
|
+
: undefined,
|
|
46
|
+
);
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<KButton
|
|
51
|
+
v-if="documentEntries"
|
|
52
|
+
variant="secondary"
|
|
53
|
+
class="max-md:w-full"
|
|
54
|
+
@click="emit('documentEntries', documentEntries.slug, documentEntries.id)"
|
|
55
|
+
>
|
|
56
|
+
Записи документа
|
|
57
|
+
</KButton>
|
|
58
|
+
<KButton
|
|
59
|
+
v-if="owner.data.value"
|
|
60
|
+
class="max-md:w-full"
|
|
61
|
+
@click="emit('openEntry', owner.data.value.id)"
|
|
62
|
+
>
|
|
63
|
+
Запись удаления владельца
|
|
64
|
+
</KButton>
|
|
65
|
+
<RouterLink v-if="target" v-slot="{ navigate }" :to="target.to" custom>
|
|
66
|
+
<KButton class="max-md:w-full" @click="navigate">{{
|
|
67
|
+
target.label
|
|
68
|
+
}}</KButton>
|
|
69
|
+
</RouterLink>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { AuditEntry, AuditEntryDetail } from '../api/audit.js';
|
|
4
|
+
import { pluralize } from '../format.js';
|
|
5
|
+
import { KAlert, KSkeleton } from '../ui/index.js';
|
|
6
|
+
import AuditActionBadge from './AuditActionBadge.vue';
|
|
7
|
+
import AuditEntryChanges from './AuditEntryChanges.vue';
|
|
8
|
+
import AuditEntryFacts from './AuditEntryFacts.vue';
|
|
9
|
+
import AuditRestoredVersion from './AuditRestoredVersion.vue';
|
|
10
|
+
import {
|
|
11
|
+
cascadeFrom,
|
|
12
|
+
collectionLabel,
|
|
13
|
+
entryKind,
|
|
14
|
+
metaNumber,
|
|
15
|
+
} from './audit-view.js';
|
|
16
|
+
import { useAuditContext } from './useAuditContext.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Тело шторки записи (Penpot: Audit / Подробности и Drawer / …): бейдж и раздел; у каскада —
|
|
20
|
+
* KAlert warning «Удалён каскадом», у блокировки входа — KAlert danger; кто / когда / откуда;
|
|
21
|
+
* у восстановления — «Восстановлена версия»; «было → стало» — когда загружена запись целиком.
|
|
22
|
+
*/
|
|
23
|
+
const props = defineProps<{ entry: AuditEntry; detail?: AuditEntryDetail }>();
|
|
24
|
+
const { config } = useAuditContext();
|
|
25
|
+
const cascade = computed(() =>
|
|
26
|
+
props.entry.action === 'delete' ? cascadeFrom(props.entry) : undefined,
|
|
27
|
+
);
|
|
28
|
+
const lock = computed(() => {
|
|
29
|
+
if (props.entry.action !== 'login_locked') return undefined;
|
|
30
|
+
const minutes = metaNumber(props.entry, 'lockoutMinutes');
|
|
31
|
+
const attempts = metaNumber(props.entry, 'maxFailedAttempts');
|
|
32
|
+
return {
|
|
33
|
+
title:
|
|
34
|
+
minutes === undefined
|
|
35
|
+
? 'Вход заблокирован'
|
|
36
|
+
: `Вход заблокирован на ${pluralize(minutes, ['минуту', 'минуты', 'минут'])}`,
|
|
37
|
+
description:
|
|
38
|
+
attempts === undefined
|
|
39
|
+
? undefined
|
|
40
|
+
: `После ${pluralize(attempts, ['неудачной попытки', 'неудачных попыток', 'неудачных попыток'])} подряд.`,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div class="flex flex-col gap-4">
|
|
47
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
48
|
+
<AuditActionBadge :action="entry.action" />
|
|
49
|
+
<span class="typo-caption text-fg-muted">{{
|
|
50
|
+
entryKind(entry, config)
|
|
51
|
+
}}</span>
|
|
52
|
+
</div>
|
|
53
|
+
<KAlert
|
|
54
|
+
v-if="cascade"
|
|
55
|
+
tone="warning"
|
|
56
|
+
title="Удалён каскадом"
|
|
57
|
+
:description="`Вместе с документом-владельцем из коллекции «${collectionLabel(cascade.collection, config)}».`"
|
|
58
|
+
/>
|
|
59
|
+
<KAlert
|
|
60
|
+
v-if="lock"
|
|
61
|
+
tone="danger"
|
|
62
|
+
:title="lock.title"
|
|
63
|
+
:description="lock.description"
|
|
64
|
+
/>
|
|
65
|
+
<AuditEntryFacts :entry="entry" />
|
|
66
|
+
<AuditRestoredVersion v-if="entry.action === 'restore'" :entry="entry" />
|
|
67
|
+
<AuditEntryChanges v-if="detail" :entry="detail" />
|
|
68
|
+
<div v-else class="flex flex-col gap-3" aria-busy="true">
|
|
69
|
+
<KSkeleton class="w-32" />
|
|
70
|
+
<KSkeleton shape="block" class="h-16" />
|
|
71
|
+
<span class="sr-only">Загрузка изменений…</span>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { AdminField } from '../api/admin-fields.js';
|
|
4
|
+
import type { AuditEntryDetail } from '../api/audit.js';
|
|
5
|
+
import {
|
|
6
|
+
applyCollectionAccess,
|
|
7
|
+
applyGlobalAccess,
|
|
8
|
+
} from '../api/permissions.js';
|
|
9
|
+
import DiffTree from '../documents/versions/DiffTree.vue';
|
|
10
|
+
import DiffValue from '../documents/versions/DiffValue.vue';
|
|
11
|
+
import { KBadge, KSeparator } from '../ui/index.js';
|
|
12
|
+
import { permissionRows, plainDiffs } from './audit-changes.js';
|
|
13
|
+
import { useAuditContext } from './useAuditContext.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* «Было → стало» записи (шторка): документы и globals — DiffTree из истории версий (M10.1) с
|
|
17
|
+
* подписями полей из _config; пользователи и роли — пары «Было / Стало», у роли ещё права с
|
|
18
|
+
* бейджами Добавлено / Снято / Изменено; коллекции, которой нет в конфиге, — значения JSON.
|
|
19
|
+
* Нечего показать (вход, сессии) — раздела нет.
|
|
20
|
+
*/
|
|
21
|
+
const props = defineProps<{ entry: AuditEntryDetail }>();
|
|
22
|
+
const { config, access } = useAuditContext();
|
|
23
|
+
|
|
24
|
+
const fields = computed<AdminField[]>(() => {
|
|
25
|
+
const { entityType, entitySlug: slug } = props.entry;
|
|
26
|
+
if (!slug || !config.value) return [];
|
|
27
|
+
if (entityType === 'collection') {
|
|
28
|
+
const found = config.value.collections.find((c) => c.slug === slug);
|
|
29
|
+
return found
|
|
30
|
+
? applyCollectionAccess(found, access.value?.collections[slug]).fields
|
|
31
|
+
: [];
|
|
32
|
+
}
|
|
33
|
+
if (entityType === 'global') {
|
|
34
|
+
const found = config.value.globals.find((g) => g.slug === slug);
|
|
35
|
+
return found
|
|
36
|
+
? applyGlobalAccess(found, access.value?.globals?.[slug]).fields
|
|
37
|
+
: [];
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
});
|
|
41
|
+
const plain = computed(() => (props.entry.diff ? [] : plainDiffs(props.entry)));
|
|
42
|
+
const permissions = computed(() => permissionRows(props.entry, config.value));
|
|
43
|
+
const visible = computed(
|
|
44
|
+
() =>
|
|
45
|
+
(props.entry.diff?.length ?? 0) > 0 ||
|
|
46
|
+
plain.value.length > 0 ||
|
|
47
|
+
permissions.value.length > 0,
|
|
48
|
+
);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<section
|
|
53
|
+
v-if="visible"
|
|
54
|
+
class="flex flex-col gap-4"
|
|
55
|
+
aria-labelledby="audit-changes"
|
|
56
|
+
>
|
|
57
|
+
<KSeparator />
|
|
58
|
+
<h3 id="audit-changes" class="typo-heading-3 text-fg-default">
|
|
59
|
+
Было → стало
|
|
60
|
+
</h3>
|
|
61
|
+
<DiffTree v-if="entry.diff" :fields="fields" :changes="entry.diff" />
|
|
62
|
+
<ul v-if="plain.length" class="flex flex-col gap-4">
|
|
63
|
+
<li v-for="item in plain" :key="item.change.name">
|
|
64
|
+
<DiffValue :label="item.label" :change="item.change" />
|
|
65
|
+
</li>
|
|
66
|
+
</ul>
|
|
67
|
+
<section
|
|
68
|
+
v-if="permissions.length"
|
|
69
|
+
class="flex flex-col gap-2"
|
|
70
|
+
aria-label="Права"
|
|
71
|
+
>
|
|
72
|
+
<span class="typo-label text-fg-default">Права</span>
|
|
73
|
+
<ul class="flex flex-col gap-2">
|
|
74
|
+
<li
|
|
75
|
+
v-for="row in permissions"
|
|
76
|
+
:key="row.key"
|
|
77
|
+
class="flex flex-wrap items-center justify-between gap-x-3 gap-y-1"
|
|
78
|
+
>
|
|
79
|
+
<span class="typo-body text-fg-default">{{ row.resource }}</span>
|
|
80
|
+
<span class="flex items-center gap-2">
|
|
81
|
+
<span class="typo-caption text-fg-muted">{{ row.action }}</span>
|
|
82
|
+
<KBadge :tone="row.status.tone">{{ row.status.label }}</KBadge>
|
|
83
|
+
</span>
|
|
84
|
+
</li>
|
|
85
|
+
</ul>
|
|
86
|
+
</section>
|
|
87
|
+
</section>
|
|
88
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { AuditEntry } from '../api/audit.js';
|
|
4
|
+
import AuditActor from './AuditActor.vue';
|
|
5
|
+
import { browserLabel, formatFullDateTime, reasonLabel } from './audit-view.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Кто / Когда / откуда (шторка): автор (email — только Администратору), у неудачного входа —
|
|
9
|
+
* email маской и причина, время с секундами, IP, браузер коротко, request id (связь с логами).
|
|
10
|
+
* Пустого (вызов из кода) — «—».
|
|
11
|
+
*/
|
|
12
|
+
const props = defineProps<{ entry: AuditEntry }>();
|
|
13
|
+
const failedLogin = computed(() => props.entry.action === 'login_failed');
|
|
14
|
+
const browser = computed(() => browserLabel(props.entry.userAgent));
|
|
15
|
+
const reason = computed(() => reasonLabel(props.entry));
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<dl class="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-3 gap-y-3">
|
|
20
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Кто</dt>
|
|
21
|
+
<dd><AuditActor :actor="entry.actor" with-email /></dd>
|
|
22
|
+
<template v-if="failedLogin && entry.entityLabel">
|
|
23
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Email</dt>
|
|
24
|
+
<dd class="break-words typo-body text-fg-default">
|
|
25
|
+
{{ entry.entityLabel }}
|
|
26
|
+
</dd>
|
|
27
|
+
</template>
|
|
28
|
+
<template v-if="reason">
|
|
29
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Причина</dt>
|
|
30
|
+
<dd class="typo-body text-fg-default">{{ reason }}</dd>
|
|
31
|
+
</template>
|
|
32
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Когда</dt>
|
|
33
|
+
<dd class="typo-body text-fg-default">
|
|
34
|
+
<time :datetime="entry.createdAt">{{
|
|
35
|
+
formatFullDateTime(entry.createdAt)
|
|
36
|
+
}}</time>
|
|
37
|
+
</dd>
|
|
38
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">IP</dt>
|
|
39
|
+
<dd class="typo-code text-fg-default">{{ entry.ip ?? '—' }}</dd>
|
|
40
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Браузер</dt>
|
|
41
|
+
<dd class="break-words typo-body text-fg-default">{{ browser ?? '—' }}</dd>
|
|
42
|
+
<dt class="pt-0.5 typo-caption text-fg-muted">Request id</dt>
|
|
43
|
+
<dd class="break-all typo-code text-fg-muted">
|
|
44
|
+
{{ entry.requestId ?? '—' }}
|
|
45
|
+
</dd>
|
|
46
|
+
</dl>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { KButton, KTag } from '../ui/index.js';
|
|
3
|
+
import { type AuditFilters, hasFilters } from './audit-filters.js';
|
|
4
|
+
import AuditFilterControls from './AuditFilterControls.vue';
|
|
5
|
+
import AuditSearch from './AuditSearch.vue';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Панель фильтров над таблицей (md и шире, Penpot: строка фильтров в карточке): поиск, действие,
|
|
9
|
+
* раздел, пользователь, период; «Записи документа» — тег с крестиком; «Сбросить» (ghost) — при
|
|
10
|
+
* активных фильтрах.
|
|
11
|
+
*/
|
|
12
|
+
defineProps<{
|
|
13
|
+
filters: AuditFilters;
|
|
14
|
+
actorNames?: ReadonlyMap<string, string>;
|
|
15
|
+
}>();
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
change: [patch: Partial<AuditFilters>];
|
|
18
|
+
search: [q: string];
|
|
19
|
+
reset: [];
|
|
20
|
+
}>();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div
|
|
25
|
+
class="flex flex-wrap items-center gap-x-3 gap-y-3 border-b border-border-default p-4"
|
|
26
|
+
role="search"
|
|
27
|
+
aria-label="Фильтры журнала"
|
|
28
|
+
>
|
|
29
|
+
<div class="w-72">
|
|
30
|
+
<AuditSearch
|
|
31
|
+
:model-value="filters.q"
|
|
32
|
+
@update:model-value="emit('search', $event)"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<AuditFilterControls
|
|
36
|
+
layout="bar"
|
|
37
|
+
:filters="filters"
|
|
38
|
+
:actor-names="actorNames"
|
|
39
|
+
@change="emit('change', $event)"
|
|
40
|
+
/>
|
|
41
|
+
<KTag
|
|
42
|
+
v-if="filters.entityId"
|
|
43
|
+
label="Записи одного документа"
|
|
44
|
+
@remove="emit('change', { entityId: undefined })"
|
|
45
|
+
/>
|
|
46
|
+
<KButton
|
|
47
|
+
v-if="hasFilters(filters)"
|
|
48
|
+
variant="ghost"
|
|
49
|
+
size="sm"
|
|
50
|
+
@click="emit('reset')"
|
|
51
|
+
>
|
|
52
|
+
Сбросить
|
|
53
|
+
</KButton>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|