cx-chat 0.0.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/.cursor/rules/i18n-cn-gloss-comments.mdc +31 -0
- package/.cursor/rules/list-page-view-pageconfig.mdc +32 -0
- package/.cursor/rules/no-over-defensive-programming.mdc +90 -0
- package/.cursor/rules/requirement-description-for-agent.mdc +33 -0
- package/.cursor/rules/use-showToast-not-antd-message.mdc +28 -0
- package/.docker/Dockerfile +7 -0
- package/.env +9 -0
- package/.env.development +7 -0
- package/.env.production +7 -0
- package/.gitlab-ci/docker-build.yaml +28 -0
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +42 -0
- package/.gitlab-ci/npm-build.yaml +17 -0
- package/.gitlab-ci.yml +8 -0
- package/.k8s/0-namespace.yaml +6 -0
- package/.k8s/1-configmap-web.yaml +7 -0
- package/.k8s/1-nginx-conf-dev.yaml +110 -0
- package/.k8s/2-deployment.yaml +27 -0
- package/.k8s/3-service.yaml +16 -0
- package/.k8s/4-ingress-dev.yaml +30 -0
- package/.lingma/rules/use-showToast-not-antd-message.md +34 -0
- package/.nginx/nginx.conf +52 -0
- package/.prettierrc +9 -0
- package/README.md +1 -0
- package/eslint.config.js +32 -0
- package/index.html +13 -0
- package/package.json +67 -0
- package/postcss.config.js +6 -0
- package/public/favicon.ico +0 -0
- package/public/vite.svg +1 -0
- package/src/App.tsx +96 -0
- package/src/_doc/0.docs-overview.md +28 -0
- package/src/_doc/cx-ui/0.docs-overview.md +30 -0
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +82 -0
- package/src/_doc/cx-ui/comp.2.cx-modal.md +82 -0
- package/src/_doc/cx-ui/comp.3.cx-button.md +89 -0
- package/src/_doc/cx-ui/comp.4.cx-form.md +72 -0
- package/src/_doc/cx-ui/comp.5.cx-fields.md +76 -0
- package/src/_doc/cx-ui/comp.6.cx-tag.md +57 -0
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +29 -0
- package/src/_doc/meta/0.docs-overview.md +24 -0
- package/src/_doc/meta/comp.1.enum-runtime.md +33 -0
- package/src/_doc/meta/comp.2.dict-runtime.md +39 -0
- package/src/_doc/router/0.docs-overview.md +14 -0
- package/src/_doc/router/guide.1.menu-component-config.md +181 -0
- package/src/_doc/router/guide.2.router-auto-registration.md +114 -0
- package/src/_doc/table-view/0.docs-overview.md +30 -0
- package/src/_doc/table-view/comp.1.table-view.md +542 -0
- package/src/_doc/table-view/props.1.create-table-view-config.md +193 -0
- package/src/_doc/table-view/props.2.table-view-search-fields.md +106 -0
- package/src/api/_mock/README.md +340 -0
- package/src/api/_mock/api.ts +1642 -0
- package/src/api/_mock/bundle-shim.ts +16 -0
- package/src/api/_mock/handler-shim.ts +6 -0
- package/src/api/_mock/handler.ts +458 -0
- package/src/api/_mock/index.ts +711 -0
- package/src/api/_mock/interceptor.ts +15 -0
- package/src/api/_mock/mod.ts +12 -0
- package/src/api/_mock/utils.ts +65 -0
- package/src/api/base/memory.js +24 -0
- package/src/api/chat.js +210 -0
- package/src/api/common/auth.js +70 -0
- package/src/api/menus/business-rules.js +76 -0
- package/src/api/menus/feedback.js +102 -0
- package/src/api/menus/knowledge.js +159 -0
- package/src/api/menus/model-metadata/manage.js +70 -0
- package/src/api/menus/model-metadata/role.js +50 -0
- package/src/api/menus/model-metadata/training-detail-mock-data.js +569 -0
- package/src/api/menus/model-metadata/training.js +28 -0
- package/src/api/menus/skill.js +40 -0
- package/src/api/system/agent-config.js +16 -0
- package/src/api/system/department.js +94 -0
- package/src/api/system/dict.js +86 -0
- package/src/api/system/menu.js +37 -0
- package/src/api/system/permission.js +26 -0
- package/src/api/system/role.js +34 -0
- package/src/api/system/sys-config.js +16 -0
- package/src/api/system/sys-log.js +17 -0
- package/src/api/system/user.js +75 -0
- package/src/api/upload.js +39 -0
- package/src/assets/react.svg +1 -0
- package/src/components/auth/current-user-avatar.tsx +77 -0
- package/src/components/common/code-view.tsx +149 -0
- package/src/components/common/detail-link.tsx +67 -0
- package/src/components/common/error-boundary.tsx +98 -0
- package/src/components/common/language-switcher.tsx +91 -0
- package/src/components/common/lite-table/index.tsx +135 -0
- package/src/components/common/md-editor.tsx +126 -0
- package/src/components/common/modal/confirm-dialog.tsx +113 -0
- package/src/components/common/modal/dep-user-select-multi.tsx +324 -0
- package/src/components/common/modal/dep-user-select.tsx +249 -0
- package/src/components/common/modal/user-select-multi.tsx +266 -0
- package/src/components/common/pagination.tsx +472 -0
- package/src/components/common/path.tsx +175 -0
- package/src/components/common/system-logo-mark.tsx +48 -0
- package/src/components/cx-ui/button/index.less +208 -0
- package/src/components/cx-ui/button/index.tsx +611 -0
- package/src/components/cx-ui/checkbox/index.tsx +78 -0
- package/src/components/cx-ui/date-picker/index.less +17 -0
- package/src/components/cx-ui/date-picker/index.tsx +193 -0
- package/src/components/cx-ui/drawer/index.tsx +47 -0
- package/src/components/cx-ui/empty-state/index.tsx +20 -0
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +89 -0
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +283 -0
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +41 -0
- package/src/components/cx-ui/form/CxForm.tsx +15 -0
- package/src/components/cx-ui/form/index.tsx +20 -0
- package/src/components/cx-ui/form-item/index.less +26 -0
- package/src/components/cx-ui/form-item/index.tsx +36 -0
- package/src/components/cx-ui/index.ts +70 -0
- package/src/components/cx-ui/input/auto-complete.tsx +134 -0
- package/src/components/cx-ui/input/index.tsx +259 -0
- package/src/components/cx-ui/input-number/index.jsx +66 -0
- package/src/components/cx-ui/modal/index.jsx +212 -0
- package/src/components/cx-ui/modal/index.less +144 -0
- package/src/components/cx-ui/modal/useCxModal.ts +125 -0
- package/src/components/cx-ui/multi-select/index.jsx +74 -0
- package/src/components/cx-ui/multi-select/index.less +40 -0
- package/src/components/cx-ui/multi-select/index2.tsx +361 -0
- package/src/components/cx-ui/radio/index.tsx +33 -0
- package/src/components/cx-ui/range-picker/index.less +65 -0
- package/src/components/cx-ui/range-picker/index.tsx +219 -0
- package/src/components/cx-ui/select/index.less +34 -0
- package/src/components/cx-ui/select/index.tsx +196 -0
- package/src/components/cx-ui/skeleton/index.tsx +12 -0
- package/src/components/cx-ui/steps/index.tsx +14 -0
- package/src/components/cx-ui/styles/_tokens.less +79 -0
- package/src/components/cx-ui/styles/index.less +246 -0
- package/src/components/cx-ui/switch/index.less +106 -0
- package/src/components/cx-ui/switch/index.tsx +120 -0
- package/src/components/cx-ui/table/index.less +160 -0
- package/src/components/cx-ui/table/index.tsx +152 -0
- package/src/components/cx-ui/tabs/index.less +15 -0
- package/src/components/cx-ui/tabs/index.tsx +34 -0
- package/src/components/cx-ui/tag/index.less +51 -0
- package/src/components/cx-ui/tag/index.tsx +140 -0
- package/src/components/cx-ui/timeline/index.tsx +14 -0
- package/src/components/cx-ui/tooltip/index.tsx +67 -0
- package/src/components/cx-ui/tree/index.tsx +193 -0
- package/src/components/cx-ui/tree-select/index.jsx +91 -0
- package/src/components/cx-ui/tree-select/index.less +27 -0
- package/src/components/cx-ui/upload-file/index.less +223 -0
- package/src/components/cx-ui/upload-file/index.tsx +640 -0
- package/src/components/cx-ui/upload-img/index.tsx +291 -0
- package/src/components/layout/components/Header.tsx +216 -0
- package/src/components/layout/components/Sidebar.tsx +717 -0
- package/src/components/layout/index.tsx +95 -0
- package/src/components/table-view/components/search-area.tsx +411 -0
- package/src/components/table-view/components/table-view-config.tsx +528 -0
- package/src/components/table-view/components/table-view.types.ts +478 -0
- package/src/components/table-view/components/tree-api-normalize.ts +38 -0
- package/src/components/table-view/components/tree-data-annotate.ts +31 -0
- package/src/components/table-view/components/tree-sidebar.tsx +74 -0
- package/src/components/table-view/index.tsx +61 -0
- package/src/components/table-view/list-page-view.tsx +1049 -0
- package/src/components/table-view/select-table-view.tsx +1094 -0
- package/src/components/table-view/styles/select-table-view.less +51 -0
- package/src/config/default-system-name.ts +9 -0
- package/src/config/system.ts +165 -0
- package/src/constants/countryCodes.ts +3 -0
- package/src/contexts/AuthContext.tsx +256 -0
- package/src/contexts/ChatContext.tsx +839 -0
- package/src/contexts/MenuContext.tsx +62 -0
- package/src/contexts/ToastContext.tsx +181 -0
- package/src/hooks/useCopyToClipboard.ts +47 -0
- package/src/hooks/useModalSubmit.ts +104 -0
- package/src/hooks/useRouter.ts +240 -0
- package/src/hooks/useStepForm.ts +46 -0
- package/src/hooks/useStickyHeader.ts +42 -0
- package/src/hooks/useThreadActions.ts +105 -0
- package/src/hooks/useUserPreferences.ts +101 -0
- package/src/http/axios.js +372 -0
- package/src/http/mock.interceptor.ts +9 -0
- package/src/http/obfuscationKey.ts +41 -0
- package/src/i18n.ts +60 -0
- package/src/index.js +1 -0
- package/src/index.less +169 -0
- package/src/locales/en/auth.ts +70 -0
- package/src/locales/en/base/memory.ts +28 -0
- package/src/locales/en/base/settings.ts +41 -0
- package/src/locales/en/chat.ts +40 -0
- package/src/locales/en/common.ts +173 -0
- package/src/locales/en/enum.ts +27 -0
- package/src/locales/en/menus/business-rules.ts +48 -0
- package/src/locales/en/menus/feedback.ts +62 -0
- package/src/locales/en/menus/knowledge.ts +120 -0
- package/src/locales/en/menus/model-metadata/index.ts +10 -0
- package/src/locales/en/menus/model-metadata/manage.ts +151 -0
- package/src/locales/en/menus/model-metadata/role.ts +48 -0
- package/src/locales/en/menus/model-metadata/training.ts +65 -0
- package/src/locales/en/menus/skill.ts +34 -0
- package/src/locales/en/system/agent-config.ts +34 -0
- package/src/locales/en/system/department.ts +68 -0
- package/src/locales/en/system/dict.ts +44 -0
- package/src/locales/en/system/menu.ts +45 -0
- package/src/locales/en/system/permission.ts +89 -0
- package/src/locales/en/system/role.ts +25 -0
- package/src/locales/en/system/sys-config.ts +33 -0
- package/src/locales/en/system/sys-log.ts +38 -0
- package/src/locales/en/system/user.ts +113 -0
- package/src/locales/en.ts +68 -0
- package/src/locales/zh/auth.ts +70 -0
- package/src/locales/zh/base/memory.ts +29 -0
- package/src/locales/zh/base/settings.ts +41 -0
- package/src/locales/zh/chat.ts +47 -0
- package/src/locales/zh/common.ts +178 -0
- package/src/locales/zh/enum.ts +28 -0
- package/src/locales/zh/menus/business-rules.ts +47 -0
- package/src/locales/zh/menus/feedback.ts +62 -0
- package/src/locales/zh/menus/knowledge.ts +117 -0
- package/src/locales/zh/menus/model-metadata/index.ts +10 -0
- package/src/locales/zh/menus/model-metadata/manage.ts +151 -0
- package/src/locales/zh/menus/model-metadata/role.ts +47 -0
- package/src/locales/zh/menus/model-metadata/training.ts +64 -0
- package/src/locales/zh/menus/skill.ts +34 -0
- package/src/locales/zh/system/agent-config.ts +33 -0
- package/src/locales/zh/system/department.ts +69 -0
- package/src/locales/zh/system/dict.ts +44 -0
- package/src/locales/zh/system/menu.ts +47 -0
- package/src/locales/zh/system/permission.ts +94 -0
- package/src/locales/zh/system/role.ts +25 -0
- package/src/locales/zh/system/sys-config.ts +32 -0
- package/src/locales/zh/system/sys-log.ts +38 -0
- package/src/locales/zh/system/user.ts +114 -0
- package/src/locales/zh.ts +67 -0
- package/src/main.tsx +50 -0
- package/src/meta/const/index.ts +40 -0
- package/src/meta/index-dict.ts +56 -0
- package/src/meta/index-enum.ts +95 -0
- package/src/meta/index.ts +14 -0
- package/src/meta/module/dict-data/runtime.ts +199 -0
- package/src/meta/module/dict-data/types.ts +17 -0
- package/src/meta/module/enum-data/runtime.ts +75 -0
- package/src/meta/module/enum-data/types.ts +18 -0
- package/src/router/index.tsx +312 -0
- package/src/styles/AntdThemeProvider.tsx +40 -0
- package/src/styles/antd-theme.ts +20 -0
- package/src/styles/global.less +107 -0
- package/src/styles/variable.less +103 -0
- package/src/types/feedback.ts +43 -0
- package/src/types/index.ts +85 -0
- package/src/types/menu.ts +43 -0
- package/src/utils/aesUtil.ts +123 -0
- package/src/utils/chatUtils.ts +524 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/crypto.ts +164 -0
- package/src/utils/date.ts +72 -0
- package/src/utils/file-icons.tsx +79 -0
- package/src/utils/index.ts +168 -0
- package/src/utils/markdown-math-plugins.ts +21 -0
- package/src/utils/menuI18n.ts +305 -0
- package/src/utils/menuRouteRegistry.ts +78 -0
- package/src/utils/permission-crud.ts +147 -0
- package/src/utils/routeConfig.ts +350 -0
- package/src/utils/storage.ts +135 -0
- package/src/utils/toastBridge.ts +26 -0
- package/src/utils/url.ts +38 -0
- package/src/utils/validation.ts +16 -0
- package/src/views/auth/auth-code/index.less +169 -0
- package/src/views/auth/auth-code/index.module.less +174 -0
- package/src/views/auth/auth-code/index.tsx +233 -0
- package/src/views/auth/login.tsx +498 -0
- package/src/views/auth/register.tsx +388 -0
- package/src/views/base/memory/index.tsx +136 -0
- package/src/views/base/memory/modal/detail-modal.tsx +89 -0
- package/src/views/base/memory/modal/submit-modal.tsx +134 -0
- package/src/views/base/settings/index.tsx +657 -0
- package/src/views/chat/chat.less +323 -0
- package/src/views/chat/components/chat-input.tsx +298 -0
- package/src/views/chat/components/header-thread-title.tsx +210 -0
- package/src/views/chat/components/message-list/content-answer.tsx +100 -0
- package/src/views/chat/components/message-list/content-question.tsx +18 -0
- package/src/views/chat/components/message-list/index.tsx +520 -0
- package/src/views/chat/components/message-list/message-item.tsx +199 -0
- package/src/views/chat/components/message-list/preparation-demo-items.ts +147 -0
- package/src/views/chat/components/message-list/preparation-steps.tsx +506 -0
- package/src/views/chat/components/message-list/suggestion-list.tsx +36 -0
- package/src/views/chat/components/message-list/thinking-process.tsx +49 -0
- package/src/views/chat/components/message-list/toolbar.tsx +224 -0
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +214 -0
- package/src/views/chat/components/references-knowledge/context.tsx +57 -0
- package/src/views/chat/components/references-knowledge/index.ts +9 -0
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +556 -0
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +529 -0
- package/src/views/chat/components/references-knowledge/panel.tsx +115 -0
- package/src/views/chat/hooks/use-chat-common.ts +19 -0
- package/src/views/chat/index-session.tsx +647 -0
- package/src/views/chat/index.tsx +127 -0
- package/src/views/page-error/401.tsx +56 -0
- package/src/views/page-error/404.tsx +56 -0
- package/src/views/page-menus/business-rules/index.tsx +376 -0
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +186 -0
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +272 -0
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +142 -0
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +471 -0
- package/src/views/page-menus/feedback/index.tsx +166 -0
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +367 -0
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +32 -0
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +330 -0
- package/src/views/page-menus/knowledge/detail.tsx +600 -0
- package/src/views/page-menus/knowledge/index.tsx +337 -0
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +618 -0
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +550 -0
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +99 -0
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +349 -0
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +88 -0
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +283 -0
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +179 -0
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +114 -0
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +232 -0
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +316 -0
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +134 -0
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +134 -0
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +101 -0
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +338 -0
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +276 -0
- package/src/views/page-menus/model-metadata/manage/detail.tsx +298 -0
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +113 -0
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +20 -0
- package/src/views/page-menus/model-metadata/manage/index.tsx +304 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +374 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +151 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +423 -0
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +218 -0
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +261 -0
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +196 -0
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +229 -0
- package/src/views/page-menus/model-metadata/manage/submit.tsx +31 -0
- package/src/views/page-menus/model-metadata/role/index.tsx +207 -0
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +97 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +254 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +393 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +120 -0
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +698 -0
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +237 -0
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +135 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +4 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +72 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +196 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +153 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +103 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +82 -0
- package/src/views/page-menus/model-metadata/training/detail.tsx +159 -0
- package/src/views/page-menus/model-metadata/training/index.tsx +236 -0
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +154 -0
- package/src/views/page-menus/skill/index.tsx +201 -0
- package/src/views/page-menus/skill/modal/detail-modal.tsx +156 -0
- package/src/views/page-menus/skill/modal/submit-modal.tsx +214 -0
- package/src/views/page-system/agent-config/index.tsx +370 -0
- package/src/views/page-system/department/departmentFormShared.ts +36 -0
- package/src/views/page-system/department/index.tsx +541 -0
- package/src/views/page-system/department/modal/detail-modal.tsx +94 -0
- package/src/views/page-system/department/modal/member-role-modal.tsx +128 -0
- package/src/views/page-system/department/modal/submit-modal.tsx +265 -0
- package/src/views/page-system/dict/index.tsx +440 -0
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +315 -0
- package/src/views/page-system/dict/modal/submit-modal.tsx +184 -0
- package/src/views/page-system/logs/components/index.ts +3 -0
- package/src/views/page-system/logs/components/log-message-demo.tsx +30 -0
- package/src/views/page-system/logs/components/log-message-stream.ts +184 -0
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +100 -0
- package/src/views/page-system/logs/components/message-list/content-question.tsx +18 -0
- package/src/views/page-system/logs/components/message-list/index.tsx +515 -0
- package/src/views/page-system/logs/components/message-list/message-item.tsx +193 -0
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +147 -0
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +506 -0
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +36 -0
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +49 -0
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +134 -0
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +214 -0
- package/src/views/page-system/logs/components/message-modal.tsx +239 -0
- package/src/views/page-system/logs/index.tsx +132 -0
- package/src/views/page-system/logs/modal/detail-modal.tsx +157 -0
- package/src/views/page-system/menu/components/menuFormShared.ts +283 -0
- package/src/views/page-system/menu/index.less +12 -0
- package/src/views/page-system/menu/index.tsx +410 -0
- package/src/views/page-system/menu/modal/icon-modal.less +51 -0
- package/src/views/page-system/menu/modal/icon-modal.tsx +87 -0
- package/src/views/page-system/menu/modal/submit-modal.tsx +263 -0
- package/src/views/page-system/permission/index.tsx +562 -0
- package/src/views/page-system/permission/modal/detail-modal.tsx +179 -0
- package/src/views/page-system/permission/modal/submit-modal.less +146 -0
- package/src/views/page-system/permission/modal/submit-modal.tsx +650 -0
- package/src/views/page-system/role/index.tsx +163 -0
- package/src/views/page-system/role/modal/detail-modal.tsx +127 -0
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +86 -0
- package/src/views/page-system/role/modal/permission-modal.tsx +111 -0
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +21 -0
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +916 -0
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +1047 -0
- package/src/views/page-system/role/modal/submit-modal.tsx +193 -0
- package/src/views/page-system/sys-config/index.tsx +294 -0
- package/src/views/page-system/user/components/user-role-column.tsx +87 -0
- package/src/views/page-system/user/index.tsx +439 -0
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +389 -0
- package/src/views/page-system/user/modal/detail-modal.tsx +72 -0
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +40 -0
- package/src/views/page-system/user/modal/submit-modal.less +40 -0
- package/src/views/page-system/user/modal/submit-modal.tsx +287 -0
- package/src/views/page-system/user/userFormShared.ts +51 -0
- package/tailwind.config.js +17 -0
- package/tsconfig.app.json +48 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +264 -0
package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { TAG_COLOR } from '@/meta'
|
|
2
|
+
import { CodeView } from '@/components/common/code-view'
|
|
3
|
+
import { CxTag } from '@cx-ui'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { buildOperationDetailLines } from './summary-lines'
|
|
6
|
+
import type { SummaryLine, SummarySeg } from './summary-lines'
|
|
7
|
+
import type { TrainingChangeCategory, TrainingChangeFlatRow, TrainingChangeOp } from './types'
|
|
8
|
+
|
|
9
|
+
/** 变更前/后对比值:半透明白/暗层叠在彩色详情底上 */
|
|
10
|
+
const changeValueBoxClass =
|
|
11
|
+
'inline-block max-w-full whitespace-pre-wrap break-words rounded border border-black/[0.06] bg-white/75 px-1.5 py-0.5 font-semibold text-gray-900 shadow-sm dark:border-white/12 dark:bg-black/30 dark:text-gray-100 dark:shadow-none'
|
|
12
|
+
|
|
13
|
+
function opLabel(t: (k: string) => string, op: TrainingChangeOp) {
|
|
14
|
+
if (op === 'added') return t('menus.model_metadata.training.change_added')
|
|
15
|
+
if (op === 'modified') return t('menus.model_metadata.training.change_modified')
|
|
16
|
+
return t('menus.model_metadata.training.change_removed')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function changeOpTagColor(op: TrainingChangeOp): string {
|
|
20
|
+
if (op === 'added') return TAG_COLOR.success
|
|
21
|
+
if (op === 'modified') return TAG_COLOR.warning
|
|
22
|
+
return TAG_COLOR.error
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function categoryScopeLabel(t: (k: string) => string, category: TrainingChangeCategory) {
|
|
26
|
+
if (category === 'tables') return t('menus.model_metadata.manage.step2_title')
|
|
27
|
+
if (category === 'documents') return t('menus.model_metadata.training.change_section_documents')
|
|
28
|
+
return t('menus.model_metadata.training.change_section_example_sql')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 右侧变更详情框:按操作类型(新增 / 修改 / 删除) */
|
|
32
|
+
function opDetailPanelClass(op: TrainingChangeOp): string {
|
|
33
|
+
if (op === 'added') {
|
|
34
|
+
return 'border-emerald-200/90 bg-emerald-50/90 dark:border-emerald-800/45 dark:bg-emerald-950/30'
|
|
35
|
+
}
|
|
36
|
+
if (op === 'modified') {
|
|
37
|
+
return 'border-amber-200/90 bg-amber-50/90 dark:border-amber-800/40 dark:bg-amber-950/25'
|
|
38
|
+
}
|
|
39
|
+
return 'border-rose-200/90 bg-rose-50/90 dark:border-rose-800/45 dark:bg-rose-950/30'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function renderSeg(seg: SummarySeg, i: number) {
|
|
43
|
+
if (typeof seg === 'string') {
|
|
44
|
+
return (
|
|
45
|
+
<span key={i} className="whitespace-pre-wrap break-words">
|
|
46
|
+
{seg}
|
|
47
|
+
</span>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
if (seg.role === 'changeBefore') {
|
|
51
|
+
return (
|
|
52
|
+
<span key={i} className={changeValueBoxClass}>
|
|
53
|
+
{seg.text}
|
|
54
|
+
</span>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
if (seg.role === 'changeAfter') {
|
|
58
|
+
return (
|
|
59
|
+
<span key={i} className={changeValueBoxClass}>
|
|
60
|
+
{seg.text}
|
|
61
|
+
</span>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
if (seg.role === 'sqlSnippet') {
|
|
65
|
+
return (
|
|
66
|
+
<div key={i} className="min-w-0 w-full max-w-full">
|
|
67
|
+
<CodeView.SQL maxHeight={260} className="text-xs">
|
|
68
|
+
{seg.text}
|
|
69
|
+
</CodeView.SQL>
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function renderDetailLine(line: SummaryLine, li: number, t: (k: string) => string) {
|
|
77
|
+
if (line.length === 1 && typeof line[0] === 'object' && line[0].role === 'changeSqlPair') {
|
|
78
|
+
const p = line[0]
|
|
79
|
+
return (
|
|
80
|
+
<div key={li} className="flex min-w-0 flex-col gap-2">
|
|
81
|
+
<div className="text-sm font-medium text-gray-800 dark:text-gray-100">{p.fieldLabel}</div>
|
|
82
|
+
<div className="flex min-w-0 flex-col gap-1.5">
|
|
83
|
+
<span className="text-xs font-medium text-gray-500 dark:text-gray-400">
|
|
84
|
+
{t('menus.model_metadata.training.detail_sql_before')}
|
|
85
|
+
</span>
|
|
86
|
+
<CodeView.SQL maxHeight={220} className="text-xs">
|
|
87
|
+
{p.before}
|
|
88
|
+
</CodeView.SQL>
|
|
89
|
+
<span className="text-xs font-medium text-gray-500 dark:text-gray-400">
|
|
90
|
+
{t('menus.model_metadata.training.detail_sql_after')}
|
|
91
|
+
</span>
|
|
92
|
+
<CodeView.SQL maxHeight={220} className="text-xs">
|
|
93
|
+
{p.after}
|
|
94
|
+
</CodeView.SQL>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
const layoutCol = line.some((s) => typeof s === 'object' && s.role === 'sqlSnippet')
|
|
100
|
+
return (
|
|
101
|
+
<div
|
|
102
|
+
key={li}
|
|
103
|
+
className={
|
|
104
|
+
layoutCol
|
|
105
|
+
? 'flex min-w-0 flex-col gap-1.5 items-stretch'
|
|
106
|
+
: 'flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-1'
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
{line.map((seg, si) => renderSeg(seg, si))}
|
|
110
|
+
</div>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function renderDetailLines(category: TrainingChangeCategory, op: TrainingChangeOp, item: any, t: (k: string) => string) {
|
|
115
|
+
const detailLines = buildOperationDetailLines(t, category, op, item)
|
|
116
|
+
return (
|
|
117
|
+
<div className="flex min-w-0 flex-1 flex-col gap-2 text-sm leading-relaxed text-gray-800 dark:text-gray-100">
|
|
118
|
+
{detailLines.map((line, li) => renderDetailLine(line, li, t))}
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type Props = {
|
|
124
|
+
rows: TrainingChangeFlatRow[]
|
|
125
|
+
showScope?: boolean
|
|
126
|
+
className?: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default function SummaryList({ rows, showScope = true, className }: Props) {
|
|
130
|
+
const { t } = useTranslation()
|
|
131
|
+
if (!rows.length) return null
|
|
132
|
+
return (
|
|
133
|
+
<div className={`flex min-w-0 flex-col gap-2 text-sm leading-relaxed text-gray-800 dark:text-gray-100 ${className ?? ''}`}>
|
|
134
|
+
{rows.map((r) => (
|
|
135
|
+
<div key={r.key} className="min-w-0">
|
|
136
|
+
<div className="flex min-w-0 flex-col gap-1.5">
|
|
137
|
+
{showScope ? (
|
|
138
|
+
<span className="text-xs text-gray-500 dark:text-gray-400">{categoryScopeLabel(t, r.category)}</span>
|
|
139
|
+
) : null}
|
|
140
|
+
<div className="flex min-w-0 flex-wrap items-start gap-2">
|
|
141
|
+
<CxTag color={changeOpTagColor(r.op)} className="shrink-0">
|
|
142
|
+
{opLabel(t, r.op)}
|
|
143
|
+
</CxTag>
|
|
144
|
+
<div className={`min-w-0 flex-1 rounded-md border px-3 py-2 ${opDetailPanelClass(r.op)}`}>
|
|
145
|
+
{renderDetailLines(r.category, r.op, r.item, t)}
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
))}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CxTimeline } from '@cx-ui'
|
|
2
|
+
import { Clock } from 'lucide-react'
|
|
3
|
+
import { useMemo } from 'react'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import RecordNodeCard from './node-card'
|
|
6
|
+
import { parseTrainingRowContent, type TrainingDetailItem } from './types'
|
|
7
|
+
|
|
8
|
+
function MetadataCreateSummary({ c }: { c: any }) {
|
|
9
|
+
const { t } = useTranslation()
|
|
10
|
+
if (!c || c.event !== 'metadata_create') return null
|
|
11
|
+
const lines: { label: string; value: string }[] = []
|
|
12
|
+
if (c.subject) {
|
|
13
|
+
lines.push({ label: t('menus.model_metadata.training.fields.subject'), value: String(c.subject) })
|
|
14
|
+
}
|
|
15
|
+
if (c.operatorName) {
|
|
16
|
+
lines.push({ label: t('menus.model_metadata.training.change_operator'), value: String(c.operatorName) })
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<div className="w-full min-w-0 rounded-md border border-blue-100 bg-blue-50/80 px-3 py-2 text-sm text-gray-800 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-gray-100">
|
|
20
|
+
<div className="mb-2 font-medium text-blue-800 dark:text-blue-200">
|
|
21
|
+
{t('menus.model_metadata.training.change_metadata_create')}
|
|
22
|
+
</div>
|
|
23
|
+
{lines.length ? (
|
|
24
|
+
<div className="flex flex-col gap-1.5 leading-relaxed">
|
|
25
|
+
{lines.map((line, i) => (
|
|
26
|
+
<div key={i} className="min-w-0 break-words">
|
|
27
|
+
<span className="text-gray-600 dark:text-gray-400">{line.label}:</span>
|
|
28
|
+
<span className="text-gray-900 dark:text-gray-100">{line.value}</span>
|
|
29
|
+
</div>
|
|
30
|
+
))}
|
|
31
|
+
</div>
|
|
32
|
+
) : (
|
|
33
|
+
<span className="text-gray-500 dark:text-gray-400">—</span>
|
|
34
|
+
)}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type RecordsTimelineProps = {
|
|
40
|
+
details: TrainingDetailItem[]
|
|
41
|
+
summaryPreviewLimit?: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function RecordsTimeline({ details, summaryPreviewLimit }: RecordsTimelineProps) {
|
|
45
|
+
const { t } = useTranslation()
|
|
46
|
+
|
|
47
|
+
const items = useMemo(() => {
|
|
48
|
+
const ordered = [...details].reverse()
|
|
49
|
+
return ordered.map((row) => {
|
|
50
|
+
const c = parseTrainingRowContent(row)
|
|
51
|
+
const isCreate = c?.event === 'metadata_create'
|
|
52
|
+
const content = (
|
|
53
|
+
<div className="w-full min-w-0 max-w-full pt-0.5">
|
|
54
|
+
{row.updateBy ? (
|
|
55
|
+
<div className="mb-2 text-xs text-gray-500 dark:text-gray-400">
|
|
56
|
+
{t(isCreate ? 'common.creator' : 'menus.model_metadata.training.detail_cols.updateBy')}:{row.updateBy}
|
|
57
|
+
</div>
|
|
58
|
+
) : null}
|
|
59
|
+
{isCreate ? (
|
|
60
|
+
<MetadataCreateSummary c={c} />
|
|
61
|
+
) : (
|
|
62
|
+
<RecordNodeCard row={row} summaryPreviewLimit={summaryPreviewLimit} />
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
return {
|
|
67
|
+
title: (
|
|
68
|
+
<div className="flex min-w-0 flex-col gap-1 pr-1 text-right">
|
|
69
|
+
<span className="break-words text-base font-semibold leading-snug text-gray-900 dark:text-gray-100">
|
|
70
|
+
{row.schemaVersion ?? '—'}
|
|
71
|
+
</span>
|
|
72
|
+
<span className="break-words text-base font-normal leading-snug text-gray-600 dark:text-gray-400">
|
|
73
|
+
{row.updateTime ?? '—'}
|
|
74
|
+
</span>
|
|
75
|
+
</div>
|
|
76
|
+
),
|
|
77
|
+
content,
|
|
78
|
+
color: 'blue' as const,
|
|
79
|
+
icon: <Clock className="size-5 shrink-0" aria-hidden strokeWidth={2} />,
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}, [details, t, summaryPreviewLimit])
|
|
83
|
+
|
|
84
|
+
if (!details.length) {
|
|
85
|
+
return (
|
|
86
|
+
<div className="rounded-lg border border-dashed border-gray-300 py-10 text-center text-sm text-gray-400 dark:border-gray-600">
|
|
87
|
+
{t('menus.model_metadata.training.detail_empty_details')}
|
|
88
|
+
</div>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div className="w-full min-w-0 max-w-full rounded-lg border border-gray-200 bg-white px-3 py-3 dark:border-gray-700 dark:bg-gray-800/40 md:px-4 md:py-4">
|
|
94
|
+
<CxTimeline
|
|
95
|
+
orientation="vertical"
|
|
96
|
+
mode="start"
|
|
97
|
+
titleSpan="300px"
|
|
98
|
+
items={items}
|
|
99
|
+
className="training-change-timeline w-full min-w-0 text-left [&_.ant-timeline-item-header]:text-start [&_.ant-timeline-item-content]:!max-w-none [&_.ant-timeline-item-content]:w-full [&_.ant-timeline-item-content]:min-w-0 [&_.ant-timeline-item-content]:text-left [&_.ant-timeline-item-section]:min-w-0 [&_.ant-timeline-item-wrapper]:max-w-full"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type TrainingChangeOp = 'added' | 'modified' | 'removed'
|
|
2
|
+
|
|
3
|
+
export type TrainingChangeCategory = 'tables' | 'documents' | 'exampleSql'
|
|
4
|
+
|
|
5
|
+
export type TrainingChangeFlatRow = {
|
|
6
|
+
key: string
|
|
7
|
+
op: TrainingChangeOp
|
|
8
|
+
category: TrainingChangeCategory
|
|
9
|
+
schemaVersion?: string
|
|
10
|
+
updateTime?: string
|
|
11
|
+
updateBy?: string
|
|
12
|
+
item: any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TrainingDetailItem = {
|
|
16
|
+
id?: string
|
|
17
|
+
schemaVersion?: string
|
|
18
|
+
updateBy?: string
|
|
19
|
+
updateTime?: string
|
|
20
|
+
changeContentRaw?: string
|
|
21
|
+
changeContent?: any
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function parseTrainingRowContent(row: TrainingDetailItem) {
|
|
25
|
+
if (row?.changeContent != null && typeof row.changeContent === 'object') return row.changeContent
|
|
26
|
+
const raw = row?.changeContentRaw
|
|
27
|
+
if (raw == null || raw === '') return null
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(String(raw))
|
|
30
|
+
} catch {
|
|
31
|
+
return null
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function flattenOneCategory(
|
|
36
|
+
c: any,
|
|
37
|
+
category: TrainingChangeCategory,
|
|
38
|
+
meta: { schemaVersion?: string; updateTime?: string; updateBy?: string; detailId?: string },
|
|
39
|
+
): TrainingChangeFlatRow[] {
|
|
40
|
+
const rows: TrainingChangeFlatRow[] = []
|
|
41
|
+
if (!c || c.event === 'metadata_create') return rows
|
|
42
|
+
|
|
43
|
+
const pushOpList = (list: any[] | undefined, op: TrainingChangeOp) => {
|
|
44
|
+
if (!Array.isArray(list)) return
|
|
45
|
+
list.forEach((item: any, i: number) => {
|
|
46
|
+
rows.push({
|
|
47
|
+
key: `${meta.detailId ?? 'd'}-${category}-${op}-${i}-${item?.id ?? item?.code ?? ''}`,
|
|
48
|
+
op,
|
|
49
|
+
category,
|
|
50
|
+
schemaVersion: meta.schemaVersion,
|
|
51
|
+
updateTime: meta.updateTime,
|
|
52
|
+
updateBy: meta.updateBy,
|
|
53
|
+
item,
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (category === 'tables') {
|
|
59
|
+
const legacy = c.tables
|
|
60
|
+
if (legacy && typeof legacy === 'object') {
|
|
61
|
+
pushOpList(legacy.added, 'added')
|
|
62
|
+
pushOpList(legacy.modified, 'modified')
|
|
63
|
+
pushOpList(legacy.removed, 'removed')
|
|
64
|
+
return rows
|
|
65
|
+
}
|
|
66
|
+
const sch = c.schema
|
|
67
|
+
if (sch && typeof sch === 'object') {
|
|
68
|
+
pushOpList(sch.tablesAdded, 'added')
|
|
69
|
+
pushOpList(sch.tablesModified, 'modified')
|
|
70
|
+
pushOpList(sch.tablesRemoved, 'removed')
|
|
71
|
+
return rows
|
|
72
|
+
}
|
|
73
|
+
return rows
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const grp = c[category]
|
|
77
|
+
if (!grp || typeof grp !== 'object') return rows
|
|
78
|
+
pushOpList(grp.added, 'added')
|
|
79
|
+
pushOpList(grp.modified, 'modified')
|
|
80
|
+
pushOpList(grp.removed, 'removed')
|
|
81
|
+
return rows
|
|
82
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { getModelMetadataTrainingDetailAPI } from '@api/menus/model-metadata/training'
|
|
2
|
+
import { CxButton, CxTag } from '@cx-ui'
|
|
3
|
+
import { Form, Spin } from 'antd'
|
|
4
|
+
import { ChevronLeft, GraduationCap } from 'lucide-react'
|
|
5
|
+
import { useEffect, useState } from 'react'
|
|
6
|
+
import { useTranslation } from 'react-i18next'
|
|
7
|
+
import { useNavigate, useParams } from 'react-router-dom'
|
|
8
|
+
|
|
9
|
+
import RecordsTimeline, { type TrainingDetailItem } from './components/detail-records'
|
|
10
|
+
|
|
11
|
+
/** 时间线节点内操作摘要最多展示条数;超出部分通过「查看更多」在弹框中查看 */
|
|
12
|
+
const TRAINING_CHANGE_SUMMARY_PREVIEW_LIMIT = 5
|
|
13
|
+
|
|
14
|
+
type TrainingDetail = {
|
|
15
|
+
id?: string
|
|
16
|
+
metadataId?: string
|
|
17
|
+
subject?: string
|
|
18
|
+
schemaVersion?: string
|
|
19
|
+
syncStatus?: number
|
|
20
|
+
syncTime?: string
|
|
21
|
+
createTime?: string
|
|
22
|
+
createBy?: string
|
|
23
|
+
updateTime?: string
|
|
24
|
+
updateBy?: string
|
|
25
|
+
details?: TrainingDetailItem[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ModelMetadataTrainingDetailView() {
|
|
29
|
+
const { t } = useTranslation()
|
|
30
|
+
const { metadataId = '', id = '' } = useParams<{ metadataId: string; id: string }>()
|
|
31
|
+
const navigate = useNavigate()
|
|
32
|
+
const [loading, setLoading] = useState(false)
|
|
33
|
+
const [detail, setDetail] = useState<TrainingDetail | null>(null)
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!id) return
|
|
37
|
+
let cancelled = false
|
|
38
|
+
;(async () => {
|
|
39
|
+
setLoading(true)
|
|
40
|
+
try {
|
|
41
|
+
const res = await getModelMetadataTrainingDetailAPI(id)
|
|
42
|
+
const data = (res as any)?.data ?? null
|
|
43
|
+
if (!cancelled) setDetail(data)
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error(e)
|
|
46
|
+
if (!cancelled) setDetail(null)
|
|
47
|
+
} finally {
|
|
48
|
+
if (!cancelled) setLoading(false)
|
|
49
|
+
}
|
|
50
|
+
})()
|
|
51
|
+
return () => {
|
|
52
|
+
cancelled = true
|
|
53
|
+
}
|
|
54
|
+
}, [id])
|
|
55
|
+
|
|
56
|
+
const handleBack = () => {
|
|
57
|
+
if (metadataId) {
|
|
58
|
+
navigate(`/page-menus/model-metadata/training/${encodeURIComponent(metadataId)}`)
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
navigate(-1)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const detailsRows = detail?.details ?? []
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex h-full w-full min-w-0 flex-col">
|
|
68
|
+
<div className="w-full min-w-0 shrink-0 bg-white px-8 pb-6 pt-8 dark:bg-gray-800">
|
|
69
|
+
<div className="flex items-center justify-between">
|
|
70
|
+
<div className="flex min-w-0 flex-1 items-center gap-3">
|
|
71
|
+
<CxButton.Icon
|
|
72
|
+
className="!p-2.5 shrink-0 rounded-lg border border-solid border-gray-300 bg-white shadow-sm dark:border-gray-600 dark:bg-gray-900"
|
|
73
|
+
type="default"
|
|
74
|
+
icon={<ChevronLeft size={22} strokeWidth={2.25} />}
|
|
75
|
+
onClick={handleBack}
|
|
76
|
+
title={t('common.back')}
|
|
77
|
+
tooltipTone="default"
|
|
78
|
+
/>
|
|
79
|
+
<h1 className="flex min-w-0 flex-wrap items-center gap-3 bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-3xl font-bold text-transparent">
|
|
80
|
+
<GraduationCap className="shrink-0 text-blue-400" size={32} aria-hidden />
|
|
81
|
+
<span className="min-w-0">{t('menus.model_metadata.training.detail_page_title')}</span>
|
|
82
|
+
</h1>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-auto p-6">
|
|
88
|
+
{loading ? (
|
|
89
|
+
<div className="flex flex-1 justify-center py-20">
|
|
90
|
+
<Spin size="large" />
|
|
91
|
+
</div>
|
|
92
|
+
) : !detail ? (
|
|
93
|
+
<div className="flex flex-1 justify-center py-12 text-sm text-gray-500">{t('common.no_data')}</div>
|
|
94
|
+
) : (
|
|
95
|
+
<div className="flex w-full min-w-0 flex-1 flex-col">
|
|
96
|
+
<Form className="w-full shrink-0" layout="horizontal" colon>
|
|
97
|
+
<div className="grid grid-cols-1 md:grid-cols-4">
|
|
98
|
+
<Form.Item label={t('menus.model_metadata.training.fields.subject')} className="!mb-0">
|
|
99
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
100
|
+
{detail.subject ?? '-'}
|
|
101
|
+
</div>
|
|
102
|
+
</Form.Item>
|
|
103
|
+
<Form.Item label={t('menus.model_metadata.training.fields.schemaVersion')} className="!mb-0">
|
|
104
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
105
|
+
{detail.schemaVersion ?? '-'}
|
|
106
|
+
</div>
|
|
107
|
+
</Form.Item>
|
|
108
|
+
<Form.Item label={t('menus.model_metadata.training.fields.syncStatus')} className="!mb-0">
|
|
109
|
+
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
110
|
+
{Number(detail.syncStatus) === 1 ? (
|
|
111
|
+
<CxTag color="green">{t('menus.model_metadata.training.sync_status_1')}</CxTag>
|
|
112
|
+
) : (
|
|
113
|
+
<CxTag color="default">{t('menus.model_metadata.training.sync_status_0')}</CxTag>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
</Form.Item>
|
|
117
|
+
<Form.Item label={t('menus.model_metadata.training.fields.syncTime')} className="!mb-0">
|
|
118
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
119
|
+
{detail.syncTime ?? '-'}
|
|
120
|
+
</div>
|
|
121
|
+
</Form.Item>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div className="mt-3 grid grid-cols-1 md:grid-cols-4">
|
|
125
|
+
<Form.Item label={t('common.creator')} className="!mb-0">
|
|
126
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
127
|
+
{detail.createBy ?? '-'}
|
|
128
|
+
</div>
|
|
129
|
+
</Form.Item>
|
|
130
|
+
<Form.Item label={t('common.create_time')} className="!mb-0">
|
|
131
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
132
|
+
{detail.createTime ?? '-'}
|
|
133
|
+
</div>
|
|
134
|
+
</Form.Item>
|
|
135
|
+
<Form.Item label={t('common.update_time')} className="!mb-0">
|
|
136
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
137
|
+
{detail.updateTime ?? '-'}
|
|
138
|
+
</div>
|
|
139
|
+
</Form.Item>
|
|
140
|
+
<Form.Item label={t('menus.model_metadata.training.fields.updateBy')} className="!mb-0">
|
|
141
|
+
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
142
|
+
{detail.updateBy ?? '-'}
|
|
143
|
+
</div>
|
|
144
|
+
</Form.Item>
|
|
145
|
+
</div>
|
|
146
|
+
</Form>
|
|
147
|
+
|
|
148
|
+
<div className="mt-4 w-full min-w-0 shrink-0">
|
|
149
|
+
<h3 className="mb-3 text-base font-medium">{t('menus.model_metadata.training.detail_list_title')}</h3>
|
|
150
|
+
<RecordsTimeline details={detailsRows} summaryPreviewLimit={TRAINING_CHANGE_SUMMARY_PREVIEW_LIMIT} />
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default ModelMetadataTrainingDetailView
|