|
|
@@ -365,6 +365,7 @@ export default {
|
|
|
currentLogId: -1,
|
|
|
currentLog: '',
|
|
|
apiTestOptions: [],
|
|
|
+ pipelineConfigTemplate: '',
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -446,12 +447,13 @@ export default {
|
|
|
pipelineId: id,
|
|
|
})).configJson;
|
|
|
this.pipelineConfig = JSON.parse(config || '{}');
|
|
|
+ this.pipelineConfigTemplate = JSON.parse(config || '{}');
|
|
|
this.pipelineConfig.forEach((item) => {
|
|
|
const targetStage = this.stages.find((stage) => stage.name === item.name);
|
|
|
if (targetStage) {
|
|
|
targetStage.configs.forEach((configTemplate) => {
|
|
|
if (!item.configs[configTemplate.name]) {
|
|
|
- item.configs[configTemplate.name] = configTemplate.value;
|
|
|
+ item.configs[configTemplate.name] = this.parseConfigValue(configTemplate.value);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -475,10 +477,16 @@ export default {
|
|
|
},
|
|
|
async handlePipelineUpdateConfirm() {
|
|
|
this.confirmLoading = true;
|
|
|
+ this.pipelineConfigTemplate.forEach((item) => {
|
|
|
+ const target = this.pipelineConfig.find((i) => i.name === item.name);
|
|
|
+ Object.keys(item.configs).forEach((key) => {
|
|
|
+ item.configs[key] = target.configs[key];
|
|
|
+ });
|
|
|
+ });
|
|
|
await PipelineAPI.updatePipeline({
|
|
|
projectId: this.$store.state.workspace.currentProjectId,
|
|
|
pipelineId: this.editingPipelineId,
|
|
|
- configJson: JSON.stringify(this.pipelineConfig),
|
|
|
+ configJson: JSON.stringify(this.pipelineConfigTemplate),
|
|
|
});
|
|
|
this.confirmLoading = false;
|
|
|
this.showPipelineEditModal = false;
|
|
|
@@ -535,6 +543,12 @@ export default {
|
|
|
});
|
|
|
this.dialogLoading = false;
|
|
|
},
|
|
|
+ parseConfigValue(str) {
|
|
|
+ const project = this.$store.state.workspace.projectList.find(
|
|
|
+ (item) => item.id === this.this.$store.state.workspace.currentProjectId,
|
|
|
+ );
|
|
|
+ return str.replaceAll('{projectName}', project.name).replaceAll('{projectId}', project.id);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|