1
This commit is contained in:
parent
0b40047fc6
commit
f1f9ef0aab
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@ -11,6 +11,8 @@ import { BetaSchemaForm } from '@ant-design/pro-form';
|
|||||||
import { convertJsonSchemaToColumns } from '@/utils/jsonSchemaUtils';
|
import { convertJsonSchemaToColumns } from '@/utils/jsonSchemaUtils';
|
||||||
import { message } from 'antd';
|
import { message } from 'antd';
|
||||||
import type { DeploymentConfig } from '@/pages/Deploy/Deployment/List/types';
|
import type { DeploymentConfig } from '@/pages/Deploy/Deployment/List/types';
|
||||||
|
import { deployApp } from '../service';
|
||||||
|
import { DeployAppBuildDTO } from '../types';
|
||||||
|
|
||||||
interface DeploymentFormModalProps {
|
interface DeploymentFormModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@ -25,10 +27,21 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
|||||||
formSchema,
|
formSchema,
|
||||||
deployConfig
|
deployConfig
|
||||||
}) => {
|
}) => {
|
||||||
|
const formRef = useRef<any>();
|
||||||
|
|
||||||
const handleSubmit = async (values: any) => {
|
const handleSubmit = async (values: any) => {
|
||||||
try {
|
try {
|
||||||
console.log('Form values:', values);
|
const deployData: DeployAppBuildDTO = {
|
||||||
// TODO: 调用部署接口
|
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('部署任务已提交');
|
message.success('部署任务已提交');
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -46,19 +59,18 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div className="py-4">
|
<div className="py-4">
|
||||||
<BetaSchemaForm
|
<BetaSchemaForm
|
||||||
|
formRef={formRef}
|
||||||
layoutType="Form"
|
layoutType="Form"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
onFinish={handleSubmit}
|
onFinish={handleSubmit}
|
||||||
submitter={{
|
submitter={false}
|
||||||
render: false
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="outline" onClick={onClose}>
|
<Button variant="outline" onClick={onClose}>
|
||||||
取消
|
取消
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit" form="pro-form">
|
<Button onClick={() => formRef.current?.submit()}>
|
||||||
确定
|
确定
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import type {DeploymentConfig} from '@/pages/Deploy/Deployment/List/types';
|
|||||||
import type {Page} from '@/types/base';
|
import type {Page} from '@/types/base';
|
||||||
import type { JsonNode } from '@/types/common';
|
import type { JsonNode } from '@/types/common';
|
||||||
import DeploymentFormModal from './components/DeploymentFormModal';
|
import DeploymentFormModal from './components/DeploymentFormModal';
|
||||||
|
import {message} from "antd";
|
||||||
|
|
||||||
type EnvironmentStatus = 'success' | 'warning' | 'error';
|
type EnvironmentStatus = 'success' | 'warning' | 'error';
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ const Dashboard: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeploy = (config: DeploymentConfig) => {
|
const handleDeploy = (config: DeploymentConfig) => {
|
||||||
if (!config.publishedWorkflowDefinition?.formVariablesSchema) {
|
if (!config?.formVariablesSchema) {
|
||||||
message.error('工作流配置有误,请检查工作流定义');
|
message.error('工作流配置有误,请检查工作流定义');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -433,14 +434,14 @@ const Dashboard: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{selectedConfig && selectedConfig.publishedWorkflowDefinition && (
|
{selectedConfig && selectedConfig.formVariablesSchema && (
|
||||||
<DeploymentFormModal
|
<DeploymentFormModal
|
||||||
open={deployModalOpen}
|
open={deployModalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setDeployModalOpen(false);
|
setDeployModalOpen(false);
|
||||||
setSelectedConfig(null);
|
setSelectedConfig(null);
|
||||||
}}
|
}}
|
||||||
formSchema={selectedConfig.publishedWorkflowDefinition.formVariablesSchema}
|
formSchema={selectedConfig.formVariablesSchema}
|
||||||
deployConfig={selectedConfig}
|
deployConfig={selectedConfig}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
9
frontend/src/pages/Dashboard/service.ts
Normal file
9
frontend/src/pages/Dashboard/service.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { DeployAppBuildDTO } from './types';
|
||||||
|
import request from "@/utils/request.ts";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部署应用
|
||||||
|
* @param data 部署参数
|
||||||
|
*/
|
||||||
|
export const deployApp = (data: DeployAppBuildDTO) =>
|
||||||
|
request.post<void>('/api/v1/deploy-app-config/deploy', data);
|
||||||
38
frontend/src/pages/Dashboard/types.ts
Normal file
38
frontend/src/pages/Dashboard/types.ts
Normal file
@ -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;
|
||||||
|
}
|
||||||
@ -26,6 +26,7 @@ export interface DeploymentConfig extends BaseResponse {
|
|||||||
workflowDefinitionId: number;
|
workflowDefinitionId: number;
|
||||||
publishedWorkflowDefinition?: WorkflowDefinition;
|
publishedWorkflowDefinition?: WorkflowDefinition;
|
||||||
buildVariables: JsonNode;
|
buildVariables: JsonNode;
|
||||||
|
formVariablesSchema: JsonNode,
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user