From 8b15f8ae71e0ac9aa416d19d0410fad398b1f90f Mon Sep 17 00:00:00 2001 From: dengqichen Date: Tue, 11 Nov 2025 16:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E7=B3=BB=E7=BB=9F=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormDesigner/extensions/README.md | 2 +- frontend/src/components/ui/scroll-area.tsx | 39 ++- .../List/components/ApplicationModal.tsx | 233 +---------------- .../List/components/CategoryManageDialog.tsx | 24 +- .../pages/Deploy/Application/List/index.tsx | 38 +-- .../pages/Deploy/Application/List/schema.ts | 2 - .../List/components/TeamApplicationDialog.tsx | 237 +++++++++++++++++- .../TeamApplicationManageDialog.tsx | 4 + .../Deploy/Team/List/components/TeamModal.tsx | 61 +++-- frontend/src/pages/Deploy/Team/List/index.tsx | 22 +- frontend/src/pages/Deploy/Team/List/types.ts | 6 + .../External/List/components/EditDialog.tsx | 60 +++-- .../pages/Resource/External/List/index.tsx | 6 + .../pages/Resource/External/List/service.ts | 6 +- .../src/pages/Resource/Git/List/service.ts | 20 +- 15 files changed, 381 insertions(+), 379 deletions(-) diff --git a/frontend/src/components/FormDesigner/extensions/README.md b/frontend/src/components/FormDesigner/extensions/README.md index 0b6c2ce7..628c6e58 100644 --- a/frontend/src/components/FormDesigner/extensions/README.md +++ b/frontend/src/components/FormDesigner/extensions/README.md @@ -277,5 +277,5 @@ http://localhost:3000/form-designer/workflow-example --- -Made with ❤️ for Deploy Ease Platform +Made with ❤️ for 链宇Deploy Ease平台 diff --git a/frontend/src/components/ui/scroll-area.tsx b/frontend/src/components/ui/scroll-area.tsx index cf253cf1..5169da3d 100644 --- a/frontend/src/components/ui/scroll-area.tsx +++ b/frontend/src/components/ui/scroll-area.tsx @@ -6,19 +6,32 @@ import { cn } from "@/lib/utils" const ScrollArea = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - {children} - - - - -)) +>(({ className, children, ...props }, ref) => { + const viewportRef = React.useRef(null); + + return ( + + { + // 允许滚轮在整个viewport区域工作 + if (viewportRef.current) { + viewportRef.current.scrollTop += e.deltaY; + } + }} + > + {children} + + + + + ); +}) ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName const ScrollBar = React.forwardRef< diff --git a/frontend/src/pages/Deploy/Application/List/components/ApplicationModal.tsx b/frontend/src/pages/Deploy/Application/List/components/ApplicationModal.tsx index de6018ed..9e9d6685 100644 --- a/frontend/src/pages/Deploy/Application/List/components/ApplicationModal.tsx +++ b/frontend/src/pages/Deploy/Application/List/components/ApplicationModal.tsx @@ -1,10 +1,7 @@ import React, {useEffect, useState} from 'react'; -import type {Application, RepositoryProject} from '../types'; +import type {Application} from '../types'; import {DevelopmentLanguageTypeEnum} from '../types'; -import {createApplication, updateApplication, getRepositoryProjectsBySystem} from '../service'; -import type {ExternalSystemResponse} from '@/pages/Resource/External/List/types'; -import {SystemType} from '@/pages/Resource/External/List/types'; -import {getExternalSystems} from '@/pages/Resource/External/List/service'; +import {createApplication, updateApplication} from '../service'; import {getEnabledCategories} from '../../Category/service'; import type {ApplicationCategoryResponse} from '../../Category/types'; import { @@ -37,16 +34,6 @@ import {useForm} from "react-hook-form"; import {zodResolver} from "@hookform/resolvers/zod"; import {applicationFormSchema, type ApplicationFormValues} from "../schema"; import {Textarea} from "@/components/ui/textarea"; -import {ScrollArea} from "@/components/ui/scroll-area"; -import {Check, ChevronDown, Search} from "lucide-react"; -import {cn} from "@/lib/utils"; -import {Popover, PopoverContent, PopoverTrigger} from "@/components/ui/popover"; -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from "@/components/ui/accordion"; interface ApplicationModalProps { open: boolean; @@ -62,8 +49,6 @@ const ApplicationModal: React.FC = ({ initialValues, }) => { const [categories, setCategories] = useState([]); - const [externalSystems, setExternalSystems] = useState([]); - const [repositoryProjects, setRepositoryProjects] = useState([]); const {toast} = useToast(); const isEdit = !!initialValues?.id; @@ -77,8 +62,6 @@ const ApplicationModal: React.FC = ({ language: DevelopmentLanguageTypeEnum.JAVA, enabled: true, sort: 0, - externalSystemId: undefined, - repoProjectId: undefined, }, }); @@ -97,29 +80,8 @@ const ApplicationModal: React.FC = ({ } }; - // 加载Gitlab列表 - const loadExternalSystems = async () => { - try { - const response = await getExternalSystems({ - type: SystemType.GIT, - enabled: true, - }); - if (response?.content) { - setExternalSystems(response.content); - } - } catch (error) { - toast({ - variant: "destructive", - title: "加载Gitlab失败", - description: error instanceof Error ? error.message : undefined, - duration: 3000, - }); - } - }; - useEffect(() => { loadCategories(); - loadExternalSystems(); }, []); useEffect(() => { @@ -133,36 +95,13 @@ const ApplicationModal: React.FC = ({ language: initialValues.language, enabled: initialValues.enabled, sort: initialValues.sort, - externalSystemId: initialValues.externalSystemId, - repoProjectId: initialValues.repoProjectId }); - - // 如果有Gitlab ID,加载仓库项目 - if (initialValues.externalSystemId) { - fetchRepositoryProjects(initialValues.externalSystemId); - } } }, [initialValues]); - // 当选择Gitlab时,获取对应的仓库项目列表 - const handleExternalSystemChange = (externalSystemId: number | undefined) => { - form.setValue('repoProjectId', undefined); - setRepositoryProjects([]); - if (externalSystemId) { - fetchRepositoryProjects(externalSystemId); - } - }; - - const fetchRepositoryProjects = async (externalSystemId: number | undefined) => { - if (!externalSystemId) return; - const response = await getRepositoryProjectsBySystem(externalSystemId); - setRepositoryProjects(response || []); - }; - const handleSubmit = async (values: ApplicationFormValues) => { console.log('Form submitted with values:', values); try { - // 保留 externalSystemId 字段,传给后端 const submitData = values; if (isEdit) { @@ -203,9 +142,9 @@ const ApplicationModal: React.FC = ({ {isEdit ? '编辑' : '新建'}应用
- - -
+ +
+
= ({ />
- {/* Git 配置区域(可折叠) */} - - - - Git 仓库配置(选填) - - -
- ( - - Gitlab - - - - )} - /> - - { - const [searchValue, setSearchValue] = React.useState(""); - const [open, setOpen] = React.useState(false); - const filteredProjects = repositoryProjects.filter(project => - project.name.toLowerCase().includes(searchValue.toLowerCase()) - ); - - return ( - - 代码仓库 - - - - - - - -
- - setSearchValue(e.target.value)} - /> -
-
- -
- {filteredProjects.length === 0 ? ( -
- 未找到项目 -
- ) : ( - filteredProjects.map((project) => ( -
{ - form.setValue("repoProjectId", project.repoProjectId); - setSearchValue(""); - setOpen(false); - }} - onWheel={(e) => { - const scrollArea = e.currentTarget.closest('[data-radix-scroll-area-viewport]'); - if (scrollArea) { - scrollArea.scrollTop += e.deltaY; - } - }} - > -
- {project.repoGroupName ? ( - <> - {project.repoGroupName}/ - {project.name} - - ) : ( - project.name - )} -
- {project.repoProjectId === field.value && ( - - )} -
- )) - )} -
-
-
-
-
- -
- ); - }} - /> -
-
-
-
- = ({ />
- +