1
This commit is contained in:
parent
78ea6f49d3
commit
d9cbbe93f1
@ -10,6 +10,7 @@ import DeploymentConfigModal from './components/DeploymentConfigModal';
|
|||||||
import {ProTable} from '@ant-design/pro-components';
|
import {ProTable} from '@ant-design/pro-components';
|
||||||
import type {ProColumns, ActionType} from '@ant-design/pro-components';
|
import type {ProColumns, ActionType} from '@ant-design/pro-components';
|
||||||
import {Editor} from '@/components/Editor';
|
import {Editor} from '@/components/Editor';
|
||||||
|
import type {WorkflowDefinition} from '@/pages/Workflow/Definition/types';
|
||||||
|
|
||||||
const {Option} = Select;
|
const {Option} = Select;
|
||||||
|
|
||||||
@ -79,22 +80,28 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
const [templates, setTemplates] = useState<DeployConfigTemplate[]>([]);
|
const [templates, setTemplates] = useState<DeployConfigTemplate[]>([]);
|
||||||
const [codePreviewVisible, setCodePreviewVisible] = useState(false);
|
const [codePreviewVisible, setCodePreviewVisible] = useState(false);
|
||||||
const [previewCode, setPreviewCode] = useState<{ code: string; language?: string }>({code: ''});
|
const [previewCode, setPreviewCode] = useState<{ code: string; language?: string }>({code: ''});
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
const actionRef = React.useRef<ActionType>();
|
const actionRef = React.useRef<ActionType>();
|
||||||
|
|
||||||
// 获取环境列表
|
// 获取环境列表
|
||||||
const fetchEnvironments = async () => {
|
const fetchEnvironments = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true);
|
||||||
const data = await getEnvironmentList();
|
const data = await getEnvironmentList();
|
||||||
setEnvironments(data);
|
setEnvironments(data);
|
||||||
if (data.length > 0 && !selectedEnvId) {
|
if (data.length > 0) {
|
||||||
setSelectedEnvId(data[0].id);
|
setSelectedEnvId(data[0].id);
|
||||||
|
// 手动触发表格刷新
|
||||||
|
actionRef.current?.reload();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('获取环境列表失败');
|
message.error('获取环境列表失败');
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取配置模板
|
// 获取<EFBFBD><EFBFBD>置模板
|
||||||
const fetchTemplates = async () => {
|
const fetchTemplates = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await getDeployConfigTemplates();
|
const data = await getDeployConfigTemplates();
|
||||||
@ -104,6 +111,7 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 初始化数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchEnvironments();
|
fetchEnvironments();
|
||||||
fetchTemplates();
|
fetchTemplates();
|
||||||
@ -240,13 +248,28 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
width: 150,
|
width: 150,
|
||||||
copyable: true,
|
copyable: true,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
fixed: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '应用名称',
|
title: '应用名称',
|
||||||
dataIndex: ['application', 'appName'],
|
dataIndex: ['application', 'appName'],
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
fixed: 'left',
|
},
|
||||||
|
{
|
||||||
|
title: '工作流',
|
||||||
|
dataIndex: ['publishedWorkflowDefinition', 'name'],
|
||||||
|
width: 200,
|
||||||
|
ellipsis: true,
|
||||||
|
render: (_, record) => {
|
||||||
|
const workflow = record.publishedWorkflowDefinition;
|
||||||
|
if (!workflow) return '-';
|
||||||
|
return (
|
||||||
|
<Tooltip title={`${workflow.name} (${workflow.key})`}>
|
||||||
|
<span>{workflow.name}</span>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '构建配置',
|
title: '构建配置',
|
||||||
@ -309,6 +332,7 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
onChange={handleEnvChange}
|
onChange={handleEnvChange}
|
||||||
style={{width: 200}}
|
style={{width: 200}}
|
||||||
placeholder="请选择环境"
|
placeholder="请选择环境"
|
||||||
|
loading={loading}
|
||||||
>
|
>
|
||||||
{environments.map((env) => (
|
{environments.map((env) => (
|
||||||
<Option key={env.id} value={env.id}>
|
<Option key={env.id} value={env.id}>
|
||||||
@ -350,7 +374,7 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
}}
|
}}
|
||||||
request={async (params) => {
|
request={async (params) => {
|
||||||
if (!selectedEnvId) {
|
if (!selectedEnvId || loading) {
|
||||||
return {
|
return {
|
||||||
data: [],
|
data: [],
|
||||||
success: true,
|
success: true,
|
||||||
@ -363,6 +387,7 @@ const DeploymentConfigList: React.FC = () => {
|
|||||||
pageNum: params.current,
|
pageNum: params.current,
|
||||||
environmentId: selectedEnvId,
|
environmentId: selectedEnvId,
|
||||||
enabled: params.enabled as boolean,
|
enabled: params.enabled as boolean,
|
||||||
|
workflowDefinitionId: params.workflowDefinitionId as number
|
||||||
};
|
};
|
||||||
const data = await getDeploymentConfigPage(queryParams);
|
const data = await getDeploymentConfigPage(queryParams);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import {Application} from '../../Application/List/types';
|
|||||||
import {DevelopmentLanguageTypeEnum} from '../../Application/List/types';
|
import {DevelopmentLanguageTypeEnum} from '../../Application/List/types';
|
||||||
import {BuildTypeEnum} from '../../Environment/List/types';
|
import {BuildTypeEnum} from '../../Environment/List/types';
|
||||||
import type {JsonNode} from '@/types/common';
|
import type {JsonNode} from '@/types/common';
|
||||||
|
import type {WorkflowDefinition} from '@/pages/Workflow/Definition/types';
|
||||||
|
|
||||||
// 部署配置模板
|
// 部署配置模板
|
||||||
export interface DeployConfigTemplate {
|
export interface DeployConfigTemplate {
|
||||||
@ -23,6 +24,7 @@ export interface DeploymentConfig extends BaseResponse {
|
|||||||
buildType: BuildTypeEnum;
|
buildType: BuildTypeEnum;
|
||||||
languageType: DevelopmentLanguageTypeEnum;
|
languageType: DevelopmentLanguageTypeEnum;
|
||||||
workflowDefinitionId: number;
|
workflowDefinitionId: number;
|
||||||
|
publishedWorkflowDefinition?: WorkflowDefinition;
|
||||||
buildVariables: JsonNode;
|
buildVariables: JsonNode;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user