Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-02-25 13:46:42 +08:00
commit 8412735cec
48 changed files with 757 additions and 863 deletions

1
.github/stale.yml vendored
View File

@ -7,6 +7,7 @@ exemptLabels:
- lifecycle/frozen
- pinned
- security
- plan
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >

View File

@ -58,6 +58,7 @@ import org.apache.jmeter.extractor.RegexExtractor;
import org.apache.jmeter.extractor.XPath2Extractor;
import org.apache.jmeter.extractor.json.jsonpath.JSONPostProcessor;
import org.apache.jmeter.modifiers.JSR223PreProcessor;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
import org.apache.jmeter.protocol.java.sampler.JSR223Sampler;
@ -77,13 +78,17 @@ import java.util.*;
public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
private final String ENV_NAME = "导入数据环境";
/**
* todo 存放单个请求下的Header 为了和平台对应
*/
private Map<Integer, List<Object>> headerMap = new HashMap<>();
@Override
public ScenarioImport parse(InputStream inputSource, ApiTestImportRequest request) {
try {
Object scriptWrapper = SaveService.loadElement(inputSource);
HashTree testPlan = this.getHashTree(scriptWrapper);
// 优先初始化数据源
// 优先初始化数据源及部分参数
preInitPool(request.getProjectId(), testPlan);
MsScenario scenario = new MsScenario();
@ -126,8 +131,9 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
return (HashTree) field.get(scriptWrapper);
}
private void convertHttpSampler(MsHTTPSamplerProxy samplerProxy, HTTPSamplerProxy source) {
private void convertHttpSampler(MsHTTPSamplerProxy samplerProxy, Object key) {
try {
HTTPSamplerProxy source = (HTTPSamplerProxy) key;
BeanUtils.copyBean(samplerProxy, source);
if (source != null && source.getHTTPFiles().length > 0) {
samplerProxy.getBody().setBinary(new ArrayList<>());
@ -170,10 +176,23 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
samplerProxy.setPath(source.getPath());
samplerProxy.setMethod(source.getMethod());
if (source.getUrl() != null) {
// samplerProxy.setUrl(source.getUrl().toString());
samplerProxy.setUrl(source.getUrl().toString());
}
samplerProxy.setId(UUID.randomUUID().toString());
samplerProxy.setType("HTTPSamplerProxy");
// 处理HTTP协议的请求头
if (headerMap.containsKey(key.hashCode())) {
List<KeyValue> keyValues = new LinkedList<>();
headerMap.get(key.hashCode()).forEach(item -> {
HeaderManager headerManager = (HeaderManager) item;
if (headerManager.getHeaders() != null) {
for (int i = 0; i < headerManager.getHeaders().size(); i++) {
keyValues.add(new KeyValue(headerManager.getHeader(i).getName(), headerManager.getHeader(i).getValue()));
}
}
});
samplerProxy.setHeaders(keyValues);
}
} catch (Exception e) {
e.printStackTrace();
}
@ -258,7 +277,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
// 初始化已有数据池
initDataSource(projectId, ENV_NAME);
// 添加当前jmx 中新的数据池
preCreatePool(hashTree);
preCreate(hashTree);
// 更新数据源
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
dataPools.getEnvConfig().setDatabaseConfigs(new ArrayList<>(dataPools.getDataSources().values()));
@ -272,7 +291,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
}
}
private void preCreatePool(HashTree tree) {
private void preCreate(HashTree tree) {
for (Object key : tree.keySet()) {
// JDBC 数据池
if (key instanceof DataSourceElement) {
@ -304,12 +323,29 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
}
dataPools.getDataSources().put(dataSourceElement.getPropertyAsString("dataSource"), newConfig);
}
} else if (key instanceof HTTPSamplerProxy) {
// 把HTTP 请求下的HeaderManager 取出来
HashTree node = tree.get(key);
if (node != null) {
for (Object nodeKey : node.keySet()) {
if (nodeKey instanceof HeaderManager) {
if (headerMap.containsKey(key.hashCode())) {
headerMap.get(key.hashCode()).add(nodeKey);
} else {
List<Object> objects = new LinkedList<Object>() {{
this.add(nodeKey);
}};
headerMap.put(key.hashCode(), objects);
}
}
}
}
}
// 递归子项
HashTree node = tree.get(key);
if (node != null) {
preCreatePool(node);
preCreate(node);
}
}
}
@ -507,7 +543,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
else if (key instanceof HTTPSamplerProxy) {
elementNode = new MsHTTPSamplerProxy();
((MsHTTPSamplerProxy) elementNode).setBody(new Body());
convertHttpSampler((MsHTTPSamplerProxy) elementNode, (HTTPSamplerProxy) key);
convertHttpSampler((MsHTTPSamplerProxy) elementNode, key);
}
// TCP请求
else if (key instanceof TCPSampler) {
@ -610,6 +646,10 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
}
// 平台不能识别的Jmeter步骤
else {
// HTTP 请求下的所有HeaderManager已经加到请求中
if (scenario instanceof MsHTTPSamplerProxy && key instanceof HeaderManager) {
continue;
}
elementNode = new MsJmeterElement();
elementNode.setType("JmeterElement");
TestElement testElement = (TestElement) key;

View File

@ -78,11 +78,28 @@ public class MsScenario extends MsTestElement {
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
// 场景变量
if (StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
this.setVariables(variables);
}
// 场景请求头
if (StringUtils.isNotEmpty(element.getString("headers"))) {
LinkedList<KeyValue> headers = mapper.readValue(element.getString("headers"),
new TypeReference<LinkedList<KeyValue>>() {
});
this.setHeaders(headers);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
// 设置共享cookie
config.setEnableCookieShare(enableCookieShare);
if (StringUtils.isNotEmpty(environmentId)) {
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
@ -95,7 +112,10 @@ public class MsScenario extends MsTestElement {
config.setVariables(this.variables);
}
// 场景变量和环境变量
tree.add(arguments(config));
Arguments arguments = arguments(config);
if (arguments != null) {
tree.add(arguments);
}
this.addCsvDataSet(tree, variables);
this.addCounter(tree, variables);
this.addRandom(tree, variables);
@ -139,11 +159,11 @@ public class MsScenario extends MsTestElement {
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
if (CollectionUtils.isNotEmpty(this.getVariables())) {
variables.stream().filter(ScenarioVariable::isConstantValid).forEach(keyValue ->
this.getVariables().stream().filter(ScenarioVariable::isConstantValid).forEach(keyValue ->
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
);
List<ScenarioVariable> variableList = variables.stream().filter(ScenarioVariable::isListValid).collect(Collectors.toList());
List<ScenarioVariable> variableList = this.getVariables().stream().filter(ScenarioVariable::isListValid).collect(Collectors.toList());
variableList.forEach(item -> {
String[] arrays = item.getValue().split(",");
for (int i = 0; i < arrays.length; i++) {
@ -157,8 +177,10 @@ public class MsScenario extends MsTestElement {
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
);
}
return arguments;
if (arguments.getArguments() != null && arguments.getArguments().size() > 0) {
return arguments;
}
return null;
}

View File

@ -41,7 +41,6 @@ import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.config.CSVDataSet;
import org.apache.jmeter.config.RandomVariableConfig;
import org.apache.jmeter.modifiers.CounterConfig;
import org.apache.jmeter.protocol.http.control.AuthManager;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.collections.HashTree;
@ -75,7 +74,7 @@ import java.util.stream.Collectors;
})
@JSONType(seeAlso = {MsHTTPSamplerProxy.class, MsHeaderManager.class, MsJSR223Processor.class, MsJSR223PostProcessor.class,
MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, AuthManager.class, MsAssertions.class,
MsJSR223PreProcessor.class, MsTestPlan.class, MsThreadGroup.class, MsAuthManager.class, MsAssertions.class,
MsExtract.class, MsTCPSampler.class, MsDubboSampler.class, MsJDBCSampler.class, MsConstantTimer.class, MsIfController.class, MsScenario.class, MsLoopController.class, MsJmeterElement.class}, typeKey = "type")
@Data
public abstract class MsTestElement {
@ -152,7 +151,7 @@ public abstract class MsTestElement {
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(element.getId());
if (apiDefinition != null) {
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
});
@ -160,6 +159,7 @@ public abstract class MsTestElement {
}
} catch (Exception ex) {
ex.printStackTrace();
LogUtil.error(ex.getMessage());
}
}

View File

@ -173,6 +173,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
sampler.setPort(urlObject.getPort());
sampler.setProtocol(urlObject.getProtocol());
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
sampler.setPath(envPath);
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
envPath = getRestParameters(URLDecoder.decode(envPath, "UTF-8"));
sampler.setPath(envPath);

View File

@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jmeter.threads.ThreadGroup;
import org.apache.jorphan.collections.HashTree;
@ -40,7 +41,9 @@ public class MsJmeterElement extends MsTestElement {
} else if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) {
elementTree = tree.add(scriptWrapper);
}
if (scriptWrapper instanceof TestElement) {
((TestElement) scriptWrapper).setName(this.getName());
}
if (CollectionUtils.isNotEmpty(hashTree)) {
for (MsTestElement el : hashTree) {
el.toHashTree(elementTree, el.getHashTree(), config);

View File

@ -35,7 +35,6 @@ import org.aspectj.util.FileUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.QName;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -582,9 +581,11 @@ public class APITestService {
for (Element itemElement : sampleProxyElementList) {
if (isFromScenario) {
testName = itemElement.attributeValue(attribute_testName);
String[] testNameArr = testName.split(scenarioCaseNameSplit);
if (testNameArr.length > 0) {
testName = testNameArr[0];
if (StringUtils.isNotBlank(testName)) {
String[] testNameArr = testName.split(scenarioCaseNameSplit);
if (testNameArr.length > 0) {
testName = testNameArr[0];
}
}
}
itemElement.attribute(attribute_testName).setText(testName);

View File

@ -457,12 +457,15 @@ public class ApiAutomationService {
});
scenario.setHashTree(elements);
}
if (StringUtils.isNotEmpty(element.getString("variables"))) {
if (element != null && StringUtils.isNotEmpty(element.getString("variables"))) {
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
new TypeReference<LinkedList<ScenarioVariable>>() {
});
scenario.setVariables(variables);
}
if (scenario == null) {
return null;
}
// 针对导入的jmx 处理
if (CollectionUtils.isNotEmpty(scenario.getHashTree()) && (scenario.getHashTree().get(0) instanceof MsJmeterElement)) {
scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config);
@ -499,7 +502,7 @@ public class ApiAutomationService {
List<String> ids = request.getIds();
//检查是否有正在执行中的情景
this.checkScenarioIsRunnng(ids);
this.checkScenarioIsRunning(ids);
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(ids);
String runMode = ApiRunMode.SCENARIO.name();
@ -516,7 +519,7 @@ public class ApiAutomationService {
return request.getId();
}
public void checkScenarioIsRunnng(List<String> ids) {
public void checkScenarioIsRunning(List<String> ids) {
List<ApiScenarioReport> lastReportStatusByIds = apiReportService.selectLastReportByIds(ids);
for (ApiScenarioReport report : lastReportStatusByIds) {
if (StringUtils.equals(report.getStatus(), APITestStatus.Running.name())) {
@ -879,9 +882,13 @@ public class ApiAutomationService {
// 生成jmx
List<ApiScenrioExportJmx> resList = new ArrayList<>();
apiScenarioWithBLOBs.forEach(item -> {
String jmx = generateJmx(item);
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
resList.add(scenrioExportJmx);
if (StringUtils.isNotEmpty(item.getScenarioDefinition())) {
String jmx = generateJmx(item);
if (StringUtils.isNotEmpty(jmx)) {
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true));
resList.add(scenrioExportJmx);
}
}
});
return resList;
}

View File

@ -391,9 +391,12 @@ public class ApiDefinitionService {
if (apiTestCase.getName().length() > 255) {
apiTestCase.setName(apiTestCase.getName().substring(0, 255));
}
if (!isInsert) {
/* if (!isInsert) {
apiTestCase.setName(apiTestCase.getName() + "_" + apiTestCase.getId().substring(0, 5));
}
}*/
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andApiDefinitionIdEqualTo(apiDefinition.getId());
apiTestCaseMapper.deleteByExample(example);
apiTestCaseMapper.insert(apiTestCase);
}
} catch (Exception e) {

View File

@ -22,5 +22,9 @@ public class TestResourcePool implements Serializable {
private String image;
private String heap;
private String gcAlgo;
private static final long serialVersionUID = 1L;
}

View File

@ -643,6 +643,146 @@ public class TestResourcePoolExample {
addCriterion("image not between", value1, value2, "image");
return (Criteria) this;
}
public Criteria andHeapIsNull() {
addCriterion("`heap` is null");
return (Criteria) this;
}
public Criteria andHeapIsNotNull() {
addCriterion("`heap` is not null");
return (Criteria) this;
}
public Criteria andHeapEqualTo(String value) {
addCriterion("`heap` =", value, "heap");
return (Criteria) this;
}
public Criteria andHeapNotEqualTo(String value) {
addCriterion("`heap` <>", value, "heap");
return (Criteria) this;
}
public Criteria andHeapGreaterThan(String value) {
addCriterion("`heap` >", value, "heap");
return (Criteria) this;
}
public Criteria andHeapGreaterThanOrEqualTo(String value) {
addCriterion("`heap` >=", value, "heap");
return (Criteria) this;
}
public Criteria andHeapLessThan(String value) {
addCriterion("`heap` <", value, "heap");
return (Criteria) this;
}
public Criteria andHeapLessThanOrEqualTo(String value) {
addCriterion("`heap` <=", value, "heap");
return (Criteria) this;
}
public Criteria andHeapLike(String value) {
addCriterion("`heap` like", value, "heap");
return (Criteria) this;
}
public Criteria andHeapNotLike(String value) {
addCriterion("`heap` not like", value, "heap");
return (Criteria) this;
}
public Criteria andHeapIn(List<String> values) {
addCriterion("`heap` in", values, "heap");
return (Criteria) this;
}
public Criteria andHeapNotIn(List<String> values) {
addCriterion("`heap` not in", values, "heap");
return (Criteria) this;
}
public Criteria andHeapBetween(String value1, String value2) {
addCriterion("`heap` between", value1, value2, "heap");
return (Criteria) this;
}
public Criteria andHeapNotBetween(String value1, String value2) {
addCriterion("`heap` not between", value1, value2, "heap");
return (Criteria) this;
}
public Criteria andGcAlgoIsNull() {
addCriterion("gc_algo is null");
return (Criteria) this;
}
public Criteria andGcAlgoIsNotNull() {
addCriterion("gc_algo is not null");
return (Criteria) this;
}
public Criteria andGcAlgoEqualTo(String value) {
addCriterion("gc_algo =", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoNotEqualTo(String value) {
addCriterion("gc_algo <>", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoGreaterThan(String value) {
addCriterion("gc_algo >", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoGreaterThanOrEqualTo(String value) {
addCriterion("gc_algo >=", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoLessThan(String value) {
addCriterion("gc_algo <", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoLessThanOrEqualTo(String value) {
addCriterion("gc_algo <=", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoLike(String value) {
addCriterion("gc_algo like", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoNotLike(String value) {
addCriterion("gc_algo not like", value, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoIn(List<String> values) {
addCriterion("gc_algo in", values, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoNotIn(List<String> values) {
addCriterion("gc_algo not in", values, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoBetween(String value1, String value2) {
addCriterion("gc_algo between", value1, value2, "gcAlgo");
return (Criteria) this;
}
public Criteria andGcAlgoNotBetween(String value1, String value2) {
addCriterion("gc_algo not between", value1, value2, "gcAlgo");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -10,6 +10,8 @@
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="image" jdbcType="VARCHAR" property="image" />
<result column="heap" jdbcType="VARCHAR" property="heap" />
<result column="gc_algo" jdbcType="VARCHAR" property="gcAlgo" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -70,7 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, `type`, description, `status`, create_time, update_time, image
id, `name`, `type`, description, `status`, create_time, update_time, image, `heap`,
gc_algo
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
select
@ -105,10 +108,12 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestResourcePool">
insert into test_resource_pool (id, `name`, `type`,
description, `status`, create_time,
update_time, image)
update_time, image, `heap`,
gc_algo)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{image,jdbcType=VARCHAR})
#{updateTime,jdbcType=BIGINT}, #{image,jdbcType=VARCHAR}, #{heap,jdbcType=VARCHAR},
#{gcAlgo,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
insert into test_resource_pool
@ -137,6 +142,12 @@
<if test="image != null">
image,
</if>
<if test="heap != null">
`heap`,
</if>
<if test="gcAlgo != null">
gc_algo,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -163,6 +174,12 @@
<if test="image != null">
#{image,jdbcType=VARCHAR},
</if>
<if test="heap != null">
#{heap,jdbcType=VARCHAR},
</if>
<if test="gcAlgo != null">
#{gcAlgo,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultType="java.lang.Long">
@ -198,6 +215,12 @@
<if test="record.image != null">
image = #{record.image,jdbcType=VARCHAR},
</if>
<if test="record.heap != null">
`heap` = #{record.heap,jdbcType=VARCHAR},
</if>
<if test="record.gcAlgo != null">
gc_algo = #{record.gcAlgo,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -212,7 +235,9 @@
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
image = #{record.image,jdbcType=VARCHAR}
image = #{record.image,jdbcType=VARCHAR},
`heap` = #{record.heap,jdbcType=VARCHAR},
gc_algo = #{record.gcAlgo,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -241,6 +266,12 @@
<if test="image != null">
image = #{image,jdbcType=VARCHAR},
</if>
<if test="heap != null">
`heap` = #{heap,jdbcType=VARCHAR},
</if>
<if test="gcAlgo != null">
gc_algo = #{gcAlgo,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -252,7 +283,9 @@
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
image = #{image,jdbcType=VARCHAR}
image = #{image,jdbcType=VARCHAR},
`heap` = #{heap,jdbcType=VARCHAR},
gc_algo = #{gcAlgo,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -25,6 +25,7 @@ public class ShiroUtils {
filterChainDefinitionMap.put("/favicon.ico", "anon");
filterChainDefinitionMap.put("/display/file/**", "anon");
filterChainDefinitionMap.put("/jmeter/download/**", "anon");
filterChainDefinitionMap.put("/jmeter/ping", "anon");
filterChainDefinitionMap.put("/authsource/list/allenable", "anon");
filterChainDefinitionMap.put("/sso/signin", "anon");
filterChainDefinitionMap.put("/sso/callback", "anon");

View File

@ -17,4 +17,5 @@ public class JmeterProperties {
private String home;
private String heap = "-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m";
private String gcAlgo = "-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20";
}

View File

@ -18,6 +18,11 @@ public class JmeterFileController {
@Resource
private JmeterFileService jmeterFileService;
@GetMapping("ping")
public String checkStatus() {
return "PONG";
}
@GetMapping("download")
public ResponseEntity<byte[]> downloadJmeterFiles(@RequestParam("testId") String testId, @RequestParam("resourceId") String resourceId,
@RequestParam("ratio") double ratio, @RequestParam("startTime") long startTime,

View File

@ -24,6 +24,8 @@ import java.util.UUID;
public abstract class AbstractEngine implements Engine {
protected String JMETER_IMAGE;
protected String HEAP;
protected String GC_ALGO;
private Long startTime;
private String reportId;
protected LoadTestWithBLOBs loadTest;
@ -38,6 +40,8 @@ public abstract class AbstractEngine implements Engine {
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
JMETER_IMAGE = CommonBeanFactory.getBean(JmeterProperties.class).getImage();
HEAP = CommonBeanFactory.getBean(JmeterProperties.class).getHeap();
GC_ALGO = CommonBeanFactory.getBean(JmeterProperties.class).getGcAlgo();
this.startTime = System.currentTimeMillis();
this.reportId = UUID.randomUUID().toString();
}
@ -71,6 +75,16 @@ public abstract class AbstractEngine implements Engine {
if (StringUtils.isNotEmpty(image)) {
JMETER_IMAGE = image;
}
// heap
String heap = resourcePool.getHeap();
if (StringUtils.isNotEmpty(heap)) {
HEAP = heap;
}
// gc_algo
String gcAlgo = resourcePool.getGcAlgo();
if (StringUtils.isNotEmpty(gcAlgo)) {
GC_ALGO = gcAlgo;
}
this.resourceList = testResourceService.getResourcesByPoolId(resourcePool.getId());
if (CollectionUtils.isEmpty(this.resourceList)) {
MSException.throwException("Test Resource is empty");

View File

@ -7,7 +7,6 @@ import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.UrlTestUtils;
import io.metersphere.config.JmeterProperties;
import io.metersphere.config.KafkaProperties;
import io.metersphere.controller.ResultHolder;
import io.metersphere.dto.BaseSystemConfigDTO;
@ -73,15 +72,14 @@ public class DockerTestEngine extends AbstractEngine {
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class);
JmeterProperties jmeterProperties = CommonBeanFactory.getBean(JmeterProperties.class);
String metersphereUrl = "http://localhost:8081";
String metersphereUrl = "http://localhost:8081"; // 占位符
if (baseInfo != null) {
metersphereUrl = baseInfo.getUrl();
}
String jmeterPingUrl = metersphereUrl + "/jmeter/ping"; // 检查下载地址是否正确
// docker 不能从 localhost 中下载文件
if (StringUtils.contains(metersphereUrl, "http://localhost")
|| !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) {
|| !UrlTestUtils.testUrlWithTimeOut(jmeterPingUrl, 1000)) {
MSException.throwException(Translator.get("run_load_test_file_init_error"));
}
@ -96,7 +94,8 @@ public class DockerTestEngine extends AbstractEngine {
env.put("LOG_TOPIC", kafkaProperties.getLog().getTopic());
env.put("RESOURCE_ID", resource.getId());
env.put("THREAD_NUM", "0");// 传入0表示不用修改线程数
env.put("HEAP", jmeterProperties.getHeap());
env.put("HEAP", HEAP);
env.put("GC_ALGO", GC_ALGO);
StartTestRequest startTestRequest = new StartTestRequest();

View File

@ -1,8 +1,6 @@
package io.metersphere.performance.engine.producer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.metersphere.commons.utils.LogUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
@ -11,22 +9,16 @@ import javax.annotation.Resource;
@Service
public class LoadTestProducer {
private static final String SEPARATOR = " ";
@Value("${kafka.topic}")
@Value("${kafka.log.topic}")
private String topic;
@Resource
private KafkaTemplate<String, Object> kafkaTemplate;
@Resource
private ObjectMapper objectMapper;
public void sendMessage(String reportId) {
Metric metric = new Metric();
metric.setReportId(reportId);
metric.setThreadName("tearDown Thread Group"); // 发送停止消息
try {
this.kafkaTemplate.send(topic, objectMapper.writeValueAsString(metric));
} catch (JsonProcessingException e) {
LogUtil.error("发送停止消息失败", e);
}
String[] contents = new String[]{reportId, "none", "0", "Notifying test listeners of end of test"};
String log = StringUtils.join(contents, SEPARATOR);
this.kafkaTemplate.send(topic, log);
}
}

View File

@ -1,77 +0,0 @@
package io.metersphere.performance.engine.producer;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class Metric {
@JsonProperty("test.id")
private String testId;
@JsonProperty("test.name")
private String testName;
@JsonProperty("test.startTime")
private Long clusterStartTime;
@JsonProperty("test.reportId")
private String reportId;
@JsonProperty("ContentType")
private String contentType;
@JsonProperty("IdleTime")
private Integer idleTime;
@JsonProperty("ElapsedTime")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ")
private Date elapsedTime;
@JsonProperty("ErrorCount")
private Integer errorCount;
@JsonProperty("Timestamp")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ")
private Date timestamp;
@JsonProperty("URL")
private String url;
@JsonProperty("SampleStartTime")
private String sampleStartTime;
@JsonProperty("Success")
private Boolean success;
@JsonProperty("Bytes")
private Integer bytes;
@JsonProperty("SentBytes")
private Integer sentBytes;
@JsonProperty("AllThreads")
private Integer allThreads;
@JsonProperty("TestElement.name")
private String testElementName;
@JsonProperty("DataType")
private String dataType;
@JsonProperty("ResponseTime")
private Integer responseTime;
@JsonProperty("SampleCount")
private Integer sampleCount;
@JsonProperty("FailureMessage")
private String failureMessage;
@JsonProperty("ConnectTime")
private Integer connectTime;
@JsonProperty("ResponseCode")
private String responseCode;
@JsonProperty("TestStartTime")
private Long testStartTime;
@JsonProperty("AssertionResults")
private List<Object> assertionResults;
@JsonProperty("Latency")
private Integer latency;
@JsonProperty("InjectorHostname")
private String injectorHostname;
@JsonProperty("GrpThreads")
private Integer grpThreads;
@JsonProperty("SampleEndTime")
private String sampleEndTime;
@JsonProperty("BodySize")
private Long bodySize;
@JsonProperty("ThreadName")
private String threadName;
@JsonProperty("SampleLabel")
private String sampleLabel;
}

View File

@ -89,8 +89,6 @@ public class JmeterDocumentParser implements DocumentParser {
if (nodeNameEquals(ele, HASH_TREE_ELEMENT)) {
parseHashTree(ele);
} else if (nodeNameEquals(ele, TEST_PLAN)) {
processSetupTestPlan(ele);
processTearDownTestPlan(ele);
processCheckoutConfigTestElement(ele);
processCheckoutDnsCacheManager(ele);
processCheckoutArguments(ele);
@ -484,187 +482,18 @@ public class JmeterDocumentParser implements DocumentParser {
}
}
private void processSetupTestPlan(Element ele) {
Document document = ele.getOwnerDocument();
Node hashTree = ele.getNextSibling();
while (!(hashTree instanceof Element)) {
hashTree = hashTree.getNextSibling();
}
KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class);
String bootstrapServers = kafkaProperties.getBootstrapServers();
String[] servers = StringUtils.split(bootstrapServers, ",");
for (String s : servers) {
String[] ipAndPort = StringUtils.split(s, ":");
Element setupElement = document.createElement("SetupThreadGroup");
setupElement.setAttribute("guiclass", "SetupThreadGroupGui");
setupElement.setAttribute("testclass", "SetupThreadGroup");
setupElement.setAttribute("testname", "setUp Thread Group");
setupElement.setAttribute("enabled", "true");
setupElement.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "stoptestnow"));
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "LoopController");
elementProp.setAttribute("guiclass", "LoopControlPanel");
elementProp.setAttribute("testclass", "LoopController");
elementProp.setAttribute("testname", "Loop Controller");
elementProp.setAttribute("enabled", "true");
elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
elementProp.appendChild(createIntProp(document, "LoopController.loops", 1));
setupElement.appendChild(elementProp);
setupElement.appendChild(createStringProp(document, "ThreadGroup.num_threads", "1"));
setupElement.appendChild(createStringProp(document, "ThreadGroup.ramp_time", "1"));
setupElement.appendChild(createStringProp(document, "ThreadGroup.duration", ""));
setupElement.appendChild(createStringProp(document, "ThreadGroup.delay", ""));
setupElement.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false));
setupElement.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
hashTree.appendChild(setupElement);
Element setupHashTree = document.createElement(HASH_TREE_ELEMENT);
Element tcpSampler = document.createElement("TCPSampler");
tcpSampler.setAttribute("guiclass", "TCPSamplerGui");
tcpSampler.setAttribute("testclass", "TCPSampler");
tcpSampler.setAttribute("testname", "TCP Sampler");
tcpSampler.setAttribute("enabled", "true");
tcpSampler.appendChild(createStringProp(document, "TCPSampler.classname", "TCPClientImpl"));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.server", ipAndPort[0]));
tcpSampler.appendChild(createBoolProp(document, "TCPSampler.reUseConnection", true));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.port", ipAndPort[1]));
tcpSampler.appendChild(createBoolProp(document, "TCPSampler.nodelay", false));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.timeout", "100"));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.ctimeout", "100"));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.request", "1010"));
tcpSampler.appendChild(createBoolProp(document, "TCPSampler.closeConnection", false));
tcpSampler.appendChild(createStringProp(document, "TCPSampler.EolByte", "0"));
tcpSampler.appendChild(createStringProp(document, "ConfigTestElement.username", ""));
tcpSampler.appendChild(createStringProp(document, "ConfigTestElement.password", ""));
Element tcpSamplerHashTree = document.createElement(HASH_TREE_ELEMENT);
Element responseAssertion = document.createElement("ResponseAssertion");
responseAssertion.setAttribute("guiclass", "AssertionGui");
responseAssertion.setAttribute("testclass", "ResponseAssertion");
responseAssertion.setAttribute("testname", "Response Assertion");
responseAssertion.setAttribute("enabled", "true");
Element collectionProp = document.createElement("collectionProp");
collectionProp.setAttribute("name", "Asserion.test_strings");
collectionProp.appendChild(createStringProp(document, "49586", "200"));
responseAssertion.appendChild(collectionProp);
responseAssertion.appendChild(createStringProp(document, "Assertion.custom_message", ""));
responseAssertion.appendChild(createStringProp(document, "Assertion.test_field", "Assertion.response_code"));
responseAssertion.appendChild(createBoolProp(document, "Assertion.assume_success", false));
responseAssertion.appendChild(createIntProp(document, "Assertion.test_type", 8));
tcpSamplerHashTree.appendChild(responseAssertion);
// 添加空的hashtree
tcpSamplerHashTree.appendChild(document.createElement(HASH_TREE_ELEMENT));
setupHashTree.appendChild(tcpSampler);
setupHashTree.appendChild(tcpSamplerHashTree);
hashTree.appendChild(setupHashTree);
}
}
private void processTearDownTestPlan(Element ele) {
/*<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>*/
Document document = ele.getOwnerDocument();
Element tearDownSwitch = createBoolProp(document, "TestPlan.tearDown_on_shutdown", true);
ele.appendChild(tearDownSwitch);
Node hashTree = ele.getNextSibling();
while (!(hashTree instanceof Element)) {
hashTree = hashTree.getNextSibling();
}
/*
<PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</PostThreadGroup>
*/
Element tearDownElement = document.createElement("PostThreadGroup");
tearDownElement.setAttribute("guiclass", "PostThreadGroupGui");
tearDownElement.setAttribute("testclass", "PostThreadGroup");
tearDownElement.setAttribute("testname", "tearDown Thread Group");
tearDownElement.setAttribute("enabled", "true");
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.num_threads", "1"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.ramp_time", "1"));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.duration", ""));
tearDownElement.appendChild(createStringProp(document, "ThreadGroup.delay", ""));
tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false));
tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
Element elementProp = document.createElement("elementProp");
elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "LoopController");
elementProp.setAttribute("guiclass", "LoopControlPanel");
elementProp.setAttribute("testclass", "LoopController");
elementProp.setAttribute("testname", "Loop Controller");
elementProp.setAttribute("enabled", "true");
elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
elementProp.appendChild(createStringProp(document, "LoopController.loops", "1"));
tearDownElement.appendChild(elementProp);
hashTree.appendChild(tearDownElement);
Element tearDownHashTree = document.createElement(HASH_TREE_ELEMENT);
/*
<OnceOnlyController guiclass="OnceOnlyControllerGui" testclass="OnceOnlyController" testname="Once Only Controller" enabled="true"/>
*/
Element onceOnlyController = document.createElement("OnceOnlyController");
onceOnlyController.setAttribute("guiclass", "OnceOnlyControllerGui");
onceOnlyController.setAttribute("testclass", "OnceOnlyController");
onceOnlyController.setAttribute("testname", "Once Only Controller");
onceOnlyController.setAttribute("enabled", "true");
tearDownHashTree.appendChild(onceOnlyController);
/*
<hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Debug Sampler" enabled="true">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>
<hashTree/>
</hashTree>
*/
Element onceOnlyHashTree = document.createElement(HASH_TREE_ELEMENT);
Element debugSampler = document.createElement("DebugSampler");
debugSampler.setAttribute("guiclass", "TestBeanGUI");
debugSampler.setAttribute("testclass", "DebugSampler");
debugSampler.setAttribute("testname", "Debug Sampler");
debugSampler.setAttribute("enabled", "true");
debugSampler.appendChild(createBoolProp(document, "displayJMeterProperties", false));
debugSampler.appendChild(createBoolProp(document, "displayJMeterVariables", true));
debugSampler.appendChild(createBoolProp(document, "displaySystemProperties", false));
onceOnlyHashTree.appendChild(debugSampler);
// 添加空的 hashTree
onceOnlyHashTree.appendChild(document.createElement(HASH_TREE_ELEMENT));
tearDownHashTree.appendChild(onceOnlyHashTree);
hashTree.appendChild(tearDownHashTree);
// 添加backend listener
processCheckoutBackendListener(tearDownElement);
}
private Element createBoolProp(Document document, String name, boolean value) {
Element tearDownSwitch = document.createElement("boolProp");
tearDownSwitch.setAttribute("name", name);
tearDownSwitch.appendChild(document.createTextNode(String.valueOf(value)));
return tearDownSwitch;
Element boolProp = document.createElement("boolProp");
boolProp.setAttribute("name", name);
boolProp.appendChild(document.createTextNode(String.valueOf(value)));
return boolProp;
}
private Element createIntProp(Document document, String name, int value) {
Element tearDownSwitch = document.createElement("intProp");
tearDownSwitch.setAttribute("name", name);
tearDownSwitch.appendChild(document.createTextNode(String.valueOf(value)));
return tearDownSwitch;
Element intProp = document.createElement("intProp");
intProp.setAttribute("name", name);
intProp.appendChild(document.createTextNode(String.valueOf(value)));
return intProp;
}
private void processBackendListener(Element backendListener) {

View File

@ -169,7 +169,7 @@ public class TestPlanService {
testPlan.setActualEndTime(null);
} // 已完成->进行中结束时间置空
} else if (!res.getStatus().equals(TestPlanStatus.Prepare.name()) &&
testPlan.getStatus().equals(TestPlanStatus.Prepare.name())) {
TestPlanStatus.Prepare.name().equals(testPlan.getStatus())) {
testPlan.setActualStartTime(null);
testPlan.setActualEndTime(null);
} // 非未开始->未开始时间都置空
@ -183,7 +183,7 @@ public class TestPlanService {
List<String> userIds = new ArrayList<>();
userIds.add(testPlan.getPrincipal());
AddTestPlanRequest testPlans = new AddTestPlanRequest();
int i = testPlanMapper.updateByPrimaryKey(testPlan); // 更新
int i = testPlanMapper.updateByPrimaryKeySelective(testPlan); // 更新
if (!StringUtils.isBlank(testPlan.getStatus())) {
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
String context = getTestPlanContext(testPlans, NoticeConstants.Event.UPDATE);

@ -1 +1 @@
Subproject commit b9042074b780205e275c674f64417799110519fd
Subproject commit e6af25ffb8cabdfc2de5ae07cb04492cc78345f3

View File

@ -0,0 +1,4 @@
ALTER TABLE test_resource_pool
ADD heap VARCHAR(200) NULL;
ALTER TABLE test_resource_pool
ADD gc_algo VARCHAR(200) NULL;

View File

@ -20,6 +20,7 @@
"diffable-html": "^4.0.0",
"echarts": "^4.6.0",
"el-table-infinite-scroll": "^1.0.10",
"el-tree-transfer": "^2.4.7",
"element-ui": "^2.13.0",
"generate-schema": "^2.6.0",
"html2canvas": "^1.0.0-rc.7",

View File

@ -12,8 +12,7 @@
@select-all="handleSelectAll"
@select="handleSelect"
@header-dragend="headerDragend"
:height="screenHeight"
v-loading="loading">
:height="screenHeight">
<el-table-column type="selection" width="50"/>
@ -29,7 +28,7 @@
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID"
<el-table-column v-if="item.id == 'num'" prop="num" label="ID"
sortable="custom"
min-width="120px"
show-overflow-tooltip :key="index">
@ -39,14 +38,14 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'name'" prop="name"
<el-table-column v-if="item.id == 'name'" prop="name"
sortable="custom"
:label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip
min-width="120px"
:key="index"
/>
<el-table-column v-if="item.prop == 'level'" prop="level"
<el-table-column v-if="item.id == 'level'" prop="level"
sortable="custom"
column-key="level"
:filters="levelFilters"
@ -57,7 +56,7 @@
<priority-table-item :value="scope.row.level"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'status'" prop="status" :label="$t('test_track.plan.plan_status')"
<el-table-column v-if="item.id == 'status'" prop="status" :label="$t('test_track.plan.plan_status')"
sortable="custom"
column-key="status"
:filters="statusFilters"
@ -66,32 +65,30 @@
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'tags'" prop="tags" min-width="120px"
<el-table-column v-if="item.id == 'tags'" prop="tags" min-width="120px"
:label="$t('api_test.automation.tag')" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'userId'" prop="userId" min-width="120px"
<el-table-column v-if="item.id == 'userId'" prop="userId" min-width="120px"
:label="$t('api_test.automation.creator')"
:filters="userFilters"
column-key="user_id"
sortable="custom"
show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
<el-table-column v-if="item.id == 'updateTime'" prop="updateTime"
:label="$t('api_test.automation.update_time')" sortable="custom" min-width="180px"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
<el-table-column v-if="item.id == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
min-width="80px"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
<el-table-column v-if="item.id == 'lastResult'" prop="lastResult"
:label="$t('api_test.automation.last_result')"
:filters="resultFilters"
@ -105,16 +102,14 @@
</el-link>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
<el-table-column v-if="item.id == 'passRate'" prop="passRate"
:label="$t('api_test.automation.passing_rate')"
min-width="120px"
show-overflow-tooltip :key="index"/>
</template>
<el-table-column fixed="right" :label="$t('commons.operating')" width="190px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="{row}">
<div v-if="trashEnable">
@ -186,7 +181,7 @@
import {PROJECT_NAME} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
import {_sort} from "@/common/js/tableUtils";
import {_sort, getLabel} from "@/common/js/tableUtils";
import {Api_Scenario_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {
@ -196,10 +191,12 @@
getSelectDataCounts,
setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "MsApiScenarioList",
components: {
HeaderLabelOperate,
HeaderCustom,
BatchMove,
EnvironmentSelect,
@ -365,7 +362,7 @@
},
search() {
this.selectRows = new Set();
this.getLabel()
getLabel(this, API_SCENARIO_LIST);
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
@ -415,24 +412,6 @@
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_SCENARIO_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
handleCommand(cmd) {
let table = this.$refs.scenarioTable;
switch (cmd) {

View File

@ -31,10 +31,10 @@
</el-tooltip>
<slot name="button"></slot>
<el-tooltip content="Copy" placement="top">
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow"/>
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" :disabled="data.referenced==='REF' || data.disabled"/>
</el-tooltip>
<el-tooltip :content="$t('commons.remove')" placement="top">
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove"/>
<el-button size="mini" icon="el-icon-delete" type="danger" circle @click="remove" :disabled="data.referenced==='REF' || data.disabled"/>
</el-tooltip>
</div>

View File

@ -31,7 +31,7 @@
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-api-request-form :isShowEnable="true" :referenced="true" :headers="request.headers " :request="request"
v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"/>
<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'|| request.type==='TCPSampler'"/>
<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'|| request.type==='TCPSampler'" :showScript="false"/>
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
:showScript="false"/>
<ms-dubbo-basis-parameters :request="request"

View File

@ -27,6 +27,7 @@
<!-- 列表集合 -->
<ms-api-list
v-if="item.type === 'list' && activeDom==='api' "
@runTest="runTest"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"

View File

@ -35,13 +35,13 @@
</span>
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
<span>
{{ apiCase.createTime | timestampFormatDate }}
{{ apiCase.createUser }} {{ $t('api_test.definition.request.create_info') }}
</span>
<span>
{{ apiCase.updateTime | timestampFormatDate }}
{{ apiCase.updateUser }} {{ $t('api_test.definition.request.update_info') }}
{{ apiCase.createTime | timestampFormatDate }}
{{ apiCase.createUser }} {{ $t('api_test.definition.request.create_info') }}
</span>
<span style="margin-left: 10px">
{{ apiCase.updateTime | timestampFormatDate }}
{{ apiCase.updateUser }} {{ $t('api_test.definition.request.update_info') }}
</span>
</div>
</el-col>

View File

@ -34,7 +34,7 @@
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID" min-width="120px" show-overflow-tooltip
<el-table-column v-if="item.id == 'num'" prop="num" label="ID" min-width="120px" show-overflow-tooltip
:key="index">
<template slot-scope="scope">
<el-tooltip content="编辑">
@ -43,11 +43,11 @@
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'name'" prop="name" min-width="160px" :label="$t('test_track.case.name')"
<el-table-column v-if="item.id == 'name'" prop="name" min-width="160px" :label="$t('test_track.case.name')"
show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.prop == 'priority'"
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
@ -61,7 +61,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'custom'"
v-if="item.id == 'custom'"
sortable="custom"
prop="path"
min-width="180px"
@ -69,24 +69,22 @@
show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
<el-table-column v-if="item.id=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='createUser'"
v-if="item.id=='createUser'"
prop="createUser"
:label="'创建人'"
show-overflow-tooltip
:key="index"/>
<el-table-column
v-if="item.prop=='custom'"
v-if="item.id=='custom'"
sortable="custom"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
@ -100,9 +98,7 @@
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleTestCase(scope.row)"
@ -162,14 +158,16 @@ import {parseEnvironment} from "@/business/components/api/test/model/Environment
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {_filter, _handleSelect, _handleSelectAll, _sort,} from "@/common/js/tableUtils";
import {_filter, _handleSelect, _handleSelectAll, _sort, getLabel,} from "@/common/js/tableUtils";
import {API_CASE_LIST, API_LIST, API_SCENARIO_LIST, TEST_CASE_LIST} from "@/common/js/constants";
import {Api_Case_List, Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "ApiCaseSimpleList",
components: {
HeaderLabelOperate,
ApiListContainerWithDoc,
HeaderCustom,
MsTableHeaderSelectPopover,
@ -307,7 +305,7 @@ export default {
this.$emit("activeDomChange", tabType);
},
initTable() {
this.getLabel()
getLabel(this, API_CASE_LIST);
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -351,24 +349,6 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_CASE_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
open() {
this.$refs.searchBar.open();
},

View File

@ -36,7 +36,7 @@
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
v-if="item.id == 'num'"
prop="num"
label="ID"
show-overflow-tooltip
@ -50,7 +50,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
v-if="item.id == 'name'"
prop="name"
:label="$t('api_test.definition.api_name')"
show-overflow-tooltip
@ -58,7 +58,7 @@
min-width="120px"
:key="index"/>
<el-table-column
v-if="item.prop == 'status'"
v-if="item.id == 'status'"
prop="status"
column-key="status"
sortable="custom"
@ -74,7 +74,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'method'"
v-if="item.id == 'method'"
prop="method"
sortable="custom"
column-key="method"
@ -92,7 +92,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
v-if="item.id == 'userName'"
prop="userName"
sortable="custom"
:filters="userFilters"
@ -103,7 +103,7 @@
:key="index"/>
<el-table-column
v-if="item.prop == 'path'"
v-if="item.id == 'path'"
prop="path"
min-width="120px"
:label="$t('api_test.definition.api_path')"
@ -111,21 +111,18 @@
:key="index"/>
<el-table-column
v-if="item.prop == 'tags'"
v-if="item.id == 'tags'"
prop="tags"
:label="$t('commons.tag')"
min-width="80px"
:key="index"
>
min-width="120px"
:key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'updateTime'"
v-if="item.id == 'updateTime'"
width="160"
:label="$t('api_test.definition.api_last_time')"
sortable="custom"
@ -138,7 +135,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'caseTotal'"
v-if="item.id == 'caseTotal'"
prop="caseTotal"
min-width="80px"
:label="$t('api_test.definition.api_case_number')"
@ -146,7 +143,7 @@
:key="index"/>
<el-table-column
v-if="item.prop == 'caseStatus'"
v-if="item.id == 'caseStatus'"
prop="caseStatus"
min-width="80px"
:label="$t('api_test.definition.api_case_status')"
@ -154,7 +151,7 @@
:key="index"/>
<el-table-column
v-if="item.prop == 'casePassingRate'"
v-if="item.id == 'casePassingRate'"
prop="casePassingRate"
:width="100"
min-width="100px"
@ -163,14 +160,18 @@
:key="index"/>
</template>
<el-table-column fixed="right" v-if="!isReadOnly" :label="$t('commons.operating')" min-width="130"
<el-table-column fixed="right" v-if="!isReadOnly" min-width="180"
align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true"
:tip="$t('api_test.automation.execute')"
icon="el-icon-video-play"
@exec="runApi(scope.row)"/>
<ms-table-operator-button :tip="$t('commons.reduction')" icon="el-icon-refresh-left"
@exec="reductionApi(scope.row)" v-if="trashEnable" v-tester/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="editApi(scope.row)" v-else
@ -235,18 +236,20 @@ import CaseBatchMove from "@/business/components/api/definition/components/basis
import ApiListContainerWithDoc from "@/business/components/api/definition/components/list/ApiListContainerWithDoc";
import {
_handleSelect,
_handleSelectAll,
_handleSelectAll, getLabel,
getSelectDataCounts, initCondition,
setUnSelectIds, toggleAllSelection
} from "@/common/js/tableUtils";
import {_filter, _sort} from "@/common/js/tableUtils";
import {Api_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "ApiList",
components: {
HeaderLabelOperate,
HeaderCustom,
CaseBatchMove,
ApiStatus,
@ -403,7 +406,7 @@ export default {
this.$emit("activeDomChange",tabType);
},
initTable() {
this.getLabel()
getLabel(this, API_LIST);
this.selectRows = new Set();
initCondition(this.condition);
this.selectDataCounts = 0;
@ -450,25 +453,6 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = API_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
this.methodFilters = [
@ -547,6 +531,11 @@ export default {
editApi(row) {
this.$emit('editApi', row);
},
runApi(row) {
let request = JSON.parse(row.request);
row.request = request
this.$emit('runTest', row);
},
reductionApi(row) {
let tmp = JSON.parse(JSON.stringify(row));
tmp.request = null;
@ -747,36 +736,36 @@ export default {
</script>
<style scoped>
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.api-el-tag {
color: white;
}
.api-el-tag {
color: white;
}
.search-input {
float: right;
width: 300px;
margin-right: 10px;
}
.search-input {
float: right;
width: 300px;
margin-right: 10px;
}
.el-tag {
margin-left: 10px;
}
.el-tag {
margin-left: 10px;
}
.ms-select-all >>> th:first-child {
margin-top: 20px;
}
.ms-select-all >>> th:first-child {
margin-top: 20px;
}
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
top: -2px;
}
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
top: -2px;
}
</style>

View File

@ -1,40 +1,31 @@
<template>
<el-dialog title="表头显示字段" :visible.sync="dialogTableVisible" :append-to-body="true">
<template>
<el-transfer
:titles="['待选字段', '已选字段']"
v-model="value"
:props="{
key: 'prop',
label: 'label'
}"
:data="optionalField"
style="margin-left: 10%"
></el-transfer>
</template>
<template v-slot:footer>
<ms-dialog-footer
@cancel="close"
@confirm="saveHeader"
/>
</template>
<tree-transfer :title="['待选字段', '已选字段']"
:from_data='optionalFields'
:draggable="true"
:to_data='fieldSelected'
:defaultProps="{label:'label'}"
:mode='mode' height='540px' filter openAll/>
<template v-slot:footer>
<ms-dialog-footer @cancel="close" @confirm="saveHeader"/>
</template>
</el-dialog>
</template>
<script>
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getCurrentUser} from "@/common/js/utils";
import {TEST_CASE_LIST} from "@/common/js/constants";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import treeTransfer from 'el-tree-transfer'
export default {
name: "HeaderCustom",
components: {MsDialogFooter},
components: {MsDialogFooter, treeTransfer},
data() {
return {
dialogTableVisible: false,
optionalField: this.optionalFields,
value: [],
fieldSelected: []
fieldSelected: [],
mode: "transfer", // transfer addressList
}
},
props: {
@ -55,17 +46,49 @@ export default {
let param = {
userId: getCurrentUser().id,
type: this.type,
props: JSON.stringify(this.value)
props: JSON.stringify(this.fieldSelected)
}
this.$post("/system/save/header", param, response => {
console.log(this.optionalFields)
console.log(this.fieldSelected)
this.$success(this.$t("commons.save_success"));
this.dialogTableVisible = false
this.initTableData()
})
},
removeAt(idx) {
this.list.splice(idx, 1);
},
close() {
this.dialogTableVisible = false
}
},
// 穿transfer addressList
// changeMode() {
// if (this.mode == "transfer") {
// this.mode = "addressList";
// } else {
// this.mode = "transfer";
// }
// },
// // 穿
// add(fromData, toData, obj){
// // 穿transfer{keys,nodes,halfKeys,halfNodes}
// // addressList
// console.log("fromData:", fromData);
// console.log("toData:", toData);
// console.log("obj:", obj);
// },
// // 穿
// remove(fromData, toData, obj){
// // 穿transfer{keys,nodes,halfKeys,halfNodes}
// // addressList
// console.log("fromData:", fromData);
// console.log("toData:", toData);
// console.log("obj:", obj);
// }
}
}
</script>

View File

@ -0,0 +1,25 @@
<template>
<div>
<template>
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
</template>
</div>
</template>
<script>
export default {
name: "HeaderLabelOperate",
methods: {
customHeader() {
this.$emit('exec')
}
}
}
</script>
<style scoped>
</style>

View File

@ -2,132 +2,132 @@ import i18n from '../../../../i18n/i18n'
//自定义默认表头
//测试用例
export const Track_Test_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'type', label: i18n.t('test_track.case.type')},
{id: 'method', label: i18n.t('test_track.case.method')},
{id: 'reviewStatus', label: i18n.t('test_track.case.status')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'nodePath', label: i18n.t('test_track.case.module')},
{id: 'updateTime', label: i18n.t('commons.update_time')},
]
//用例评审-测试用例
export const Test_Case_Review = [
{prop: 'name', label: i18n.t('test_track.review.review_name')},
{prop: 'reviewer', label: i18n.t('test_track.review.reviewer')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'creatorName', label: i18n.t('test_track.review.review_creator')},
{prop: 'status', label: i18n.t('test_track.review.review_status')},
{prop: 'createTime', label: i18n.t('commons.create_time')},
{prop: 'endTime', label: i18n.t('test_track.review.end_time')},
{id: 'name', label: i18n.t('test_track.review.review_name')},
{id: 'reviewer', label: i18n.t('test_track.review.reviewer')},
{id: 'projectName', label: i18n.t('test_track.review.review_project')},
{id: 'creatorName', label: i18n.t('test_track.review.review_creator')},
{id: 'status', label: i18n.t('test_track.review.review_status')},
{id: 'createTime', label: i18n.t('commons.create_time')},
{id: 'endTime', label: i18n.t('test_track.review.end_time')},
]
//测试计划-测试用例
export const Test_Plan_List = [
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'userName', label: i18n.t('test_track.plan.plan_principal')},
{prop: 'status', label: i18n.t('test_track.plan.plan_status')},
{prop: 'stage', label: i18n.t('test_track.plan.plan_stage')},
{prop: 'testRate', label: i18n.t('test_track.home.test_rate')},
{prop: 'projectName', label: i18n.t('test_track.plan.plan_project')},
{prop: 'plannedStartTime', label: i18n.t('test_track.plan.planned_start_time')},
{prop: 'plannedEndTime', label: i18n.t('test_track.plan.planned_end_time')},
{prop: 'actualStartTime', label: i18n.t('test_track.plan.actual_start_time')},
{prop: 'actualEndTime', label: i18n.t('test_track.plan.actual_end_time')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'userName', label: i18n.t('test_track.plan.plan_principal')},
{id: 'status', label: i18n.t('test_track.plan.plan_status')},
{id: 'stage', label: i18n.t('test_track.plan.plan_stage')},
{id: 'testRate', label: i18n.t('test_track.home.test_rate')},
{id: 'projectName', label: i18n.t('test_track.plan.plan_project')},
{id: 'plannedStartTime', label: i18n.t('test_track.plan.planned_start_time')},
{id: 'plannedEndTime', label: i18n.t('test_track.plan.planned_end_time')},
{id: 'actualStartTime', label: i18n.t('test_track.plan.actual_start_time')},
{id: 'actualEndTime', label: i18n.t('test_track.plan.actual_end_time')},
]
//接口定义-api列表
export const Api_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('api_test.definition.api_name')},
{prop: 'method', label: i18n.t('api_test.definition.api_type')},
{prop: 'userName', label: i18n.t('api_test.definition.api_principal')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
{prop: 'caseTotal', label: i18n.t('api_test.definition.api_case_number')},
{prop: 'caseStatus', label: i18n.t('api_test.definition.api_case_status')},
{prop: 'casePassingRate', label: i18n.t('api_test.definition.api_case_passing_rate')},
{id: 'num', label: "ID"},
{id: 'name', label: i18n.t('api_test.definition.api_name')},
{id: 'method', label: i18n.t('api_test.definition.api_type')},
{id: 'userName', label: i18n.t('api_test.definition.api_principal')},
{id: 'path', label: i18n.t('api_test.definition.api_path')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
{id: 'caseTotal', label: i18n.t('api_test.definition.api_case_number')},
{id: 'caseStatus', label: i18n.t('api_test.definition.api_case_status')},
{id: 'casePassingRate', label: i18n.t('api_test.definition.api_case_passing_rate')},
]
//接口定义-case列表
export const Api_Case_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('test_track.case.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'createUser', label: "创建人"},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
{id: 'num', label: "ID"},
{id: 'name', label: i18n.t('test_track.case.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'path', label: i18n.t('api_test.definition.api_path')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'createUser', label: "创建人"},
{id: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
]
//接口自动化-场景列表
export const Api_Scenario_List = [
{prop: 'num', label: "ID"},
{prop: 'name', label: i18n.t('test_track.case.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'createUser', label: '创建人'},
{prop: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
{id: 'num', label: "ID"},
{id: 'name', label: i18n.t('test_track.case.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'path', label: i18n.t('api_test.definition.api_path')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'createUser', label: '创建人'},
{id: 'updateTime', label: i18n.t('api_test.definition.api_last_time')},
]
//测试评审-测试用例
export const Test_Case_Review_Case_List = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'reviewerName', label: i18n.t('test_track.review.reviewer')},
{prop: 'reviewStatus', label: i18n.t('test_track.case.status')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'type', label: i18n.t('test_track.case.type')},
{id: 'method', label: i18n.t('test_track.case.method')},
{id: 'nodePath', label: i18n.t('test_track.case.module')},
{id: 'projectName', label: i18n.t('test_track.review.review_project')},
{id: 'reviewerName', label: i18n.t('test_track.review.reviewer')},
{id: 'reviewStatus', label: i18n.t('test_track.case.status')},
{id: 'updateTime', label: i18n.t('commons.update_time')},
]
//测试计划-功能用例
export const Test_Plan_Function_Test_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'type', label: i18n.t('test_track.case.type')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'method', label: i18n.t('test_track.case.method')},
{prop: 'nodePath', label: i18n.t('test_track.case.module')},
{prop: 'projectName', label: i18n.t('test_track.review.review_project')},
{prop: 'issuesContent', label: i18n.t('test_track.issue.issue')},
{prop: 'executorName', label: i18n.t('test_track.plan_view.executor')},
{prop: 'status', label: i18n.t('test_track.plan_view.execute_result')},
{prop: 'updateTime', label: i18n.t('commons.update_time')},
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'type', label: i18n.t('test_track.case.type')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'method', label: i18n.t('test_track.case.method')},
{id: 'nodePath', label: i18n.t('test_track.case.module')},
{id: 'projectName', label: i18n.t('test_track.review.review_project')},
{id: 'issuesContent', label: i18n.t('test_track.issue.issue')},
{id: 'executorName', label: i18n.t('test_track.plan_view.executor')},
{id: 'status', label: i18n.t('test_track.plan_view.execute_result')},
{id: 'updateTime', label: i18n.t('commons.update_time')},
]
//测试计划-api用例
export const Test_Plan_Api_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'priority', label: i18n.t('test_track.case.priority')},
{prop: 'path', label: i18n.t('api_test.definition.api_path')},
{prop: 'createUser', label: '创建人'},
{prop: 'custom', label: i18n.t('api_test.definition.api_last_time')},
{prop: 'tags', label: i18n.t('commons.tag')},
{prop: 'execResult', label: '执行状态'},
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'path', label: i18n.t('api_test.definition.api_path')},
{id: 'createUser', label: '创建人'},
{id: 'custom', label: i18n.t('api_test.definition.api_last_time')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'execResult', label: '执行状态'},
]
//测试计划-性能用例
export const Test_Plan_Load_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'caseName', label: i18n.t('commons.name')},
{prop: 'projectName', label: i18n.t('load_test.project_name')},
{prop: 'userName', label: i18n.t('load_test.user_name')},
{prop: 'createTime', label: i18n.t('commons.create_time')},
{prop: 'status', label: i18n.t('commons.status')},
{prop: 'caseStatus', label: i18n.t('test_track.plan.load_case.execution_status')},
{prop: 'loadReportId', label: i18n.t('test_track.plan.load_case.view_report')},
{id: 'num', label: i18n.t('commons.id')},
{id: 'caseName', label: i18n.t('commons.name')},
{id: 'projectName', label: i18n.t('load_test.project_name')},
{id: 'userName', label: i18n.t('load_test.user_name')},
{id: 'createTime', label: i18n.t('commons.create_time')},
{id: 'status', label: i18n.t('commons.status')},
{id: 'caseStatus', label: i18n.t('test_track.plan.load_case.execution_status')},
{id: 'loadReportId', label: i18n.t('test_track.plan.load_case.view_report')},
]
//测试计划-场景用例
export const Test_Plan_Scenario_Case = [
{prop: 'num', label: i18n.t('commons.id')},
{prop: 'name', label: i18n.t('commons.name')},
{prop: 'level', label: i18n.t('api_test.automation.case_level')},
{prop: 'tagNames', label: i18n.t('api_test.automation.tag')},
{prop: 'userId', label: i18n.t('api_test.automation.creator')},
{prop: 'updateTime', label: i18n.t('api_test.automation.update_time')},
{prop: 'stepTotal', label: i18n.t('api_test.automation.success')},
{prop: 'lastResult', label: i18n.t('api_test.automation.fail')},
{prop: 'passRate', label: i18n.t('api_test.automation.passing_rate')},
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'level', label: i18n.t('api_test.automation.case_level')},
{id: 'tagNames', label: i18n.t('api_test.automation.tag')},
{id: 'userId', label: i18n.t('api_test.automation.creator')},
{id: 'updateTime', label: i18n.t('api_test.automation.update_time')},
{id: 'stepTotal', label: i18n.t('api_test.automation.success')},
{id: 'lastResult', label: i18n.t('api_test.automation.fail')},
{id: 'passRate', label: i18n.t('api_test.automation.passing_rate')},
]

View File

@ -40,7 +40,7 @@
<el-col>
<el-form-item :label="$t('system_parameter_setting.test_recipients')">
<el-input v-model="formInline.recipient" :placeholder="$t('system_parameter_setting.test_recipients')"
autocomplete="new-password" show-password type="text" ref="input">
autocomplete="new-password" type="text" ref="input">
</el-input>
<p style="color: #8a8b8d">({{ $t('system_parameter_setting.tip') }})</p>
</el-form-item>

View File

@ -53,7 +53,7 @@
:destroy-on-close="true"
v-loading="result.loading"
>
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
<el-form :model="form" label-position="right" label-width="140px" size="small" :rules="rule"
ref="testResourcePoolForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
@ -62,7 +62,13 @@
<el-input v-model="form.description" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.image')" prop="image">
<el-input v-model="form.image" autocomplete="off"/>
<el-input v-model="form.image"/>
</el-form-item>
<el-form-item label="Jmeter HEAP" prop="HEAP">
<el-input v-model="form.heap" placeholder="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"/>
</el-form-item>
<el-form-item label="Jmeter GC_ALGO" prop="GC_ALGO">
<el-input v-model="form.gcAlgo" placeholder="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20"/>
</el-form-item>
<el-form-item :label="$t('test_resource_pool.type')" prop="type">
<el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"

View File

@ -52,7 +52,7 @@
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
v-if="item.id == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
@ -60,7 +60,7 @@
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
v-if="item.id == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
@ -81,7 +81,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'priority'"
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
@ -94,7 +94,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'type'"
v-if="item.id == 'type'"
prop="type"
:filters="typeFilters"
column-key="type"
@ -106,7 +106,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
v-if="item.id=='method'"
prop="method"
column-key="method"
:filters="methodFilters"
@ -120,7 +120,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='status'"
v-if="item.id=='status'"
:filters="statusFilters"
column-key="status"
min-width="100px"
@ -133,16 +133,14 @@
</template>
</el-table-column>
<el-table-column v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='nodePath'"
v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
@ -151,7 +149,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='updateTime'"
v-if="item.id=='updateTime'"
prop="updateTime"
sortable="custom"
:label="$t('commons.update_time')"
@ -165,9 +163,7 @@
</template>
<el-table-column fixed="right" min-width="150">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -224,7 +220,7 @@ import {
_filter,
_handleSelect,
_handleSelectAll,
_sort,
_sort, getLabel,
getSelectDataCounts, initCondition,
setUnSelectIds,
toggleAllSelection
@ -233,10 +229,12 @@ import BatchMove from "./BatchMove";
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import i18n from "@/i18n/i18n";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
BatchMove,
MsTableHeaderSelectPopover,
@ -378,27 +376,9 @@ export default {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
this.getLabel()
getLabel(this, TEST_CASE_LIST);
this.getData();
},
getLabel(){
let param={}
param.userId=getCurrentUser().id;
param.type=TEST_CASE_LIST
this.result=this.$post('/system/header/info',param,response=> {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
getData() {
if (this.projectId) {
this.condition.projectId = this.projectId;

View File

@ -0,0 +1,13 @@
<template>
$END$
</template>
<script>
export default {
name: "TestcaseMinder"
}
</script>
<style scoped>
</style>

View File

@ -16,21 +16,21 @@
@row-click="intoPlan">
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'name'"
v-if="item.id == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
v-if="item.id == 'userName'"
prop="userName"
:label="$t('test_track.plan.plan_principal')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'status'"
v-if="item.id == 'status'"
prop="status"
column-key="status"
:filters="statusFilters"
@ -61,7 +61,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'stage'"
v-if="item.id == 'stage'"
prop="stage"
column-key="stage"
:filters="stageFilters"
@ -73,7 +73,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'testRate'"
v-if="item.id == 'testRate'"
prop="testRate"
:label="$t('test_track.home.test_rate')"
min-width="100"
@ -84,14 +84,14 @@
</template>
</el-table-column>
<el-table-colum
v-if="item.prop == 'projectName'"
v-if="item.id == 'projectName'"
prop="projectName"
:label="$t('test_track.plan.plan_project')"
show-overflow-tooltip
:key="index">
</el-table-colum>
<el-table-column
v-if="item.prop == 'plannedStartTime'"
v-if="item.id == 'plannedStartTime'"
sortable
prop="plannedStartTime"
:label="$t('test_track.plan.planned_start_time')"
@ -102,7 +102,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'plannedEndTime'"
v-if="item.id == 'plannedEndTime'"
sortable
prop="plannedEndTime"
:label="$t('test_track.plan.planned_end_time')"
@ -113,7 +113,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'actualStartTime'"
v-if="item.id == 'actualStartTime'"
sortable
prop="actualStartTime"
:label="$t('test_track.plan.actual_start_time')"
@ -124,7 +124,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'actualEndTime'"
v-if="item.id == 'actualEndTime'"
sortable
prop="actualEndTime"
:label="$t('test_track.plan.actual_end_time')"
@ -139,9 +139,7 @@
min-width="150"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -201,15 +199,17 @@ import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-compon
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsDeleteConfirm,
TestCaseReportView,
@ -265,7 +265,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
getLabel(this, TEST_PLAN_LIST);
if (this.planId) {
this.condition.planId = this.planId;
}
@ -289,24 +289,6 @@ export default {
}
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},

View File

@ -17,11 +17,9 @@
</template>
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" min-width="120">
<template v-slot:default="scope">
<div v-for="itemName in scope.row.tags" :key="itemName">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>

View File

@ -26,13 +26,13 @@
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" sortable="custom" label="ID" show-overflow-tooltip
<el-table-column v-if="item.id == 'num'" prop="num" sortable="custom" label="ID" show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.prop == 'name'" prop="name" sortable="custom"
<el-table-column v-if="item.id == 'name'" prop="name" sortable="custom"
:label="$t('api_test.definition.api_name')" show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.prop == 'priority'"
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
sortable="custom"
@ -46,14 +46,14 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'path'"
v-if="item.id == 'path'"
prop="path"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
<el-table-column
v-if="item.prop == 'createUser'"
v-if="item.id == 'createUser'"
prop="createUser"
column-key="user_id"
sortable="custom"
@ -63,7 +63,7 @@
:key="index"/>
<el-table-column
v-if="item.prop == 'custom'"
v-if="item.id == 'custom'"
sortable="custom"
width="160"
:label="$t('api_test.definition.api_last_time')"
@ -75,18 +75,16 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'tags'"
v-if="item.id == 'tags'"
prop="tags"
:label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'execResult'" :label="'执行状态'" min-width="130" align="center" :key="index">
<el-table-column v-if="item.id == 'execResult'" :label="'执行状态'" min-width="130" align="center" :key="index">
<template v-slot:default="scope">
<div v-loading="rowLoading === scope.row.id">
<el-link type="danger"
@ -108,9 +106,7 @@
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -161,14 +157,16 @@ import TestPlanApiCaseResult from "./TestPlanApiCaseResult";
import TestPlan from "../../../../../api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "../../../../../api/definition/components/jmeter/components/thread-group";
import {TEST_CASE_LIST, TEST_PLAN_API_CASE, WORKSPACE_ID} from "@/common/js/constants";
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Api_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanApiCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
TestPlanApiCaseResult,
MsRun,
@ -307,7 +305,7 @@ export default {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.getLabel()
getLabel(this, TEST_PLAN_API_CASE);
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -335,25 +333,6 @@ export default {
})
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_API_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
handleSelect(selection, row) {
row.hashTree = [];
if (this.selectRows.has(row)) {

View File

@ -18,13 +18,13 @@
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
v-if="item.id == 'num'"
prop="num"
label="ID"
:key="index"/>
<el-table-column v-if="item.prop == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')"
<el-table-column v-if="item.id == 'name'" prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'level'" prop="level" :label="$t('api_test.automation.case_level')"
<el-table-column v-if="item.id == 'level'" prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip :key="index">
<template v-slot:default="scope">
<ms-tag v-if="scope.row.level == 'P0'" type="info" effect="plain" content="P0"/>
@ -34,25 +34,23 @@
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'tagNames'" prop="tagNames" :label="$t('api_test.automation.tag')"
<el-table-column v-if="item.id == 'tagNames'" prop="tagNames" :label="$t('api_test.automation.tag')"
width="200px" :key="index">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
<el-table-column v-if="item.id == 'userId'" prop="userId" :label="$t('api_test.automation.creator')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'updateTime'" prop="updateTime"
<el-table-column v-if="item.id == 'updateTime'" prop="updateTime"
:label="$t('api_test.automation.update_time')" width="180" :key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
<el-table-column v-if="item.id == 'stepTotal'" prop="stepTotal" :label="$t('api_test.automation.step')"
show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.prop == 'lastResult'" prop="lastResult"
<el-table-column v-if="item.id == 'lastResult'" prop="lastResult"
:label="$t('api_test.automation.last_result')" :key="index">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
@ -63,15 +61,13 @@
</el-link>
</template>
</el-table-column>
<el-table-column v-if="item.prop == 'passRate'" prop="passRate"
<el-table-column v-if="item.id == 'passRate'" prop="passRate"
:label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip :key="index"/>
</template>
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="{row}">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -108,15 +104,17 @@ import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn"
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
import MsTestPlanList from "../../../../../api/automation/scenario/testplan/TestPlanList";
import TestPlanScenarioListHeader from "./TestPlanScenarioListHeader";
import {_handleSelect, _handleSelectAll} from "../../../../../../../common/js/tableUtils";
import {_handleSelect, _handleSelectAll, getLabel} from "../../../../../../../common/js/tableUtils";
import MsTableOperatorButton from "../../../../../common/components/MsTableOperatorButton";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_SCENARIO_CASE} from "@/common/js/constants";
import {Test_Plan_Scenario_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "MsTestPlanApiScenarioList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsTableOperatorButton,
TestPlanScenarioListHeader,
@ -186,7 +184,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
search() {
this.getLabel()
getLabel(this, TEST_PLAN_SCENARIO_CASE);
this.selectRows = new Set();
this.loading = true;
this.condition.moduleIds = this.selectNodeIds;
@ -212,25 +210,6 @@ export default {
this.loading = false;
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_SCENARIO_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
reductionApi(row) {
row.scenarioDefinition = null;
let rows = [row];

View File

@ -47,7 +47,7 @@
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
v-if="item.id == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
@ -56,7 +56,7 @@
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='name'"
v-if="item.id=='name'"
prop="name"
:label="$t('commons.name')"
min-width="120px"
@ -64,7 +64,7 @@
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.prop=='priority'"
v-if="item.id=='priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
@ -77,7 +77,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='type'"
v-if="item.id=='type'"
prop="type"
:filters="typeFilters"
column-key="type"
@ -90,18 +90,16 @@
</template>
</el-table-column>
<el-table-column v-if="item.prop=='tags'" prop="tags" :label="$t('commons.tag')" min-width="120px"
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" min-width="120px"
:key="index"
>
<template v-slot:default="scope">
<div v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index">
<ms-tag type="success" effect="plain" :content="tag"/>
</div>
<ms-tag v-for="(tag, index) in scope.row.showTags" :key="tag + '_' + index" type="success" effect="plain" :content="tag" style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
v-if="item.id=='method'"
prop="method"
:filters="methodFilters"
column-key="method"
@ -115,7 +113,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='nodePath'"
v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="120px"
@ -124,7 +122,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
v-if="item.id=='projectName'"
prop="projectName"
:label="$t('test_track.plan.plan_project')"
min-width="120px"
@ -133,7 +131,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='issuesContent'"
v-if="item.id=='issuesContent'"
:label="$t('test_track.issue.issue')"
min-width="80px"
show-overflow-tooltip
@ -167,7 +165,7 @@
<el-table-column
v-if="item.prop == 'executorName'"
v-if="item.id == 'executorName'"
prop="executorName"
:filters="executorFilters"
min-width="100px"
@ -177,7 +175,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'status'"
v-if="item.id == 'status'"
prop="status"
:filters="statusFilters"
column-key="status"
@ -212,7 +210,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'updateTime'"
v-if="item.id == 'updateTime'"
sortable
prop="updateTime"
@ -230,9 +228,7 @@
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@ -291,14 +287,16 @@ import BatchEdit from "../../../../case/components/BatchEdit";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import {hub} from "@/business/components/track/plan/event-bus";
import MsTag from "@/business/components/common/components/MsTag";
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Plan_Function_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "FunctionalTestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
FunctionalTestCaseEdit,
MsTableOperatorButton,
@ -422,7 +420,7 @@ export default {
},
initTableData() {
this.getLabel()
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@ -467,24 +465,6 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_FUNCTION_TEST_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
showDetail(row, event, column) {
this.isReadOnly = true;
this.$refs.testPlanTestCaseEdit.openTestCaseEdit(row);

View File

@ -24,30 +24,30 @@
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column v-if="item.prop == 'num'" prop="num" label="ID" show-overflow-tooltip :key="index"/>
<el-table-column v-if="item.id == 'num'" prop="num" label="ID" show-overflow-tooltip :key="index"/>
<el-table-column
v-if="item.prop == 'caseName'"
v-if="item.id == 'caseName'"
prop="caseName"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'projectName'"
v-if="item.id == 'projectName'"
prop="projectName"
:label="$t('load_test.project_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'userName'"
v-if="item.id == 'userName'"
prop="userName"
:label="$t('load_test.user_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop == 'createTime'"
v-if="item.id == 'createTime'"
sortable
prop="createTime"
:label="$t('commons.create_time')"
@ -57,7 +57,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'status'"
v-if="item.id == 'status'"
prop="status"
column-key="status"
:filters="statusFilters"
@ -68,7 +68,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'caseStatus'"
v-if="item.id == 'caseStatus'"
prop="caseStatus"
:label="$t('test_track.plan.load_case.execution_status')"
:key="index">
@ -86,7 +86,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop == 'loadReportId'"
v-if="item.id == 'loadReportId'"
:label="$t('test_track.plan.load_case.report')"
show-overflow-tooltip
:key="index">
@ -102,9 +102,7 @@
</template>
<el-table-column v-if="!isReadOnly" :label="$t('commons.operating')" align="center">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button class="run-button" :is-tester-permission="true" :tip="$t('api_test.run')"
@ -133,15 +131,17 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import MsPerformanceTestStatus from "@/business/components/performance/test/PerformanceTestStatus";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import LoadCaseReport from "@/business/components/track/plan/view/comonents/load/LoadCaseReport";
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {TEST_CASE_LIST, TEST_PLAN_LOAD_CASE} from "@/common/js/constants";
import {Test_Plan_Load_Case, Track_Test_Case} from "@/business/components/common/model/JsonData";
import {getCurrentUser} from "@/common/js/utils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestPlanLoadCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
LoadCaseReport,
TestPlanLoadCaseListHeader,
@ -211,7 +211,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
this.getLabel()
getLabel(this, TEST_PLAN_LOAD_CASE);
this.selectRows = new Set();
this.condition.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') {
@ -232,24 +232,6 @@ export default {
this.tableData = listObject;
})
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_PLAN_LOAD_CASE
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
refreshStatus() {
this.refreshScheduler = setInterval(() => {
//

View File

@ -20,9 +20,7 @@
<el-table-column prop="tags" :label="$t('api_test.automation.tag')" width="200px">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 5px"/>
</template>
</el-table-column>

View File

@ -16,28 +16,28 @@
@row-click="intoReview">
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop=='name'"
v-if="item.id=='name'"
prop="name"
:label="$t('test_track.review.review_name')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='reviewer'"
v-if="item.id=='reviewer'"
prop="reviewer"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
v-if="item.id=='projectName'"
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.prop=='creatorName'"
v-if="item.id=='creatorName'"
prop="creatorName"
:label="$t('test_track.review.review_creator')"
show-overflow-tooltip
@ -45,7 +45,7 @@
>
</el-table-column>
<el-table-column
v-if="item.prop=='status'"
v-if="item.id=='status'"
prop="status"
column-key="status"
:label="$t('test_track.review.review_status')"
@ -59,7 +59,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='createTime'"
v-if="item.id=='createTime'"
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip
@ -70,7 +70,7 @@
</template>
</el-table-column>
<el-table-column
v-if="item.prop=='endTime'"
v-if="item.id=='endTime'"
prop="endTime"
:label="$t('test_track.review.end_time')"
show-overflow-tooltip
@ -84,9 +84,7 @@
min-width="100"
:label="$t('commons.operating')">
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@ -118,15 +116,17 @@ import {
getCurrentProjectID, getCurrentUser,
getCurrentWorkspaceId
} from "../../../../../common/js/utils";
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
import {TEST_CASE_LIST, TEST_CASE_REVIEW_LIST} from "@/common/js/constants";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestCaseReviewList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsDeleteConfirm,
MsTableOperator,
@ -173,7 +173,7 @@ export default {
},
initTableData() {
this.getLabel()
getLabel(this, TEST_CASE_REVIEW_LIST);
let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) {
@ -201,24 +201,6 @@ export default {
}
});
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_CASE_REVIEW_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
intoReview(row) {
this.$router.push('/track/review/view/' + row.id);
},

View File

@ -43,7 +43,7 @@
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column
v-if="item.prop == 'num'"
v-if="item.id == 'num'"
prop="num"
sortable="custom"
:label="$t('commons.id')"
@ -52,7 +52,7 @@
>
</el-table-column>
<el-table-column
v-if="item.prop == 'name'"
v-if="item.id == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
@ -60,7 +60,7 @@
>
</el-table-column>
<el-table-column
v-if="item.prop == 'priority'"
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
@ -72,7 +72,7 @@
</el-table-column>
<el-table-column
v-if="item.prop == 'type'"
v-if="item.id == 'type'"
prop="type"
:filters="typeFilters"
column-key="type"
@ -85,7 +85,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='method'"
v-if="item.id=='method'"
prop="method"
:filters="methodFilters"
column-key="method"
@ -98,7 +98,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='nodePath'"
v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
show-overflow-tooltip
@ -107,7 +107,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='projectName'"
v-if="item.id=='projectName'"
prop="projectName"
:label="$t('test_track.review.review_project')"
show-overflow-tooltip
@ -115,7 +115,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='reviewerName'"
v-if="item.id=='reviewerName'"
prop="reviewerName"
:label="$t('test_track.review.reviewer')"
show-overflow-tooltip
@ -124,7 +124,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='reviewStatus'"
v-if="item.id=='reviewStatus'"
:filters="statusFilters"
column-key="status"
:label="$t('test_track.review_view.execute_result')"
@ -137,7 +137,7 @@
</el-table-column>
<el-table-column
v-if="item.prop=='updateTime'"
v-if="item.id=='updateTime'"
sortable
prop="updateTime"
:label="$t('commons.update_time')"
@ -153,9 +153,7 @@
:label="$t('commons.operating')"
>
<template slot="header">
<span>{{ $t('commons.operating') }}
<i class='el-icon-setting' style="color:#7834c1; margin-left:10px" @click="customHeader"> </i>
</span>
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.edit')" icon="el-icon-edit"
@ -212,13 +210,15 @@ import {
} from "../../../../../../common/js/constants";
import TestReviewTestCaseEdit from "./TestReviewTestCaseEdit";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {_filter, _sort} from "@/common/js/tableUtils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import {Test_Case_Review_Case_List, Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
export default {
name: "TestReviewTestCaseList",
components: {
HeaderLabelOperate,
HeaderCustom,
MsTableOperatorButton, MsTableOperator, MethodTableItem, TypeTableItem,
StatusTableItem, PriorityTableItem, StatusEdit,
@ -309,7 +309,7 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
this.getLabel()
getLabel(this, TEST_CASE_REVIEW_CASE_LIST);
if (this.reviewId) {
this.condition.reviewId = this.reviewId;
}
@ -323,24 +323,6 @@ export default {
});
}
},
getLabel() {
let param = {}
param.userId = getCurrentUser().id;
param.type = TEST_CASE_REVIEW_CASE_LIST
this.result = this.$post('/system/header/info', param, response => {
if (response.data != null) {
let arry = eval(response.data.props);
let obj = {};
for (let key in arry) {
obj[key] = arry[key];
}
let newObj = Object.keys(obj).map(val => ({
prop: obj[val]
}))
this.tableLabel = newObj
}
})
},
showDetail(row, event, column) {
this.isReadOnly = true;
this.$refs.testReviewTestCaseEdit.openTestCaseEdit(row);

View File

@ -1,4 +1,5 @@
import {humpToLine} from "@/common/js/utils";
import {getCurrentUser, humpToLine} from "@/common/js/utils";
import {TEST_CASE_LIST} from "@/common/js/constants";
export function _handleSelectAll(component, selection, tableData, selectRows) {
if (selection.length > 0) {
@ -106,6 +107,17 @@ export function initCondition(condition) {
condition.unSelectIds = [];
}
export function getLabel(vueObj, type) {
let param = {}
param.userId = getCurrentUser().id;
param.type = type;
vueObj.result = vueObj.$post('/system/header/info', param, response => {
if (response.data != null) {
vueObj.tableLabel = eval(response.data.props);
}
})
}