refactor: 重构部署功能
This commit is contained in:
@@ -729,20 +729,6 @@ function ProjectDetailPage() {
|
||||
/>
|
||||
);
|
||||
|
||||
// 获取选中的流水线
|
||||
const _selectedPipeline = pipelines.find(
|
||||
(pipeline) => pipeline.id === selectedPipelineId,
|
||||
);
|
||||
|
||||
// 格式化文件大小
|
||||
const formatSize = (bytes: number): string => {
|
||||
if (bytes === 0) return '0 B';
|
||||
const k = 1024;
|
||||
const sizes = ['B', 'KB', 'MB', 'GB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return `${(bytes / k ** i).toFixed(2)} ${sizes[i]}`;
|
||||
};
|
||||
|
||||
// 获取工作目录状态标签
|
||||
const getWorkspaceStatusTag = (
|
||||
status: string,
|
||||
@@ -784,12 +770,6 @@ function ProjectDetailPage() {
|
||||
label: '状态',
|
||||
value: <Tag color={statusInfo.color}>{statusInfo.text}</Tag>,
|
||||
},
|
||||
{
|
||||
label: '目录大小',
|
||||
value: workspaceStatus.size
|
||||
? formatSize(workspaceStatus.size)
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
label: '当前分支',
|
||||
value: workspaceStatus.gitInfo?.branch || '-',
|
||||
@@ -797,7 +777,7 @@ function ProjectDetailPage() {
|
||||
{
|
||||
label: '最后提交',
|
||||
value: workspaceStatus.gitInfo?.lastCommit ? (
|
||||
<Space direction="vertical" size="mini">
|
||||
<Space size="small">
|
||||
<Typography.Text code>
|
||||
{workspaceStatus.gitInfo.lastCommit}
|
||||
</Typography.Text>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import {
|
||||
Button,
|
||||
Collapse,
|
||||
Form,
|
||||
Input,
|
||||
Message,
|
||||
Modal,
|
||||
} from '@arco-design/web-react';
|
||||
import { useState } from 'react';
|
||||
import EnvPresetsEditor from '../../detail/components/EnvPresetsEditor';
|
||||
import type { Project } from '../../types';
|
||||
import { projectService } from '../service';
|
||||
|
||||
@@ -30,15 +28,7 @@ function CreateProjectModal({
|
||||
const values = await form.validate();
|
||||
setLoading(true);
|
||||
|
||||
// 序列化环境预设
|
||||
const submitData = {
|
||||
...values,
|
||||
envPresets: values.envPresets
|
||||
? JSON.stringify(values.envPresets)
|
||||
: undefined,
|
||||
};
|
||||
|
||||
const newProject = await projectService.create(submitData);
|
||||
const newProject = await projectService.create(values);
|
||||
|
||||
Message.success('项目创建成功');
|
||||
onSuccess(newProject);
|
||||
@@ -142,14 +132,6 @@ function CreateProjectModal({
|
||||
>
|
||||
<Input placeholder="请输入绝对路径,如: /data/projects/my-app" />
|
||||
</Form.Item>
|
||||
|
||||
<Collapse defaultActiveKey={[]} style={{ marginTop: 16 }}>
|
||||
<Collapse.Item header="环境变量预设配置(可选)" name="envPresets">
|
||||
<Form.Item field="envPresets" noStyle>
|
||||
<EnvPresetsEditor />
|
||||
</Form.Item>
|
||||
</Collapse.Item>
|
||||
</Collapse>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user