complete edit build feature for releaseMethod equals 1

This commit is contained in:
Eleven 2021-01-15 20:32:26 +08:00
parent f6cdc6d9dc
commit 0b3c5473f4
3 changed files with 54 additions and 12 deletions

View File

@ -69,6 +69,7 @@ export function editBuild(params) {
group: params.group, group: params.group,
repoType: params.repoType, repoType: params.repoType,
// 其他参数 // 其他参数
releaseMethodDataId_1: params.releaseMethodDataId_1,
releaseMethodDataId_2_node: params.releaseMethodDataId_2_node, releaseMethodDataId_2_node: params.releaseMethodDataId_2_node,
releaseMethodDataId_2_project: params.releaseMethodDataId_2_project, releaseMethodDataId_2_project: params.releaseMethodDataId_2_project,
afterOpt: params.afterOpt, afterOpt: params.afterOpt,

View File

@ -115,18 +115,19 @@
<a-radio :value="3">SSH</a-radio> <a-radio :value="3">SSH</a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
<!-- 节点 --> <!-- 节点分发 -->
<a-form-model-item v-if="temp.releaseMethod === 1" label="分发项目" prop="releaseMethodDataId">
<a-select v-model="temp.releaseMethodDataId_1" placeholder="请选择分发项目">
<a-select-option v-for="dispatch in dispatchList" :key="dispatch.id">{{ dispatch.name }}</a-select-option>
</a-select>
</a-form-model-item>
<!-- 项目 --> <!-- 项目 -->
<a-form-model-item v-if="temp.releaseMethod === 2" label="发布项目" prop="releaseMethodDataId"> <a-form-model-item v-if="temp.releaseMethod === 2" label="发布项目" prop="releaseMethodDataId">
<a-cascader v-model="temp.releaseMethodDataIdList" :options="cascaderList" placeholder="Please select" @change="onChangeProject" /> <a-cascader v-model="temp.releaseMethodDataIdList" :options="cascaderList" placeholder="Please select" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item v-if="temp.releaseMethod === 2" label="发布后操作" prop="afterOpt"> <a-form-model-item v-if="temp.releaseMethod === 2" label="发布后操作" prop="afterOpt">
<a-select v-model="temp.afterOpt" placeholder="请选择发布后操作"> <a-select v-model="temp.afterOpt" placeholder="请选择发布后操作">
<a-select-option :key="0">不做任何操作</a-select-option> <a-select-option v-for="opt in afterOptList" :key="opt.value">{{ opt.title }}</a-select-option>
<a-select-option :key="1">并发重启</a-select-option>
<a-select-option :key="2">完整顺序重启(有重启失败将结束本次)</a-select-option>
<a-select-option :key="3">顺序重启(有重启失败将继续)</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<!-- SSH --> <!-- SSH -->
@ -172,6 +173,7 @@ import {
getBuildGroupList, getBuildList, getBranchList, editBuild, deleteBuild, getBuildGroupList, getBuildList, getBranchList, editBuild, deleteBuild,
getTriggerUrl, resetTrigger, clearBuid, startBuild, stopBuild getTriggerUrl, resetTrigger, clearBuid, startBuild, stopBuild
} from '../../api/build'; } from '../../api/build';
import { getDishPatchList } from '../../api/dispatch';
import { getNodeProjectList } from '../../api/node' import { getNodeProjectList } from '../../api/node'
import { getSshList } from '../../api/ssh' import { getSshList } from '../../api/ssh'
import { parseTime } from '../../utils/time'; import { parseTime } from '../../utils/time';
@ -186,6 +188,7 @@ export default {
groupList: [], groupList: [],
list: [], list: [],
branchList: [], branchList: [],
dispatchList: [],
cascaderList: [], cascaderList: [],
sshList: [], sshList: [],
temp: {}, temp: {},
@ -193,6 +196,12 @@ export default {
addGroupvisible: false, addGroupvisible: false,
triggerVisible: false, triggerVisible: false,
buildLogVisible: false, buildLogVisible: false,
afterOptList: [
{title: '不做任何操作', value: 0},
{title: '并发重启', value: 1},
{title: '完整顺序重启(有重启失败将结束本次)', value: 2},
{title: '顺序重启(有重启失败将继续)', value: 3},
],
columns: [ columns: [
{title: '名称', dataIndex: 'name', width: 150, ellipsis: true, scopedSlots: {customRender: 'name'}}, {title: '名称', dataIndex: 'name', width: 150, ellipsis: true, scopedSlots: {customRender: 'name'}},
{title: '分支', dataIndex: 'branchName', width: 100, ellipsis: true, scopedSlots: {customRender: 'branchName'}}, {title: '分支', dataIndex: 'branchName', width: 100, ellipsis: true, scopedSlots: {customRender: 'branchName'}},
@ -216,6 +225,9 @@ export default {
], ],
resultDirFile: [ resultDirFile: [
{ required: true, message: 'Please input build target path', trigger: 'blur' } { required: true, message: 'Please input build target path', trigger: 'blur' }
],
releasePath: [
{ required: true, message: 'Please input release path', trigger: 'blur' }
] ]
} }
} }
@ -244,6 +256,15 @@ export default {
this.loading = false; this.loading = false;
}) })
}, },
//
loadDispatchList() {
this.dispatchList = [];
getDishPatchList().then(res => {
if (res.code === 200) {
this.dispatchList = res.data;
}
})
},
// //
loadNodeProjectList() { loadNodeProjectList() {
this.cascaderList = []; this.cascaderList = [];
@ -283,6 +304,8 @@ export default {
// //
handleAdd() { handleAdd() {
this.temp = {}; this.temp = {};
this.branchList = [];
this.loadDispatchList();
this.loadNodeProjectList(); this.loadNodeProjectList();
this.loadSshList(); this.loadSshList();
this.editBuildVisible = true; this.editBuildVisible = true;
@ -291,10 +314,20 @@ export default {
handleEdit(record) { handleEdit(record) {
this.temp = Object.assign(record); this.temp = Object.assign(record);
this.temp.tempGroup = ''; this.temp.tempGroup = '';
//
if (record.releaseMethodDataId) { if (record.releaseMethodDataId) {
if (record.releaseMethod === 1) {
this.temp.releaseMethodDataId_1 = record.releaseMethodDataId;
}
if (record.releaseMethod === 2) {
this.temp.releaseMethodDataIdList = record.releaseMethodDataId.split(':'); this.temp.releaseMethodDataIdList = record.releaseMethodDataId.split(':');
} }
if (record.releaseMethod === 3) {
this.temp.releaseMethodDataId_3 = record.releaseMethodDataId;
}
}
this.loadBranchList(); this.loadBranchList();
this.loadDispatchList();
this.loadNodeProjectList(); this.loadNodeProjectList();
this.loadSshList(); this.loadSshList();
this.editBuildVisible = true; this.editBuildVisible = true;
@ -326,10 +359,6 @@ export default {
} }
}) })
}, },
//
onChangeProject(value) {
console.log(value)
},
// //
handleEditBuildOk() { handleEditBuildOk() {
// //

View File

@ -314,6 +314,9 @@ export default {
}; };
this.loadReqId(); this.loadReqId();
this.linkDispatchVisible = true; this.linkDispatchVisible = true;
this.$nextTick(() => {
this.$refs['linkDispatchForm'].resetFields();
})
}, },
// //
handleEditDispatch(record) { handleEditDispatch(record) {
@ -329,6 +332,9 @@ export default {
}) })
this.loadReqId(); this.loadReqId();
this.linkDispatchVisible = true; this.linkDispatchVisible = true;
this.$nextTick(() => {
this.$refs['linkDispatchForm'].resetFields();
})
}, },
// //
selectProject(value) { selectProject(value) {
@ -403,6 +409,9 @@ export default {
this.loadAccesList(); this.loadAccesList();
this.loadReqId(); this.loadReqId();
this.editDispatchVisible = true; this.editDispatchVisible = true;
this.$nextTick(() => {
this.$refs['editDispatchForm'].resetFields();
})
}, },
// //
handleEditDispatchProject(record) { handleEditDispatchProject(record) {
@ -440,6 +449,9 @@ export default {
this.loadAccesList(); this.loadAccesList();
this.loadReqId(); this.loadReqId();
this.editDispatchVisible = true; this.editDispatchVisible = true;
this.$nextTick(() => {
this.$refs['editDispatchForm'].resetFields();
})
}, },
// //
handleAddReplica(nodeId) { handleAddReplica(nodeId) {