fix: 修复接口测试树节点统计缺陷、更改树节点样式、修复场景步骤单独调试无法更改环境变量的Bug
修复接口测试树节点统计缺陷、更改树节点样式、修复场景步骤单独调试无法更改环境变量的Bug
This commit is contained in:
parent
fd968dfbfa
commit
81106b0311
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import io.metersphere.api.dto.RunningParamKeys;
|
import io.metersphere.api.dto.RunningParamKeys;
|
||||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||||
|
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -14,6 +15,7 @@ import org.apache.jmeter.save.SaveService;
|
||||||
import org.apache.jmeter.testelement.TestElement;
|
import org.apache.jmeter.testelement.TestElement;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -30,6 +32,23 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||||
|
if(StringUtils.isEmpty(this.getUseEnviroment())){
|
||||||
|
if(config.getConfig() != null){
|
||||||
|
if(config.getProjectId() != null){
|
||||||
|
String evnId = config.getConfig().get(config.getProjectId()).getApiEnvironmentid();
|
||||||
|
this.setUseEnviroment(evnId);
|
||||||
|
}else {
|
||||||
|
Collection<EnvironmentConfig> evnConfigList = config.getConfig().values();
|
||||||
|
if(evnConfigList!=null && !evnConfigList.isEmpty()){
|
||||||
|
for (EnvironmentConfig configItem : evnConfigList) {
|
||||||
|
String evnId = configItem.getApiEnvironmentid();
|
||||||
|
this.setUseEnviroment(evnId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//替换Metersphere环境变量
|
//替换Metersphere环境变量
|
||||||
script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnviroment()+".\"");
|
script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnviroment()+".\"");
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.annotation.JSONType;
|
||||||
import io.metersphere.api.dto.RunningParamKeys;
|
import io.metersphere.api.dto.RunningParamKeys;
|
||||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||||
|
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -14,6 +15,7 @@ import org.apache.jmeter.save.SaveService;
|
||||||
import org.apache.jmeter.testelement.TestElement;
|
import org.apache.jmeter.testelement.TestElement;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -30,6 +32,23 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||||
|
if(StringUtils.isEmpty(this.getUseEnviroment())){
|
||||||
|
if(config.getConfig() != null){
|
||||||
|
if(config.getProjectId() != null){
|
||||||
|
String evnId = config.getConfig().get(config.getProjectId()).getApiEnvironmentid();
|
||||||
|
this.setUseEnviroment(evnId);
|
||||||
|
}else {
|
||||||
|
Collection<EnvironmentConfig> evnConfigList = config.getConfig().values();
|
||||||
|
if(evnConfigList!=null && !evnConfigList.isEmpty()){
|
||||||
|
for (EnvironmentConfig configItem : evnConfigList) {
|
||||||
|
String evnId = configItem.getApiEnvironmentid();
|
||||||
|
this.setUseEnviroment(evnId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//替换Metersphere环境变量
|
//替换Metersphere环境变量
|
||||||
script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnviroment()+".\"");
|
script = StringUtils.replace(script,RunningParamKeys.API_ENVIRONMENT_ID,"\""+RunningParamKeys.RUNNING_PARAMS_PREFIX+this.getUseEnviroment()+".\"");
|
||||||
|
|
||||||
|
|
|
@ -561,6 +561,7 @@ public class ApiDefinitionService {
|
||||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(request.getProjectId()));
|
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(request.getProjectId()));
|
||||||
if (environment != null) {
|
if (environment != null) {
|
||||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||||
|
env.setApiEnvironmentid(environment.getId());
|
||||||
envConfig.put(request.getProjectId(), env);
|
envConfig.put(request.getProjectId(), env);
|
||||||
config.setConfig(envConfig);
|
config.setConfig(envConfig);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
@exportAPI="exportAPI"
|
@exportAPI="exportAPI"
|
||||||
@exportJmx="exportJmx"
|
@exportJmx="exportJmx"
|
||||||
@refreshAll="refreshAll"
|
@refreshAll="refreshAll"
|
||||||
|
page-source="scenario"
|
||||||
:type="'edit'"
|
:type="'edit'"
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</ms-aside-container>
|
</ms-aside-container>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
|
|
||||||
<ms-node-tree
|
<ms-node-tree
|
||||||
:is-display="openType"
|
:is-display="getIsRelevance"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
:tree-nodes="data"
|
:tree-nodes="data"
|
||||||
:allLabel="$t('commons.all_module_title')"
|
:allLabel="$t('commons.all_module_title')"
|
||||||
|
@ -69,7 +69,8 @@
|
||||||
},
|
},
|
||||||
showOperator: Boolean,
|
showOperator: Boolean,
|
||||||
relevanceProjectId: String,
|
relevanceProjectId: String,
|
||||||
planId: String
|
planId: String,
|
||||||
|
pageSource:String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isPlanModel() {
|
isPlanModel() {
|
||||||
|
@ -81,6 +82,13 @@
|
||||||
projectId() {
|
projectId() {
|
||||||
return getCurrentProjectID();
|
return getCurrentProjectID();
|
||||||
},
|
},
|
||||||
|
getIsRelevance(){
|
||||||
|
if(this.pageSource !== 'scenario'){
|
||||||
|
return this.openType;
|
||||||
|
}else {
|
||||||
|
return "scenario";
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
@setNodeTree="setNodeTree"
|
@setNodeTree="setNodeTree"
|
||||||
@enableTrash="enableTrash"
|
@enableTrash="enableTrash"
|
||||||
:type="'edit'"
|
:type="'edit'"
|
||||||
|
page-source="definition"
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</ms-aside-container>
|
</ms-aside-container>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<slot name="header"></slot>
|
<slot name="header"></slot>
|
||||||
|
|
||||||
<ms-node-tree
|
<ms-node-tree
|
||||||
:is-display="openType"
|
:is-display="getIsRelevance"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
:tree-nodes="data"
|
:tree-nodes="data"
|
||||||
:type="isReadOnly ? 'view' : 'edit'"
|
:type="isReadOnly ? 'view' : 'edit'"
|
||||||
|
@ -82,7 +82,8 @@
|
||||||
showOperator: Boolean,
|
showOperator: Boolean,
|
||||||
planId: String,
|
planId: String,
|
||||||
relevanceProjectId: String,
|
relevanceProjectId: String,
|
||||||
reviewId: String
|
reviewId: String,
|
||||||
|
pageSource:String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isPlanModel() {
|
isPlanModel() {
|
||||||
|
@ -97,6 +98,13 @@
|
||||||
projectId() {
|
projectId() {
|
||||||
return getCurrentProjectID();
|
return getCurrentProjectID();
|
||||||
},
|
},
|
||||||
|
getIsRelevance(){
|
||||||
|
if(this.pageSource !== 'definition'){
|
||||||
|
return this.openType;
|
||||||
|
}else {
|
||||||
|
return "definition";
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initProtocol();
|
this.initProtocol();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<i class="el-icon-folder"/>
|
<i class="el-icon-folder"/>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="!data.isEdit" class="node-title" v-text="data.name"/>
|
<span v-if="!data.isEdit" class="node-title" v-text="data.name"/>
|
||||||
<span class="node-title" v-if="isDisplay!=='relevance'">
|
<span class="count-title" v-if="isDisplay!=='relevance'">
|
||||||
<span style="color: #6C317C">{{ data.caseNum }}</span>
|
<span style="color: #6C317C">{{ data.caseNum }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="!disabled" class="node-operate child">
|
<span v-if="!disabled" class="node-operate child">
|
||||||
|
@ -421,6 +421,14 @@ export default {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.count-title {
|
||||||
|
width: auto;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 0px 5px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.node-operate > i {
|
.node-operate > i {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
margin: 0px 5px;
|
margin: 0px 5px;
|
||||||
|
|
Loading…
Reference in New Issue