diff --git a/frontend/src/pages/Dashboard/components/DeploymentFormModal.tsx b/frontend/src/pages/Dashboard/components/DeploymentFormModal.tsx index d7ab2b76..6575b0cd 100644 --- a/frontend/src/pages/Dashboard/components/DeploymentFormModal.tsx +++ b/frontend/src/pages/Dashboard/components/DeploymentFormModal.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useRef } from 'react'; import { Dialog, DialogContent, @@ -11,6 +11,8 @@ import { BetaSchemaForm } from '@ant-design/pro-form'; import { convertJsonSchemaToColumns } from '@/utils/jsonSchemaUtils'; import { message } from 'antd'; import type { DeploymentConfig } from '@/pages/Deploy/Deployment/List/types'; +import { deployApp } from '../service'; +import { DeployAppBuildDTO } from '../types'; interface DeploymentFormModalProps { open: boolean; @@ -25,10 +27,21 @@ const DeploymentFormModal: React.FC = ({ formSchema, deployConfig }) => { + const formRef = useRef(); + const handleSubmit = async (values: any) => { try { - console.log('Form values:', values); - // TODO: 调用部署接口 + const deployData: DeployAppBuildDTO = { + buildType: deployConfig.buildType, + languageType: deployConfig.languageType, + formVariables: values, + buildVariables: deployConfig.buildVariables, + environmentId: deployConfig.environmentId, + applicationId: deployConfig.application.id, + workflowDefinitionId: deployConfig.publishedWorkflowDefinition?.id || 0 + }; + + await deployApp(deployData); message.success('部署任务已提交'); onClose(); } catch (error) { @@ -46,19 +59,18 @@ const DeploymentFormModal: React.FC = ({
- diff --git a/frontend/src/pages/Dashboard/index.tsx b/frontend/src/pages/Dashboard/index.tsx index 75c297d1..1d03a31d 100644 --- a/frontend/src/pages/Dashboard/index.tsx +++ b/frontend/src/pages/Dashboard/index.tsx @@ -35,6 +35,7 @@ import type {DeploymentConfig} from '@/pages/Deploy/Deployment/List/types'; import type {Page} from '@/types/base'; import type { JsonNode } from '@/types/common'; import DeploymentFormModal from './components/DeploymentFormModal'; +import {message} from "antd"; type EnvironmentStatus = 'success' | 'warning' | 'error'; @@ -236,7 +237,7 @@ const Dashboard: React.FC = () => { }; const handleDeploy = (config: DeploymentConfig) => { - if (!config.publishedWorkflowDefinition?.formVariablesSchema) { + if (!config?.formVariablesSchema) { message.error('工作流配置有误,请检查工作流定义'); return; } @@ -433,14 +434,14 @@ const Dashboard: React.FC = () => { )} - {selectedConfig && selectedConfig.publishedWorkflowDefinition && ( + {selectedConfig && selectedConfig.formVariablesSchema && ( { setDeployModalOpen(false); setSelectedConfig(null); }} - formSchema={selectedConfig.publishedWorkflowDefinition.formVariablesSchema} + formSchema={selectedConfig.formVariablesSchema} deployConfig={selectedConfig} /> )} diff --git a/frontend/src/pages/Dashboard/service.ts b/frontend/src/pages/Dashboard/service.ts new file mode 100644 index 00000000..5cd934d3 --- /dev/null +++ b/frontend/src/pages/Dashboard/service.ts @@ -0,0 +1,9 @@ +import { DeployAppBuildDTO } from './types'; +import request from "@/utils/request.ts"; + +/** + * 部署应用 + * @param data 部署参数 + */ +export const deployApp = (data: DeployAppBuildDTO) => + request.post('/api/v1/deploy-app-config/deploy', data); \ No newline at end of file diff --git a/frontend/src/pages/Dashboard/types.ts b/frontend/src/pages/Dashboard/types.ts new file mode 100644 index 00000000..bd51acf8 --- /dev/null +++ b/frontend/src/pages/Dashboard/types.ts @@ -0,0 +1,38 @@ +import { JsonNode } from '@/types/common'; + +export interface DeployAppBuildDTO { + /** + * 构建类型 + */ + buildType: string; + + /** + * 应用语言 + */ + languageType: string; + + /** + * 表单配置 + */ + formVariables?: JsonNode; + + /** + * 构建配置 + */ + buildVariables: JsonNode; + + /** + * 环境ID + */ + environmentId: number; + + /** + * 应用ID + */ + applicationId: number; + + /** + * 已发布的流程定义ID + */ + workflowDefinitionId: number; +} \ No newline at end of file diff --git a/frontend/src/pages/Deploy/Deployment/List/types.ts b/frontend/src/pages/Deploy/Deployment/List/types.ts index 6be7ae9d..b0b10514 100644 --- a/frontend/src/pages/Deploy/Deployment/List/types.ts +++ b/frontend/src/pages/Deploy/Deployment/List/types.ts @@ -26,6 +26,7 @@ export interface DeploymentConfig extends BaseResponse { workflowDefinitionId: number; publishedWorkflowDefinition?: WorkflowDefinition; buildVariables: JsonNode; + formVariablesSchema: JsonNode, enabled: boolean; }