cx-chat 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cx-chat.css +1 -0
- package/dist/cx-chat.es.js +68257 -0
- package/dist/cx-chat.umd.js +492 -0
- package/package.json +27 -3
- package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
- package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
- package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
- package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
- package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
- package/.docker/Dockerfile +0 -7
- package/.env +0 -9
- package/.env.development +0 -7
- package/.env.production +0 -7
- package/.gitlab-ci/docker-build.yaml +0 -28
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
- package/.gitlab-ci/npm-build.yaml +0 -17
- package/.gitlab-ci.yml +0 -8
- package/.k8s/0-namespace.yaml +0 -6
- package/.k8s/1-configmap-web.yaml +0 -7
- package/.k8s/1-nginx-conf-dev.yaml +0 -110
- package/.k8s/2-deployment.yaml +0 -27
- package/.k8s/3-service.yaml +0 -16
- package/.k8s/4-ingress-dev.yaml +0 -30
- package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
- package/.nginx/nginx.conf +0 -52
- package/.prettierrc +0 -9
- package/eslint.config.js +0 -32
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -96
- package/src/_doc/0.docs-overview.md +0 -28
- package/src/_doc/cx-ui/0.docs-overview.md +0 -30
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
- package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
- package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
- package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
- package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
- package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
- package/src/_doc/meta/0.docs-overview.md +0 -24
- package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
- package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
- package/src/_doc/router/0.docs-overview.md +0 -14
- package/src/_doc/router/guide.1.menu-component-config.md +0 -181
- package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
- package/src/_doc/table-view/0.docs-overview.md +0 -30
- package/src/_doc/table-view/comp.1.table-view.md +0 -542
- package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
- package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
- package/src/api/_mock/README.md +0 -340
- package/src/api/_mock/api.ts +0 -1642
- package/src/api/_mock/bundle-shim.ts +0 -16
- package/src/api/_mock/handler-shim.ts +0 -6
- package/src/api/_mock/handler.ts +0 -458
- package/src/api/_mock/index.ts +0 -711
- package/src/api/_mock/interceptor.ts +0 -15
- package/src/api/_mock/mod.ts +0 -12
- package/src/api/_mock/utils.ts +0 -65
- package/src/api/base/memory.js +0 -24
- package/src/api/chat.js +0 -210
- package/src/api/common/auth.js +0 -70
- package/src/api/menus/business-rules.js +0 -76
- package/src/api/menus/feedback.js +0 -102
- package/src/api/menus/knowledge.js +0 -159
- package/src/api/menus/model-metadata/manage.js +0 -70
- package/src/api/menus/model-metadata/role.js +0 -50
- package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
- package/src/api/menus/model-metadata/training.js +0 -28
- package/src/api/menus/skill.js +0 -40
- package/src/api/system/agent-config.js +0 -16
- package/src/api/system/department.js +0 -94
- package/src/api/system/dict.js +0 -86
- package/src/api/system/menu.js +0 -37
- package/src/api/system/permission.js +0 -26
- package/src/api/system/role.js +0 -34
- package/src/api/system/sys-config.js +0 -16
- package/src/api/system/sys-log.js +0 -17
- package/src/api/system/user.js +0 -75
- package/src/api/upload.js +0 -39
- package/src/assets/react.svg +0 -1
- package/src/components/auth/current-user-avatar.tsx +0 -77
- package/src/components/common/code-view.tsx +0 -149
- package/src/components/common/detail-link.tsx +0 -67
- package/src/components/common/error-boundary.tsx +0 -98
- package/src/components/common/language-switcher.tsx +0 -91
- package/src/components/common/lite-table/index.tsx +0 -135
- package/src/components/common/md-editor.tsx +0 -126
- package/src/components/common/modal/confirm-dialog.tsx +0 -113
- package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
- package/src/components/common/modal/dep-user-select.tsx +0 -249
- package/src/components/common/modal/user-select-multi.tsx +0 -266
- package/src/components/common/pagination.tsx +0 -472
- package/src/components/common/path.tsx +0 -175
- package/src/components/common/system-logo-mark.tsx +0 -48
- package/src/components/cx-ui/button/index.less +0 -208
- package/src/components/cx-ui/button/index.tsx +0 -611
- package/src/components/cx-ui/checkbox/index.tsx +0 -78
- package/src/components/cx-ui/date-picker/index.less +0 -17
- package/src/components/cx-ui/date-picker/index.tsx +0 -193
- package/src/components/cx-ui/drawer/index.tsx +0 -47
- package/src/components/cx-ui/empty-state/index.tsx +0 -20
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
- package/src/components/cx-ui/form/CxForm.tsx +0 -15
- package/src/components/cx-ui/form/index.tsx +0 -20
- package/src/components/cx-ui/form-item/index.less +0 -26
- package/src/components/cx-ui/form-item/index.tsx +0 -36
- package/src/components/cx-ui/index.ts +0 -70
- package/src/components/cx-ui/input/auto-complete.tsx +0 -134
- package/src/components/cx-ui/input/index.tsx +0 -259
- package/src/components/cx-ui/input-number/index.jsx +0 -66
- package/src/components/cx-ui/modal/index.jsx +0 -212
- package/src/components/cx-ui/modal/index.less +0 -144
- package/src/components/cx-ui/modal/useCxModal.ts +0 -125
- package/src/components/cx-ui/multi-select/index.jsx +0 -74
- package/src/components/cx-ui/multi-select/index.less +0 -40
- package/src/components/cx-ui/multi-select/index2.tsx +0 -361
- package/src/components/cx-ui/radio/index.tsx +0 -33
- package/src/components/cx-ui/range-picker/index.less +0 -65
- package/src/components/cx-ui/range-picker/index.tsx +0 -219
- package/src/components/cx-ui/select/index.less +0 -34
- package/src/components/cx-ui/select/index.tsx +0 -196
- package/src/components/cx-ui/skeleton/index.tsx +0 -12
- package/src/components/cx-ui/steps/index.tsx +0 -14
- package/src/components/cx-ui/styles/_tokens.less +0 -79
- package/src/components/cx-ui/styles/index.less +0 -246
- package/src/components/cx-ui/switch/index.less +0 -106
- package/src/components/cx-ui/switch/index.tsx +0 -120
- package/src/components/cx-ui/table/index.less +0 -160
- package/src/components/cx-ui/table/index.tsx +0 -152
- package/src/components/cx-ui/tabs/index.less +0 -15
- package/src/components/cx-ui/tabs/index.tsx +0 -34
- package/src/components/cx-ui/tag/index.less +0 -51
- package/src/components/cx-ui/tag/index.tsx +0 -140
- package/src/components/cx-ui/timeline/index.tsx +0 -14
- package/src/components/cx-ui/tooltip/index.tsx +0 -67
- package/src/components/cx-ui/tree/index.tsx +0 -193
- package/src/components/cx-ui/tree-select/index.jsx +0 -91
- package/src/components/cx-ui/tree-select/index.less +0 -27
- package/src/components/cx-ui/upload-file/index.less +0 -223
- package/src/components/cx-ui/upload-file/index.tsx +0 -640
- package/src/components/cx-ui/upload-img/index.tsx +0 -291
- package/src/components/layout/components/Header.tsx +0 -216
- package/src/components/layout/components/Sidebar.tsx +0 -717
- package/src/components/layout/index.tsx +0 -95
- package/src/components/table-view/components/search-area.tsx +0 -411
- package/src/components/table-view/components/table-view-config.tsx +0 -528
- package/src/components/table-view/components/table-view.types.ts +0 -478
- package/src/components/table-view/components/tree-api-normalize.ts +0 -38
- package/src/components/table-view/components/tree-data-annotate.ts +0 -31
- package/src/components/table-view/components/tree-sidebar.tsx +0 -74
- package/src/components/table-view/index.tsx +0 -61
- package/src/components/table-view/list-page-view.tsx +0 -1049
- package/src/components/table-view/select-table-view.tsx +0 -1094
- package/src/components/table-view/styles/select-table-view.less +0 -51
- package/src/config/default-system-name.ts +0 -9
- package/src/config/system.ts +0 -165
- package/src/constants/countryCodes.ts +0 -3
- package/src/contexts/AuthContext.tsx +0 -256
- package/src/contexts/ChatContext.tsx +0 -839
- package/src/contexts/MenuContext.tsx +0 -62
- package/src/contexts/ToastContext.tsx +0 -181
- package/src/hooks/useCopyToClipboard.ts +0 -47
- package/src/hooks/useModalSubmit.ts +0 -104
- package/src/hooks/useRouter.ts +0 -240
- package/src/hooks/useStepForm.ts +0 -46
- package/src/hooks/useStickyHeader.ts +0 -42
- package/src/hooks/useThreadActions.ts +0 -105
- package/src/hooks/useUserPreferences.ts +0 -101
- package/src/http/axios.js +0 -372
- package/src/http/mock.interceptor.ts +0 -9
- package/src/http/obfuscationKey.ts +0 -41
- package/src/i18n.ts +0 -60
- package/src/index.js +0 -1
- package/src/index.less +0 -169
- package/src/locales/en/auth.ts +0 -70
- package/src/locales/en/base/memory.ts +0 -28
- package/src/locales/en/base/settings.ts +0 -41
- package/src/locales/en/chat.ts +0 -40
- package/src/locales/en/common.ts +0 -173
- package/src/locales/en/enum.ts +0 -27
- package/src/locales/en/menus/business-rules.ts +0 -48
- package/src/locales/en/menus/feedback.ts +0 -62
- package/src/locales/en/menus/knowledge.ts +0 -120
- package/src/locales/en/menus/model-metadata/index.ts +0 -10
- package/src/locales/en/menus/model-metadata/manage.ts +0 -151
- package/src/locales/en/menus/model-metadata/role.ts +0 -48
- package/src/locales/en/menus/model-metadata/training.ts +0 -65
- package/src/locales/en/menus/skill.ts +0 -34
- package/src/locales/en/system/agent-config.ts +0 -34
- package/src/locales/en/system/department.ts +0 -68
- package/src/locales/en/system/dict.ts +0 -44
- package/src/locales/en/system/menu.ts +0 -45
- package/src/locales/en/system/permission.ts +0 -89
- package/src/locales/en/system/role.ts +0 -25
- package/src/locales/en/system/sys-config.ts +0 -33
- package/src/locales/en/system/sys-log.ts +0 -38
- package/src/locales/en/system/user.ts +0 -113
- package/src/locales/en.ts +0 -68
- package/src/locales/zh/auth.ts +0 -70
- package/src/locales/zh/base/memory.ts +0 -29
- package/src/locales/zh/base/settings.ts +0 -41
- package/src/locales/zh/chat.ts +0 -47
- package/src/locales/zh/common.ts +0 -178
- package/src/locales/zh/enum.ts +0 -28
- package/src/locales/zh/menus/business-rules.ts +0 -47
- package/src/locales/zh/menus/feedback.ts +0 -62
- package/src/locales/zh/menus/knowledge.ts +0 -117
- package/src/locales/zh/menus/model-metadata/index.ts +0 -10
- package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
- package/src/locales/zh/menus/model-metadata/role.ts +0 -47
- package/src/locales/zh/menus/model-metadata/training.ts +0 -64
- package/src/locales/zh/menus/skill.ts +0 -34
- package/src/locales/zh/system/agent-config.ts +0 -33
- package/src/locales/zh/system/department.ts +0 -69
- package/src/locales/zh/system/dict.ts +0 -44
- package/src/locales/zh/system/menu.ts +0 -47
- package/src/locales/zh/system/permission.ts +0 -94
- package/src/locales/zh/system/role.ts +0 -25
- package/src/locales/zh/system/sys-config.ts +0 -32
- package/src/locales/zh/system/sys-log.ts +0 -38
- package/src/locales/zh/system/user.ts +0 -114
- package/src/locales/zh.ts +0 -67
- package/src/main.tsx +0 -50
- package/src/meta/const/index.ts +0 -40
- package/src/meta/index-dict.ts +0 -56
- package/src/meta/index-enum.ts +0 -95
- package/src/meta/index.ts +0 -14
- package/src/meta/module/dict-data/runtime.ts +0 -199
- package/src/meta/module/dict-data/types.ts +0 -17
- package/src/meta/module/enum-data/runtime.ts +0 -75
- package/src/meta/module/enum-data/types.ts +0 -18
- package/src/router/index.tsx +0 -312
- package/src/styles/AntdThemeProvider.tsx +0 -40
- package/src/styles/antd-theme.ts +0 -20
- package/src/styles/global.less +0 -107
- package/src/styles/variable.less +0 -103
- package/src/types/feedback.ts +0 -43
- package/src/types/index.ts +0 -85
- package/src/types/menu.ts +0 -43
- package/src/utils/aesUtil.ts +0 -123
- package/src/utils/chatUtils.ts +0 -524
- package/src/utils/cn.ts +0 -6
- package/src/utils/crypto.ts +0 -164
- package/src/utils/date.ts +0 -72
- package/src/utils/file-icons.tsx +0 -79
- package/src/utils/index.ts +0 -168
- package/src/utils/markdown-math-plugins.ts +0 -21
- package/src/utils/menuI18n.ts +0 -305
- package/src/utils/menuRouteRegistry.ts +0 -78
- package/src/utils/permission-crud.ts +0 -147
- package/src/utils/routeConfig.ts +0 -350
- package/src/utils/storage.ts +0 -135
- package/src/utils/toastBridge.ts +0 -26
- package/src/utils/url.ts +0 -38
- package/src/utils/validation.ts +0 -16
- package/src/views/auth/auth-code/index.less +0 -169
- package/src/views/auth/auth-code/index.module.less +0 -174
- package/src/views/auth/auth-code/index.tsx +0 -233
- package/src/views/auth/login.tsx +0 -498
- package/src/views/auth/register.tsx +0 -388
- package/src/views/base/memory/index.tsx +0 -136
- package/src/views/base/memory/modal/detail-modal.tsx +0 -89
- package/src/views/base/memory/modal/submit-modal.tsx +0 -134
- package/src/views/base/settings/index.tsx +0 -657
- package/src/views/chat/chat.less +0 -323
- package/src/views/chat/components/chat-input.tsx +0 -298
- package/src/views/chat/components/header-thread-title.tsx +0 -210
- package/src/views/chat/components/message-list/content-answer.tsx +0 -100
- package/src/views/chat/components/message-list/content-question.tsx +0 -18
- package/src/views/chat/components/message-list/index.tsx +0 -520
- package/src/views/chat/components/message-list/message-item.tsx +0 -199
- package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
- package/src/views/chat/components/message-list/toolbar.tsx +0 -224
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/chat/components/references-knowledge/context.tsx +0 -57
- package/src/views/chat/components/references-knowledge/index.ts +0 -9
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
- package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
- package/src/views/chat/hooks/use-chat-common.ts +0 -19
- package/src/views/chat/index-session.tsx +0 -647
- package/src/views/chat/index.tsx +0 -127
- package/src/views/page-error/401.tsx +0 -56
- package/src/views/page-error/404.tsx +0 -56
- package/src/views/page-menus/business-rules/index.tsx +0 -376
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
- package/src/views/page-menus/feedback/index.tsx +0 -166
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
- package/src/views/page-menus/knowledge/detail.tsx +0 -600
- package/src/views/page-menus/knowledge/index.tsx +0 -337
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
- package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
- package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
- package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
- package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
- package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
- package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
- package/src/views/page-menus/skill/index.tsx +0 -201
- package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
- package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
- package/src/views/page-system/agent-config/index.tsx +0 -370
- package/src/views/page-system/department/departmentFormShared.ts +0 -36
- package/src/views/page-system/department/index.tsx +0 -541
- package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
- package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
- package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
- package/src/views/page-system/dict/index.tsx +0 -440
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
- package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
- package/src/views/page-system/logs/components/index.ts +0 -3
- package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
- package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
- package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
- package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
- package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/page-system/logs/components/message-modal.tsx +0 -239
- package/src/views/page-system/logs/index.tsx +0 -132
- package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
- package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
- package/src/views/page-system/menu/index.less +0 -12
- package/src/views/page-system/menu/index.tsx +0 -410
- package/src/views/page-system/menu/modal/icon-modal.less +0 -51
- package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
- package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
- package/src/views/page-system/permission/index.tsx +0 -562
- package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
- package/src/views/page-system/permission/modal/submit-modal.less +0 -146
- package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
- package/src/views/page-system/role/index.tsx +0 -163
- package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
- package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
- package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
- package/src/views/page-system/sys-config/index.tsx +0 -294
- package/src/views/page-system/user/components/user-role-column.tsx +0 -87
- package/src/views/page-system/user/index.tsx +0 -439
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
- package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
- package/src/views/page-system/user/userFormShared.ts +0 -51
- package/tailwind.config.js +0 -17
- package/tsconfig.app.json +0 -48
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -272
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { CxButton, CxInput, CxTable } from '@cx-ui'
|
|
2
|
-
import { Plus } from 'lucide-react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
|
|
5
|
-
type Document = {
|
|
6
|
-
id?: string
|
|
7
|
-
name: string
|
|
8
|
-
code: string
|
|
9
|
-
description: string
|
|
10
|
-
text: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type Step4DocumentsProps = {
|
|
14
|
-
documents: Document[]
|
|
15
|
-
onDocumentsChange: (documents: Document[]) => void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function Step4Documents({ documents, onDocumentsChange }: Step4DocumentsProps) {
|
|
19
|
-
const { t } = useTranslation()
|
|
20
|
-
|
|
21
|
-
const handleAdd = () => {
|
|
22
|
-
onDocumentsChange([
|
|
23
|
-
...documents,
|
|
24
|
-
{ name: '', code: '', description: '', text: '' },
|
|
25
|
-
])
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const handleDelete = (index: number) => {
|
|
29
|
-
onDocumentsChange(documents.filter((_, i) => i !== index))
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const handleChange = (index: number, field: keyof Document, value: string) => {
|
|
33
|
-
const next = [...documents]
|
|
34
|
-
next[index] = { ...next[index], [field]: value }
|
|
35
|
-
onDocumentsChange(next)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const columns = [
|
|
39
|
-
{
|
|
40
|
-
title: t('menus.model_metadata.manage.fields.docName'),
|
|
41
|
-
key: 'name',
|
|
42
|
-
width: 150,
|
|
43
|
-
render: (_: unknown, __: Document, index: number) => (
|
|
44
|
-
<div className="min-w-0 max-w-full">
|
|
45
|
-
<CxInput
|
|
46
|
-
className="w-full min-w-0"
|
|
47
|
-
value={documents[index].name}
|
|
48
|
-
onChange={(e) => handleChange(index, 'name', e.target.value)}
|
|
49
|
-
placeholder={t('menus.model_metadata.manage.placeholders.docName')}
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
),
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: t('menus.model_metadata.manage.fields.docCode'),
|
|
56
|
-
key: 'code',
|
|
57
|
-
width: 150,
|
|
58
|
-
render: (_: unknown, __: Document, index: number) => (
|
|
59
|
-
<div className="min-w-0 max-w-full">
|
|
60
|
-
<CxInput
|
|
61
|
-
className="w-full min-w-0"
|
|
62
|
-
value={documents[index].code}
|
|
63
|
-
onChange={(e) => handleChange(index, 'code', e.target.value)}
|
|
64
|
-
placeholder={t('menus.model_metadata.manage.placeholders.docCode')}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
),
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
title: t('menus.model_metadata.manage.fields.docDescription'),
|
|
71
|
-
key: 'description',
|
|
72
|
-
ellipsis: true,
|
|
73
|
-
minWidth: 180,
|
|
74
|
-
render: (_: unknown, __: Document, index: number) => (
|
|
75
|
-
<div className="min-w-0 max-w-full">
|
|
76
|
-
<CxInput
|
|
77
|
-
className="w-full min-w-0"
|
|
78
|
-
value={documents[index].description}
|
|
79
|
-
onChange={(e) => handleChange(index, 'description', e.target.value)}
|
|
80
|
-
placeholder={t('menus.model_metadata.manage.placeholders.docDescription')}
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
title: t('menus.model_metadata.manage.fields.docText'),
|
|
87
|
-
key: 'text',
|
|
88
|
-
ellipsis: true,
|
|
89
|
-
minWidth: 220,
|
|
90
|
-
render: (_: unknown, __: Document, index: number) => (
|
|
91
|
-
<div className="min-w-0 max-w-full">
|
|
92
|
-
<CxInput.Textarea
|
|
93
|
-
className="w-full min-w-0"
|
|
94
|
-
value={documents[index].text}
|
|
95
|
-
onChange={(e) => handleChange(index, 'text', e.target.value)}
|
|
96
|
-
placeholder={t('menus.model_metadata.manage.placeholders.docText')}
|
|
97
|
-
rows={2}
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
100
|
-
),
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
title: t('common.actions'),
|
|
104
|
-
key: 'action',
|
|
105
|
-
width: 80,
|
|
106
|
-
render: (_: unknown, __: Document, index: number) => (
|
|
107
|
-
<CxButton.IconDelete onClick={() => handleDelete(index)} />
|
|
108
|
-
),
|
|
109
|
-
},
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<div className="flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden">
|
|
114
|
-
<div className="mb-4 flex w-full min-w-0 shrink-0 items-center justify-between">
|
|
115
|
-
<h3 className="text-base font-medium">{t('menus.model_metadata.manage.documents')}</h3>
|
|
116
|
-
<CxButton type="primary" onClick={handleAdd} icon={<Plus size={16} />}>
|
|
117
|
-
{t('menus.model_metadata.manage.add_document')}
|
|
118
|
-
</CxButton>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div className="min-h-0 w-full min-w-0 flex-1 overflow-hidden">
|
|
122
|
-
<CxTable
|
|
123
|
-
className="min-w-0 w-full"
|
|
124
|
-
autoScrollY
|
|
125
|
-
minScrollY={160}
|
|
126
|
-
columns={columns}
|
|
127
|
-
dataSource={documents.map((doc, index) => ({ ...doc, key: index }))}
|
|
128
|
-
pagination={false}
|
|
129
|
-
scroll={{ x: true }}
|
|
130
|
-
/>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
)
|
|
134
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { CxButton, CxInput, CxTable } from '@cx-ui'
|
|
2
|
-
import { Plus } from 'lucide-react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
|
|
5
|
-
type ExampleSql = {
|
|
6
|
-
id?: string
|
|
7
|
-
exampleSql: string
|
|
8
|
-
description: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type Step5ExampleSqlProps = {
|
|
12
|
-
exampleSqlList: ExampleSql[]
|
|
13
|
-
onExampleSqlListChange: (list: ExampleSql[]) => void
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default function Step5ExampleSql({
|
|
17
|
-
exampleSqlList,
|
|
18
|
-
onExampleSqlListChange,
|
|
19
|
-
}: Step5ExampleSqlProps) {
|
|
20
|
-
const { t } = useTranslation()
|
|
21
|
-
|
|
22
|
-
const handleAdd = () => {
|
|
23
|
-
onExampleSqlListChange([...exampleSqlList, { exampleSql: '', description: '' }])
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const handleDelete = (index: number) => {
|
|
27
|
-
onExampleSqlListChange(exampleSqlList.filter((_, i) => i !== index))
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const handleChange = (index: number, field: keyof ExampleSql, value: string) => {
|
|
31
|
-
const next = [...exampleSqlList]
|
|
32
|
-
next[index] = { ...next[index], [field]: value }
|
|
33
|
-
onExampleSqlListChange(next)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const columns = [
|
|
37
|
-
{
|
|
38
|
-
title: t('menus.model_metadata.manage.fields.exampleSql'),
|
|
39
|
-
key: 'exampleSql',
|
|
40
|
-
minWidth: 280,
|
|
41
|
-
render: (_: unknown, __: ExampleSql, index: number) => (
|
|
42
|
-
<div className="min-w-0 max-w-full">
|
|
43
|
-
<CxInput.Textarea
|
|
44
|
-
className="w-full min-w-0"
|
|
45
|
-
value={exampleSqlList[index].exampleSql}
|
|
46
|
-
onChange={(e) => handleChange(index, 'exampleSql', e.target.value)}
|
|
47
|
-
placeholder={t('menus.model_metadata.manage.placeholders.exampleSql')}
|
|
48
|
-
rows={3}
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: t('menus.model_metadata.manage.fields.exampleSqlDescription'),
|
|
55
|
-
key: 'description',
|
|
56
|
-
width: 250,
|
|
57
|
-
minWidth: 200,
|
|
58
|
-
render: (_: unknown, __: ExampleSql, index: number) => (
|
|
59
|
-
<div className="min-w-0 max-w-full">
|
|
60
|
-
<CxInput
|
|
61
|
-
className="w-full min-w-0"
|
|
62
|
-
value={exampleSqlList[index].description}
|
|
63
|
-
onChange={(e) => handleChange(index, 'description', e.target.value)}
|
|
64
|
-
placeholder={t('menus.model_metadata.manage.placeholders.exampleSqlDescription')}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
),
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
title: t('common.actions'),
|
|
71
|
-
key: 'action',
|
|
72
|
-
width: 80,
|
|
73
|
-
render: (_: unknown, __: ExampleSql, index: number) => (
|
|
74
|
-
<CxButton.IconDelete onClick={() => handleDelete(index)} />
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<div className="flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden">
|
|
81
|
-
<div className="mb-4 flex w-full min-w-0 shrink-0 items-center justify-between">
|
|
82
|
-
<h3 className="text-base font-medium">{t('menus.model_metadata.manage.exampleSqlList')}</h3>
|
|
83
|
-
<CxButton type="primary" onClick={handleAdd} icon={<Plus size={16} />}>
|
|
84
|
-
{t('menus.model_metadata.manage.add_example_sql')}
|
|
85
|
-
</CxButton>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div className="min-h-0 w-full min-w-0 flex-1 overflow-hidden">
|
|
89
|
-
<CxTable
|
|
90
|
-
className="min-w-0 w-full"
|
|
91
|
-
autoScrollY
|
|
92
|
-
minScrollY={160}
|
|
93
|
-
columns={columns}
|
|
94
|
-
dataSource={exampleSqlList.map((sql, index) => ({ ...sql, key: index }))}
|
|
95
|
-
pagination={false}
|
|
96
|
-
scroll={{ x: true }}
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import { useToast } from '@/contexts/ToastContext'
|
|
2
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
3
|
-
import { useModalSubmit } from '@/hooks/useModalSubmit'
|
|
4
|
-
import { useStepForm } from '@/hooks/useStepForm'
|
|
5
|
-
import { addModelMetadataAPI, testConnectionAPI } from '@api/menus/model-metadata/manage'
|
|
6
|
-
import {
|
|
7
|
-
buildModelMetadataPayloadParts,
|
|
8
|
-
validateAddBasicFieldsPresent,
|
|
9
|
-
validateDocumentsForSubmit,
|
|
10
|
-
validateModelMetadataItemDetail,
|
|
11
|
-
validatePermissionsForSubmit,
|
|
12
|
-
} from '../hooks/model-metadata-submit-shared'
|
|
13
|
-
import { useModelMetadataItemState } from '../hooks/use-model-metadata-item-state'
|
|
14
|
-
import { CxButton, CxSteps } from '@cx-ui'
|
|
15
|
-
import { CheckCircle2, ChevronLeft, Database } from 'lucide-react'
|
|
16
|
-
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
17
|
-
import { useTranslation } from 'react-i18next'
|
|
18
|
-
import { useNavigate } from 'react-router-dom'
|
|
19
|
-
|
|
20
|
-
import Step1BasicInfo, {
|
|
21
|
-
type Step1BasicInfoHandle,
|
|
22
|
-
modelMetadataConnectionDigest,
|
|
23
|
-
} from './step1-basic-info'
|
|
24
|
-
import Step2Schema from './step2-schema'
|
|
25
|
-
import Step3Permissions from './step3-permissions'
|
|
26
|
-
import Step4Documents from './step4-documents'
|
|
27
|
-
import Step5ExampleSql from './step5-example-sql'
|
|
28
|
-
|
|
29
|
-
// 步骤条 i18n → locales/zh/menus/model-metadata/manage.ts
|
|
30
|
-
const steps = [
|
|
31
|
-
{
|
|
32
|
-
title: 'menus.model_metadata.manage.step1_title',
|
|
33
|
-
description: 'menus.model_metadata.manage.step1_description',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: 'menus.model_metadata.manage.step2_title',
|
|
37
|
-
description: 'menus.model_metadata.manage.step2_description',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: 'menus.model_metadata.manage.step3_title',
|
|
41
|
-
description: 'menus.model_metadata.manage.step3_description',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
title: 'menus.model_metadata.manage.step4_title',
|
|
45
|
-
description: 'menus.model_metadata.manage.step4_description',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
title: 'menus.model_metadata.manage.step5_title',
|
|
49
|
-
description: 'menus.model_metadata.manage.step5_description',
|
|
50
|
-
},
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
function ModelMetadataSubmitAddView() {
|
|
54
|
-
const { showToast } = useToast()
|
|
55
|
-
const { hasPermission } = useAuth()
|
|
56
|
-
const { t } = useTranslation()
|
|
57
|
-
const navigate = useNavigate()
|
|
58
|
-
|
|
59
|
-
const { submitting, handleSubmit } = useModalSubmit()
|
|
60
|
-
|
|
61
|
-
const step1Ref = useRef<Step1BasicInfoHandle>(null)
|
|
62
|
-
const verifiedConnectionDigestRef = useRef<string | null>(null)
|
|
63
|
-
const [basicFields, setBasicFields] = useState<Record<string, any>>({})
|
|
64
|
-
const [schemaPreviewNonce, setSchemaPreviewNonce] = useState(0)
|
|
65
|
-
const {
|
|
66
|
-
tables,
|
|
67
|
-
setTables,
|
|
68
|
-
permissions,
|
|
69
|
-
setPermissions,
|
|
70
|
-
documents,
|
|
71
|
-
setDocuments,
|
|
72
|
-
exampleSqlList,
|
|
73
|
-
setExampleSqlList,
|
|
74
|
-
} = useModelMetadataItemState()
|
|
75
|
-
|
|
76
|
-
const {
|
|
77
|
-
current,
|
|
78
|
-
setCurrent,
|
|
79
|
-
connectionTested,
|
|
80
|
-
setConnectionTested,
|
|
81
|
-
testingConnection,
|
|
82
|
-
setTestingConnection,
|
|
83
|
-
} = useStepForm()
|
|
84
|
-
|
|
85
|
-
const handleConnectionDigestChange = useCallback(
|
|
86
|
-
(digest: string) => {
|
|
87
|
-
const verified = verifiedConnectionDigestRef.current
|
|
88
|
-
if (verified !== null && digest !== verified) {
|
|
89
|
-
setConnectionTested(false)
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
[setConnectionTested],
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
setPermissions([
|
|
97
|
-
{ permissionName: '用户', permissionColumns: [] },
|
|
98
|
-
{ permissionName: '组织', permissionColumns: [] },
|
|
99
|
-
])
|
|
100
|
-
}, [])
|
|
101
|
-
|
|
102
|
-
const handleBack = () => {
|
|
103
|
-
navigate(-1)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const next = async () => {
|
|
107
|
-
try {
|
|
108
|
-
if (current === 0) {
|
|
109
|
-
const values = await step1Ref.current?.validateForNext()
|
|
110
|
-
if (!values) return
|
|
111
|
-
if (hasPermission('model-metadata:test') && !connectionTested) {
|
|
112
|
-
showToast(t('menus.model_metadata.manage.test_connection_required'), 'warning') // 须先测连接
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
setBasicFields(values)
|
|
116
|
-
setSchemaPreviewNonce((n) => n + 1)
|
|
117
|
-
} else if (current === 2) {
|
|
118
|
-
const permErr = validatePermissionsForSubmit(permissions)
|
|
119
|
-
if (permErr) {
|
|
120
|
-
showToast(t(`menus.model_metadata.manage.rules.${permErr}`), 'warning')
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
} else if (current === 3) {
|
|
124
|
-
const docErr = validateDocumentsForSubmit(documents)
|
|
125
|
-
if (docErr) {
|
|
126
|
-
showToast(t(`menus.model_metadata.manage.rules.${docErr}`), 'warning')
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
setCurrent(current + 1)
|
|
131
|
-
} catch {
|
|
132
|
-
showToast(t('common.form_validation_warning'), 'error')
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const handleTestConnection = async () => {
|
|
137
|
-
try {
|
|
138
|
-
await step1Ref.current?.validateForConnectionTest()
|
|
139
|
-
setTestingConnection(true)
|
|
140
|
-
const payload = step1Ref.current?.getConnectionTestPayload()
|
|
141
|
-
await testConnectionAPI(payload)
|
|
142
|
-
verifiedConnectionDigestRef.current = modelMetadataConnectionDigest(payload)
|
|
143
|
-
setConnectionTested(true)
|
|
144
|
-
showToast(t('menus.model_metadata.manage.connection_test_success'), 'success') // 连接测试成功
|
|
145
|
-
} catch (error: any) {
|
|
146
|
-
console.error('Connection test failed:', error)
|
|
147
|
-
setConnectionTested(false)
|
|
148
|
-
verifiedConnectionDigestRef.current = null
|
|
149
|
-
showToast(error?.message || t('menus.model_metadata.manage.connection_test_failed'), 'error') // 连接测试失败
|
|
150
|
-
} finally {
|
|
151
|
-
setTestingConnection(false)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const prev = () => {
|
|
156
|
-
setCurrent(current - 1)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const onSubmit = async () => {
|
|
160
|
-
if (!validateAddBasicFieldsPresent(basicFields)) {
|
|
161
|
-
showToast(t('common.form_validation_warning'), 'error')
|
|
162
|
-
return
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const detailErr = validateModelMetadataItemDetail({
|
|
166
|
-
tables,
|
|
167
|
-
permissions,
|
|
168
|
-
documents,
|
|
169
|
-
exampleSqlList,
|
|
170
|
-
})
|
|
171
|
-
if (detailErr) {
|
|
172
|
-
showToast(t(`menus.model_metadata.manage.rules.${detailErr}`), 'warning')
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const { tablesPayload, permissionsPayload, documents: docOut, exampleSqlList: sqlOut } =
|
|
177
|
-
buildModelMetadataPayloadParts({
|
|
178
|
-
tables,
|
|
179
|
-
permissions,
|
|
180
|
-
documents,
|
|
181
|
-
exampleSqlList,
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
const body = {
|
|
185
|
-
...basicFields,
|
|
186
|
-
tables: tablesPayload,
|
|
187
|
-
permissions: permissionsPayload,
|
|
188
|
-
documents: docOut,
|
|
189
|
-
exampleSqlList: sqlOut,
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
await handleSubmit({
|
|
193
|
-
opeType: 'add',
|
|
194
|
-
validate: async () => body,
|
|
195
|
-
addAPI: addModelMetadataAPI,
|
|
196
|
-
successMessage: {
|
|
197
|
-
add: t('common.add_success'),
|
|
198
|
-
},
|
|
199
|
-
onSuccess: async () => {
|
|
200
|
-
navigate(-1)
|
|
201
|
-
},
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const renderStepContent = () => {
|
|
206
|
-
switch (current) {
|
|
207
|
-
case 0:
|
|
208
|
-
return (
|
|
209
|
-
<Step1BasicInfo
|
|
210
|
-
ref={step1Ref}
|
|
211
|
-
initialValues={basicFields}
|
|
212
|
-
onConnectionDigestChange={handleConnectionDigestChange}
|
|
213
|
-
/>
|
|
214
|
-
)
|
|
215
|
-
case 1:
|
|
216
|
-
return (
|
|
217
|
-
<Step2Schema
|
|
218
|
-
connectionParams={basicFields}
|
|
219
|
-
tables={tables}
|
|
220
|
-
onTablesChange={setTables}
|
|
221
|
-
isEdit={false}
|
|
222
|
-
currentStep={current}
|
|
223
|
-
previewNonce={schemaPreviewNonce}
|
|
224
|
-
/>
|
|
225
|
-
)
|
|
226
|
-
case 2:
|
|
227
|
-
return (
|
|
228
|
-
<Step3Permissions
|
|
229
|
-
permissions={permissions}
|
|
230
|
-
onPermissionsChange={setPermissions}
|
|
231
|
-
tables={tables}
|
|
232
|
-
/>
|
|
233
|
-
)
|
|
234
|
-
case 3:
|
|
235
|
-
return <Step4Documents documents={documents} onDocumentsChange={setDocuments} />
|
|
236
|
-
case 4:
|
|
237
|
-
return (
|
|
238
|
-
<Step5ExampleSql
|
|
239
|
-
exampleSqlList={exampleSqlList}
|
|
240
|
-
onExampleSqlListChange={setExampleSqlList}
|
|
241
|
-
/>
|
|
242
|
-
)
|
|
243
|
-
default:
|
|
244
|
-
return null
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
return (
|
|
249
|
-
<div className="flex h-full flex-col bg-white">
|
|
250
|
-
{/* 顶部:与知识库文档页 ListPageView 标题区一致(无副标题) */}
|
|
251
|
-
<div className="shrink-0 bg-white px-6 pb-3 pt-6">
|
|
252
|
-
<div className="flex items-center justify-between">
|
|
253
|
-
<div className="flex min-w-0 flex-1 items-center gap-3">
|
|
254
|
-
<CxButton.Icon
|
|
255
|
-
className="!p-2.5 shrink-0 rounded-lg border border-solid border-gray-300 bg-white shadow-sm"
|
|
256
|
-
type="default"
|
|
257
|
-
icon={<ChevronLeft size={22} strokeWidth={2.25} />}
|
|
258
|
-
onClick={handleBack}
|
|
259
|
-
title={t('common.back')}
|
|
260
|
-
tooltipTone="default"
|
|
261
|
-
/>
|
|
262
|
-
<h1 className="flex min-w-0 flex-wrap items-center gap-3 text-3xl font-bold text-transparent bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text">
|
|
263
|
-
<Database className="shrink-0 text-blue-400" size={32} aria-hidden />
|
|
264
|
-
<span className="min-w-0">{t('menus.model_metadata.manage.add')}</span>
|
|
265
|
-
{/* i18n:edit / add */}
|
|
266
|
-
</h1>
|
|
267
|
-
</div>
|
|
268
|
-
</div>
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
<div className="shrink-0 bg-white px-6 pb-1.5 pt-0">
|
|
272
|
-
<CxSteps
|
|
273
|
-
current={current}
|
|
274
|
-
items={steps.map((step, index) => ({
|
|
275
|
-
title: t(step.title),
|
|
276
|
-
description: t(step.description),
|
|
277
|
-
status: index < current ? 'finish' : index === current ? 'process' : 'wait',
|
|
278
|
-
}))}
|
|
279
|
-
className="[&_.ant-steps-item]:!pb-0 [&_.ant-steps-item-title]:!text-[13px] [&_.ant-steps-item-title]:!leading-snug [&_.ant-steps-item-description]:!mt-0.5 [&_.ant-steps-item-description]:!text-xs [&_.ant-steps-item-description]:!leading-snug"
|
|
280
|
-
/>
|
|
281
|
-
</div>
|
|
282
|
-
|
|
283
|
-
<div
|
|
284
|
-
className={
|
|
285
|
-
current >= 1 && current <= 4
|
|
286
|
-
? 'flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-white px-5 py-4'
|
|
287
|
-
: 'flex-1 overflow-auto bg-white px-5 py-4'
|
|
288
|
-
}
|
|
289
|
-
>
|
|
290
|
-
<div
|
|
291
|
-
className={
|
|
292
|
-
current >= 1 && current <= 4
|
|
293
|
-
? 'mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col rounded-lg bg-white p-4'
|
|
294
|
-
: 'mx-auto max-w-6xl rounded-lg bg-white p-4'
|
|
295
|
-
}
|
|
296
|
-
>
|
|
297
|
-
{renderStepContent()}
|
|
298
|
-
</div>
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<div className="shrink-0 border-t border-gray-200 bg-white px-5 py-3">
|
|
302
|
-
<div className="mx-auto flex max-w-6xl justify-between">
|
|
303
|
-
<div>
|
|
304
|
-
<CxButton onClick={handleBack}>{t('common.cancel')}</CxButton>
|
|
305
|
-
</div>
|
|
306
|
-
<div className="flex gap-3">
|
|
307
|
-
{current > 0 && (
|
|
308
|
-
<CxButton onClick={prev}>{t('common.prev_step')}</CxButton>
|
|
309
|
-
)}
|
|
310
|
-
{current === 0 && hasPermission('model-metadata:test') && (
|
|
311
|
-
<CxButton
|
|
312
|
-
type={connectionTested ? 'primary' : 'default'}
|
|
313
|
-
loading={testingConnection}
|
|
314
|
-
icon={connectionTested ? <CheckCircle2 size={16} /> : undefined}
|
|
315
|
-
onClick={handleTestConnection}
|
|
316
|
-
>
|
|
317
|
-
{connectionTested
|
|
318
|
-
? t('menus.model_metadata.manage.connection_tested') // 已测试连接
|
|
319
|
-
: t('menus.model_metadata.manage.test_connection')} {/* 测试连接 */}
|
|
320
|
-
</CxButton>
|
|
321
|
-
)}
|
|
322
|
-
{current < steps.length - 1 ? (
|
|
323
|
-
<CxButton type="primary" onClick={next}>
|
|
324
|
-
{t('common.next')}
|
|
325
|
-
</CxButton>
|
|
326
|
-
) : (
|
|
327
|
-
<CxButton type="primary" loading={submitting} onClick={() => void onSubmit()}>
|
|
328
|
-
{t('common.submit')}
|
|
329
|
-
</CxButton>
|
|
330
|
-
)}
|
|
331
|
-
</div>
|
|
332
|
-
</div>
|
|
333
|
-
</div>
|
|
334
|
-
</div>
|
|
335
|
-
)
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export default ModelMetadataSubmitAddView
|