增加GIT代码检测节点
This commit is contained in:
parent
f49c0915ec
commit
909337044f
@ -104,8 +104,8 @@ export const ApplicationCard: React.FC<ApplicationCardProps> = ({
|
||||
{/* 分支 */}
|
||||
<div className="flex items-center gap-1.5">
|
||||
<GitBranch className="h-3 w-3 shrink-0" />
|
||||
{app.branch ? (
|
||||
<code className="truncate font-mono">{app.branch}</code>
|
||||
{app.sourceBranch ? (
|
||||
<code className="truncate font-mono">{app.sourceBranch}</code>
|
||||
) : (
|
||||
<span className="text-amber-600 italic font-medium">未配置分支</span>
|
||||
)}
|
||||
|
||||
@ -43,7 +43,7 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
// 获取当前登录用户
|
||||
const currentUser = useSelector((state: RootState) => state.user.userInfo);
|
||||
|
||||
// ✅ 使用 useMemo 缓存预填充数据,避免每次渲染都创建新对象
|
||||
// 使用 useMemo 缓存预填充数据,避免每次渲染都创建新对象
|
||||
const prefillData = React.useMemo(() => {
|
||||
return {
|
||||
// 构建类型
|
||||
@ -52,19 +52,19 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
jenkins: app.buildType === 'JENKINS' ? {
|
||||
serverId: app.deploySystemId?.toString() || '',
|
||||
jobName: app.deployJob || '',
|
||||
branch: app.branch || 'master',
|
||||
branch: app.sourceBranch,
|
||||
} : undefined,
|
||||
// 🆕 源Git仓库配置
|
||||
// 源Git仓库配置
|
||||
sourceRepository: app.sourceGitSystemId ? {
|
||||
systemId: app.sourceGitSystemId,
|
||||
projectId: app.sourceGitProjectId,
|
||||
branch: app.sourceBranch || '',
|
||||
branch: app.sourceBranch,
|
||||
} : undefined,
|
||||
// 🆕 目标Git仓库配置
|
||||
// 目标Git仓库配置
|
||||
targetRepository: app.targetGitSystemId ? {
|
||||
systemId: app.targetGitSystemId,
|
||||
projectId: app.targetGitProjectId,
|
||||
branch: app.targetBranch || '',
|
||||
branch: app.targetBranch,
|
||||
} : undefined,
|
||||
// 团队信息
|
||||
teamId: teamId?.toString() || '',
|
||||
@ -98,7 +98,7 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
};
|
||||
}, [app, environment, teamId, currentUser]); // 只在这些依赖变化时重新生成
|
||||
|
||||
// 🎯 1. 加载表单定义 (ID=2)
|
||||
// 1. 加载表单定义 (ID=2)
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
loadFormSchema();
|
||||
@ -119,7 +119,7 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
};
|
||||
|
||||
|
||||
// 🎯 2. beforeSubmit 钩子:合并预填充数据
|
||||
// 2. beforeSubmit 钩子:合并预填充数据
|
||||
const handleBeforeSubmit = async (userInputData: Record<string, any>) => {
|
||||
// 合并数据:用户输入优先级更高
|
||||
const finalData = {
|
||||
@ -130,10 +130,10 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
return finalData;
|
||||
};
|
||||
|
||||
// 🎯 3. 提交到后端
|
||||
// 3. 提交到后端
|
||||
const handleSubmit = async (formData: Record<string, any>) => {
|
||||
try {
|
||||
// 🔍 开发环境下打印完整数据用于调试
|
||||
// 开发环境下打印完整数据用于调试
|
||||
if (import.meta.env.DEV) {
|
||||
console.group('🚀 部署请求数据');
|
||||
console.log('完整数据结构:', JSON.stringify(formData, null, 2));
|
||||
@ -141,7 +141,7 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
// ✅ 使用完整的表单数据提交到后端
|
||||
// 使用完整的表单数据提交到后端
|
||||
await startDeployment(formData);
|
||||
|
||||
message.success(
|
||||
@ -152,12 +152,12 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
|
||||
return {success: true};
|
||||
} catch (error: any) {
|
||||
// ✅ 直接抛出原始错误,让 request.ts 拦截器统一处理错误提示
|
||||
// 直接抛出原始错误,让 request.ts 拦截器统一处理错误提示
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// 🎯 4. 提交成功后的处理
|
||||
// 4. 提交成功后的处理
|
||||
const handleAfterSubmit = async () => {
|
||||
onClose();
|
||||
if (onSuccess) {
|
||||
@ -165,9 +165,9 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
// 🎯 5. 错误处理
|
||||
// 5. 错误处理
|
||||
const handleError = async (error: any) => {
|
||||
// ✅ 不再显示错误提示,因为 request.ts 拦截器已经统一处理了
|
||||
// 不再显示错误提示,因为 request.ts 拦截器已经统一处理了
|
||||
// 这里只做日志记录,避免重复提示
|
||||
console.error('部署失败:', error);
|
||||
};
|
||||
|
||||
@ -50,22 +50,20 @@ export interface ApplicationConfig {
|
||||
applicationDesc?: string;
|
||||
language?: DevelopmentLanguageTypeEnum; // 开发语言
|
||||
buildType?: BuildType; // 构建类型
|
||||
branch: string;
|
||||
deployBranch?: string; // 🆕 部署分支
|
||||
deploySystemId?: number;
|
||||
deploySystemName?: string;
|
||||
deployJob?: string;
|
||||
workflowDefinitionId?: number;
|
||||
workflowDefinitionFormId?: number; // 🆕 工作流表单ID
|
||||
workflowDefinitionFormId?: number;
|
||||
workflowDefinitionName?: string;
|
||||
workflowDefinitionKey?: string;
|
||||
// 🆕 源Git配置
|
||||
// 源Git配置
|
||||
sourceGitSystemId?: number;
|
||||
sourceGitSystemName?: string;
|
||||
sourceGitProjectId?: number;
|
||||
sourceGitProjectName?: string;
|
||||
sourceBranch?: string;
|
||||
// 🆕 目标Git配置
|
||||
// 目标Git配置
|
||||
targetGitSystemId?: number;
|
||||
targetGitSystemName?: string;
|
||||
targetGitProjectId?: number;
|
||||
@ -94,10 +92,10 @@ export interface DeployEnvironment {
|
||||
sort: number;
|
||||
requiresApproval: boolean;
|
||||
approvers: Approver[];
|
||||
notificationConfig?: NotificationConfig; // 🆕 通知配置
|
||||
requireCodeReview: boolean; // 🆕 是否需要代码审查
|
||||
canDeploy: boolean; // 🆕 当前用户是否可以发起部署
|
||||
canApprove: boolean; // 🆕 当前用户是否可以审批部署
|
||||
notificationConfig?: NotificationConfig;
|
||||
requireCodeReview: boolean;
|
||||
canDeploy: boolean;
|
||||
canApprove: boolean;
|
||||
applications: ApplicationConfig[];
|
||||
}
|
||||
|
||||
@ -113,13 +111,12 @@ export interface DeployTeam {
|
||||
teamCode: string;
|
||||
teamName: string;
|
||||
description?: string;
|
||||
ownerId: number; // 🆕 团队负责人ID
|
||||
ownerName: string; // 🆕 团队负责人名称
|
||||
members: TeamMember[]; // 🆕 团队成员列表
|
||||
ownerId: number;
|
||||
ownerName: string;
|
||||
members: TeamMember[];
|
||||
environments: DeployEnvironment[];
|
||||
}
|
||||
|
||||
// ✅ 新接口直接返回 teams 数组
|
||||
export type DeployEnvironmentsResponse = DeployTeam[];
|
||||
|
||||
export interface StartDeploymentRequest {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import {ConfigurableNodeDefinition, NodeType, NodeCategory, defineNodeOutputs} from './types';
|
||||
import {DataSourceType} from '@/domain/dataSource';
|
||||
|
||||
/**
|
||||
* Git同步检测节点定义(纯配置)
|
||||
@ -51,35 +50,35 @@ export const GitSyncCheckNodeDefinition: ConfigurableNodeDefinition = {
|
||||
default: true
|
||||
},
|
||||
sourceGitSystemId: {
|
||||
type: "number",
|
||||
type: "string",
|
||||
title: "源Git系统",
|
||||
description: "内网Git系统(数据源或变量)",
|
||||
"x-dataSource": DataSourceType.GIT_REPOSITORIES,
|
||||
"x-allow-variable": true
|
||||
description: "源Git系统ID(输入变量,如 ${teamApplication.sourceGitSystemId})",
|
||||
"x-allow-variable": true,
|
||||
"x-placeholder": "${teamApplication.sourceGitSystemId}"
|
||||
},
|
||||
sourceGitProjectId: {
|
||||
type: "number",
|
||||
type: "string",
|
||||
title: "源Git项目",
|
||||
description: "源仓库项目ID(输入变量,如 ${teamApplication.codeSourceProjectId})",
|
||||
description: "源仓库项目ID(输入变量,如 ${teamApplication.sourceGitProjectId})",
|
||||
"x-allow-variable": true,
|
||||
"x-placeholder": "${teamApplication.codeSourceProjectId}"
|
||||
"x-placeholder": "${teamApplication.sourceGitProjectId}"
|
||||
},
|
||||
sourceBranch: {
|
||||
type: "string",
|
||||
title: "源分支",
|
||||
description: "源分支名称(输入变量,如 ${teamApplication.branch})",
|
||||
description: "源分支名称(输入变量,如 ${teamApplication.sourceBranch})",
|
||||
"x-allow-variable": true,
|
||||
"x-placeholder": "${teamApplication.branch}"
|
||||
"x-placeholder": "${teamApplication.sourceBranch}"
|
||||
},
|
||||
targetGitSystemId: {
|
||||
type: "number",
|
||||
type: "string",
|
||||
title: "目标Git系统",
|
||||
description: "客户Git系统(数据源或变量)",
|
||||
"x-dataSource": DataSourceType.GIT_REPOSITORIES,
|
||||
"x-allow-variable": true
|
||||
description: "目标Git系统ID(输入变量,如 ${teamApplication.targetGitSystemId})",
|
||||
"x-allow-variable": true,
|
||||
"x-placeholder": "${teamApplication.targetGitSystemId}"
|
||||
},
|
||||
targetGitProjectId: {
|
||||
type: "number",
|
||||
type: "string",
|
||||
title: "目标Git项目",
|
||||
description: "目标仓库项目ID(输入变量,如 ${teamApplication.targetGitProjectId})",
|
||||
"x-allow-variable": true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user