refactor(接口测试): 优化批量保存环境,编辑页面显示环境

--bug=1025455
--user=王孝刚
【接口测试】github#23674,接口自动化批量编辑环境保存后,自动化步骤内环境显示仍为之前保存的环境信息
https://www.tapd.cn/55049933/s/1363383
This commit is contained in:
wxg0103 2023-04-17 11:41:28 +08:00 committed by fit2-zhao
parent 0527393ab4
commit e5267db35c
2 changed files with 23 additions and 0 deletions

View File

@ -732,6 +732,16 @@ public class ApiScenarioService {
ElementUtil.dataFormatting(element);
scenarioWithBLOBs.setScenarioDefinition(element.toString());
}
if (StringUtils.isNotBlank(scenarioWithBLOBs.getEnvironmentJson())) {
ApiScenarioEnvRequest request = new ApiScenarioEnvRequest();
request.setEnvironmentEnable(false);
request.setDefinition(scenarioWithBLOBs.getScenarioDefinition());
request.setEnvironmentMap( JSON.parseObject(scenarioWithBLOBs.getEnvironmentJson(), Map.class));
request.setEnvironmentType(scenarioWithBLOBs.getEnvironmentType());
request.setEnvironmentGroupId(scenarioWithBLOBs.getEnvironmentGroupId());
request.setId(scenarioWithBLOBs.getId());
scenarioWithBLOBs.setScenarioDefinition(this.setDomain(request));
}
return scenarioWithBLOBs;
}

View File

@ -1880,6 +1880,9 @@ export default {
}
}
this.isPreventReClick = true;
if (this.currentScenario.scenarioDefinitionOrg){
delete this.currentScenario['scenarioDefinitionOrg'];
}
await saveScenario(this.path, this.currentScenario, this.scenarioDefinition, this, (response) => {
this.$success(this.$t('commons.save_success'));
this.isPreventReClick = false;
@ -2014,6 +2017,16 @@ export default {
}
this.dataProcessing(obj.hashTree);
this.scenarioDefinition = obj.hashTree;
this.$nextTick(()=>{
let data = this.scenarioDefinition;
if (data.hashTree) {
this.sort(data.hashTree);
let domainMap = new Map();
this.getEnvDomain(data.hashTree, domainMap);
this.margeDomain(this.scenarioDefinition, domainMap);
this.cancelBatchProcessing();
}
})
}
}
if (this.currentScenario.copy) {