feat(XPack): 我的工作台

This commit is contained in:
guoyuqi 2021-10-11 18:59:59 +08:00 committed by 刘瑞斌
parent 96c18b9dd0
commit 56b6feaad2
37 changed files with 658 additions and 20 deletions

View File

@ -15,4 +15,5 @@ public class ApiTestCaseDTO extends ApiTestCase {
private String deleteUser;
private String apiName;
private String passRate;
private String projectName;
}

View File

@ -29,7 +29,9 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
private Map<String, Object> combine;
private boolean isSelectThisWeedData;
private long createTime = 0;
private long updateTime = 0;
private String reviewId;
private String deleteUserId;
private long deleteTime;
private boolean toUpdate;
}

View File

@ -166,6 +166,10 @@ public class ApiTestCaseService {
filters.put("status", new ArrayList<>());
}
}
if(request.isToUpdate()){
Long timestamp = DateUtils.getTimestamp(-3);
request.setUpdateTime(timestamp);
}
request.setOrders(orders);
}
if (checkThisWeekData) {

View File

@ -14,4 +14,5 @@ public class IssuesDao extends IssuesWithBLOBs {
private String resourceName;
private long caseCount;
private List<String> caseIds;
private int totalIssueCount;
}

View File

@ -120,6 +120,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and api_definition.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_definition.update_time
<include refid="condition">

View File

@ -86,6 +86,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and api_scenario.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_scenario.update_time
<include refid="condition">

View File

@ -57,4 +57,6 @@ public interface ExtApiTestCaseMapper {
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
int moduleCount(@Param("request")ApiTestCaseRequest request);
}

View File

@ -150,6 +150,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and t1.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and t1.update_time
<include refid="condition">
@ -202,7 +208,67 @@
<property name="object" value="${condition}.status"/>
</include>
</if>
</sql>
<sql id="countCombine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
and api_test_case.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and api_test_case.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
and api_test_case.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.createTime != null">
and api_test_case.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.priority != null">
and api_test_case.priority
<include refid="condition">
<property name="object" value="${condition}.priority"/>
</include>
</if>
<if test="${condition}.creator != null">
and api_test_case.create_user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "not like"'>
and (api_test_case.tags is null or api_test_case.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
)
</if>
<if test='${condition}.tags != null and ${objectKey}.operator == "like"'>
and api_test_case.tags
<include refid="condition">
<property name="object" value="${condition}.tags"/>
</include>
</if>
<if test="${condition}.isReference != null">
and api_test_case.id
<if test='${condition}.isReference.value == "true"'>
in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
</if>
<if test='${condition}.isReference.value == "false"'>
not in (SELECT reference_id FROM api_scenario_reference_id WHERE reference_id is not null )
</if>
</if>
</sql>
<select id="selectApiCaseInfoByPrimaryKey" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
@ -243,13 +309,14 @@
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
select
t1.id, t1.project_id, t1.name,t1.case_status, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
a.module_id, a.path, a.protocol, t1.tags,t1.status,t1.last_result_id as lastResultId,
a.module_id, a.path, a.protocol, t1.tags,t1.status,t1.last_result_id as lastResultId, project.name as project_name,
t1.delete_time, deleteUser.name AS deleteUser,CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t2.id)*100,2),'%') passRate
from
api_test_case t1
LEFT JOIN api_definition_exec_result t2 ON t1.id = t2.resource_id
LEFT JOIN user deleteUser ON t1.delete_user_id = deleteUser.id
LEFT JOIN api_definition a on t1.api_definition_id = a.id
LEFT JOIN project project ON t1.project_id = project.id
WHERE 1=1
<if test="request.protocol != null and request.protocol!=''">
and a.protocol = #{request.protocol}
@ -257,8 +324,6 @@
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
and t1.api_definition_id = #{request.apiDefinitionId}
</if>
GROUP BY t1.id
having 1=1
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
@ -327,6 +392,27 @@
<if test="request.filters == null || request.filters.size() == 0 ">
and (t1.status is null or t1.status != 'Trash')
</if>
<if test="request.toUpdate !=null and request.toUpdate == true">
and (t1.update_time >= 'request.updateTime' or t2.status = 'error')
</if>
GROUP BY t1.id,
t1.project_id,
t1.name,
t1.api_definition_id,
t1.priority,
t1.description,
t1.create_user_id,
t1.update_user_id,
t1.create_time,
t1.update_time,
t1.num,
a.module_id,
a.path,
a.protocol,
t1.tags,
t1.status,
t1.`order`
having 1=1
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
<select id="idSimple" resultType="java.lang.String">
@ -444,6 +530,11 @@
AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select>
<select id="moduleCount" resultType="java.lang.Integer">
SELECT count(id) FROM api_test_case
<include refid="criCondition"/>
</select>
<select id="getRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
select t1.id, t1.request,a.method AS apiMethod
from api_test_case t1
@ -516,7 +607,7 @@
WHERE testCase.id = #{0}
</select>
<sql id="queryWhereCondition">
<sql id="queryWhereCondition">
<where>
<if test="request.name != null and request.name!=''">
and t1.name like CONCAT('%', #{request.name},'%')
@ -577,6 +668,19 @@
</if>
</where>
</sql>
<sql id="criCondition">
<where>
<if test="request.combine != null">
<include refid="countCombine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
</where>
</sql>
<select id="selectIdsByQuery" resultType="java.lang.String">
SELECT t1.id
FROM api_test_case t1

View File

@ -19,7 +19,7 @@
</if>
</sql>
<sql id="condition">
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')

View File

@ -21,4 +21,6 @@ public interface ExtIssuesMapper {
List<IssuesDao> getIssueForSync(String projectId);
List<PlanReportIssueDTO> selectForPlanReport(String planId);
List<IssuesDao>getCountByStatus(@Param("request") IssuesRequest issuesRequest);
}

View File

@ -25,6 +25,11 @@
<select id="getNextNum" resultType="io.metersphere.base.domain.Issues">
SELECT * FROM issues WHERE issues.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
</select>
<select id="getCountByStatus" resultType="io.metersphere.base.domain.IssuesDao">
select count(id) as totalIssueCount, ifnull(issues.status,issues.platform_status) as status from issues
<include refid="queryWhereCondition"/>
group by status;
</select>
<select id="getRelateIssues" resultType="io.metersphere.base.domain.IssuesDao">
select issues.id, issues.num, issues.title, issues.project_id, issues.create_time, issues.update_time,
issues.description, issues.status, issues.platform, issues.custom_fields,test_case_issues.test_case_id,issues.platform_status,
@ -48,7 +53,13 @@
<sql id="queryWhereCondition">
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and (
issues.title LIKE CONCAT('%', #{request.name}, '%')
@ -85,7 +96,8 @@
<choose>
<when test="key == 'platform'">
AND issues.platform IN
<foreach collection="values" item="value" separator="," open="(" close=")">
<foreach collection="values" item="
" separator="," open="(" close=")">
#{value}
</foreach>
</when>
@ -102,5 +114,57 @@
</where>
</sql>
<sql id="combine">
<if test="${condition}.creator != null">
and issues.creator
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
</mapper>

View File

@ -5,6 +5,7 @@ import io.metersphere.base.domain.LoadTest;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.performance.request.QueryProjectFileRequest;
import io.metersphere.performance.request.QueryTestPlanRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -29,4 +30,6 @@ public interface ExtLoadTestMapper {
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
int moduleCount(@Param("request") QueryTestPlanRequest request);
}

View File

@ -18,6 +18,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and load_test.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
AND load_test.update_time
<include refid="condition">
@ -50,6 +56,45 @@
</if>
</sql>
<sql id="countCombine">
<if test='${condition}.name != null and (${name} == null or ${name} == "")'>
AND load_test.name
<include refid="condition">
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and load_test.follow_people
<include refid="condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.updateTime != null">
AND load_test.update_time
<include refid="condition">
<property name="object" value="${condition}.updateTime"/>
</include>
</if>
<if test="${condition}.createTime != null">
AND load_test.create_time
<include refid="condition">
<property name="object" value="${condition}.createTime"/>
</include>
</if>
<if test="${condition}.status != null">
AND load_test.status
<include refid="condition">
<property name="object" value="${condition}.status"/>
</include>
</if>
<if test="${condition}.creator != null">
AND load_test.user_id
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<select id="list" resultMap="BaseResultMap"
parameterType="io.metersphere.performance.request.QueryTestPlanRequest">
SELECT load_test.*, project.name AS project_name, user.name AS user_name
@ -143,6 +188,33 @@
select * from load_test lt where lt.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
</select>
<select id="moduleCount" resultType="java.lang.Integer">
select count(id) from load_test
<where>
<if test="request.combine != null">
<include refid="countCombine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
</where>
</select>
<sql id="queryWhereCondition">
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
</where>
</sql>
<select id="getProjectFiles" resultType="io.metersphere.base.domain.FileMetadata">
SELECT file_metadata.*
FROM file_metadata

View File

@ -9,6 +9,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and test_case.follow_people
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.module != null">
and test_case.node_path
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">

View File

@ -21,17 +21,59 @@
</if>
</select>
<sql id="combine">
<if test="${condition}.followPeople != null">
and test_case_review.follow_people
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.creator != null">
and test_case_review.create_user
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
</sql>
<sql id="queryWhereCondition">
<where>
<if test="request.combine != null">
<include refid="combine">
<property name="condition" value="request.combine"/>
<property name="name" value="request.name"/>
<property name="objectKey" value="request.combine.tags"/>
</include>
</if>
<if test="request.name != null">
and test_case_review.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.projectId != null">
and test_case_review.project_id = #{request.projectId}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
<choose>
<when test="key=='stage'">
and test_case_review.stage in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and test_case_review.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</otherwise>
</choose>
</if>
</foreach>
</if>
</where>
</sql>
<select id="listByWorkspaceId" resultType="io.metersphere.track.dto.TestCaseReviewDTO"
parameterType="io.metersphere.track.request.testreview.QueryCaseReviewRequest">
select distinct test_case_review.*

View File

@ -58,6 +58,12 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test="${condition}.followPeople != null">
and test_plan.follow_people
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.followPeople"/>
</include>
</if>
<if test="${condition}.projectName != null">
and project.name
<include refid="condition">
@ -88,6 +94,19 @@
<property name="object" value="${condition}.stage"/>
</include>
</if>
<if test="${condition}.creator != null">
and test_plan.creator
<include refid="condition">
<property name="object" value="${condition}.creator"/>
</include>
</if>
<if test="${condition}.principal != null">
and test_plan.id in (SELECT test_plan_id FROM test_plan_principal WHERE principal_id
<include refid="condition">
<property name="object" value="${condition}.principal"/>
</include>
)
</if>
</sql>
<select id="list" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric"

View File

@ -106,17 +106,31 @@ public class DateUtils {
}
/**
* 获取当前时间或者当前时间+- 任意天数 时间的时间戳
* @param countDays
* @return
*/
public static Long getTimestamp(int countDays){
Date now = new Date();
return dateSum (now,countDays).getTime()/1000*1000;
}
public static void main(String[] args) throws Exception {
Date now = new Date();
System.out.println(getTimeString(now));
long time = dateSum(now, -3).getTime()/1000*1000;
long time1 = dateSum(now, 0).getTime()/1000*1000;
Date afterDate = dateSum(now,-3);
System.out.println(getTimeString(afterDate));
/*System.out.println(getTimeString(now));
Date afterDate = dateSum(now,-30,Calendar.DAY_OF_MONTH);
System.out.println(getTimeString(afterDate));
afterDate = dateSum(now,-17,Calendar.MONTH);
System.out.println(getTimeString(afterDate));
afterDate = dateSum(now,-20,Calendar.YEAR);
System.out.println(getTimeString(afterDate));
System.out.println(getTimeString(afterDate));*/
System.out.println(time);
System.out.println(time1);
}

View File

@ -0,0 +1,30 @@
package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.base.domain.IssueTemplate;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.service.WorkspaceService;
import io.metersphere.service.WorkstationService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RequestMapping("workstation")
@RestController
public class WorkstationController {
@Resource
private WorkstationService workstationService;
@PostMapping("/creat_case_count/list")
public Map<String,Integer> list() {
return workstationService.getMyCreatedCaseGroupContMap();
}
}

View File

@ -1,6 +1,7 @@
package io.metersphere.performance.request;
import io.metersphere.controller.request.OrderRequest;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

View File

@ -0,0 +1,64 @@
package io.metersphere.service;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.performance.request.QueryTestPlanRequest;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@Service
@Transactional(rollbackFor = Exception.class)
public class WorkstationService {
@Resource
private ExtApiScenarioMapper extApiScenarioMapper;
@Resource
private ExtApiTestCaseMapper extApiTestCaseMapper;
@Resource
private ExtTestCaseMapper extTestCaseMapper;
@Resource
private ExtLoadTestMapper extLoadTestMapper;
public Map<String, Integer> getMyCreatedCaseGroupContMap() {
String userId = SessionUtils.getUserId();
//build query condition object
QueryTestPlanRequest testPlanRequest = new QueryTestPlanRequest();
testPlanRequest.setUserId(userId);
ApiTestCaseRequest apiTestCaseRequest = new ApiTestCaseRequest();
//@see io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml:103
Map<String, Object> combine = new HashMap<>(2);
Map<String,String>operatorValue = new HashMap<>(2);
operatorValue.put("operator","current user");
operatorValue.put("value","current user");
combine.put("creator",operatorValue);
apiTestCaseRequest.setCombine(combine);
ApiScenarioRequest apiScenarioRequest = new ApiScenarioRequest();
apiScenarioRequest.setCombine(combine);
QueryTestCaseRequest testCaseRequest = new QueryTestCaseRequest();
testCaseRequest.setCombine(combine);
//query db
int apiScenarioCaseCount = extApiScenarioMapper.listModule(apiScenarioRequest);
int apiTestCaseCount = extApiTestCaseMapper.moduleCount(apiTestCaseRequest);
int testCaseCount = extTestCaseMapper.moduleCount(testCaseRequest);
int loadTestCount = extLoadTestMapper.moduleCount(testPlanRequest);
//build result
Map<String, Integer>map = new HashMap<>(4);
map.put("apiScenarioCaseCount",apiScenarioCaseCount);
map.put("apiTestCaseCount",apiTestCaseCount);
map.put("testCaseCount",testCaseCount);
map.put("loadTestCount",loadTestCount);
return map;
}
}

View File

@ -123,4 +123,10 @@ public class IssuesController {
public void changeStatus(@RequestBody IssuesRequest request) {
issuesService.changeStatus(request);
}
@PostMapping("/status/count")
public List<IssuesDao> getCountByStatus(@RequestBody IssuesRequest request) {
return issuesService.getCountByStatus(request);
}
}

View File

@ -544,4 +544,9 @@ public class IssuesService {
issues.setCustomFields(JSONObject.toJSONString(fields));
issuesMapper.updateByPrimaryKeySelective(issues);
}
public List<IssuesDao> getCountByStatus(IssuesRequest request){
return extIssuesMapper.getCountByStatus(request);
}
}

View File

@ -152,6 +152,7 @@ export default {
mounted() {
this.getProject();
this.getTrashCase();
this.init()
},
watch: {
redirectID() {
@ -376,6 +377,12 @@ export default {
}
}
},
init(){
let scenarioData = this.$route.params.scenarioData;
if(scenarioData){
this.editScenario(scenarioData)
}
},
editScenario(row) {
const index = this.tabs.find(p => p.currentScenario.id === row.id);
if (!index) {

View File

@ -402,6 +402,9 @@ export default {
// });
}
},
mounted(){
this.init();
},
methods: {
setEnvironment(data) {
if (data) {
@ -558,6 +561,7 @@ export default {
this.apiDefaultTab = newTabName;
},
handleTabsEdit(targetName, action, api) {
debugger
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
@ -581,7 +585,14 @@ export default {
debug(id) {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
},
init(){
let routeTestCase = this.$route.params.apiDefinition;
if(routeTestCase){
this.editApi(routeTestCase)
}
},
editApi(row) {
debugger
let name = "";
if (row.isCopy) {
name = "copy" + "-" + row.name;

View File

@ -119,7 +119,7 @@
:fields-width="fieldsWidth"
min-width="100px"
:label="$t('commons.pass_rate')">
</ms-table-column>
</ms-table-column>
<ms-table-column
sortable="custom"

View File

@ -70,7 +70,7 @@ export default {
methods: {
search() {
let selectProjectId = getCurrentProjectID();
debugger
this.$get("/api/apiCount/" + selectProjectId, response => {
this.apiCountData = response.data;
});

View File

@ -1,3 +1,5 @@
export default {
path: "/api",
name: "api",
@ -52,5 +54,10 @@ export default {
name: 'ApiMonitor',
component: () => import('@/business/components/api/monitor/ApiMonitor'),
},
{
path: 'definition/edit/:definitionId',
name: 'editCompleteContainer',
component: () => import('@/business/components/api/definition/ApiDefinition'),
},
]
};

View File

@ -0,0 +1,90 @@
<template>
<ms-chart v-if="visible && data.length > 0" :options="options" :autoresize ="true" style="width: 100%"/>
</template>
<script>
import MsChart from "@/business/components/common/chart/MsChart";
export default {
name: "MsBorderPieChart",
components: {MsChart},
data() {
return {
visible: true,
autoresize:true,
options: {
color:['#fac858','#73c0de','#ee6666', '#91cc75', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc','#5470c6'],
title: {
text: this.text,
subtext: this.subtext,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
right: "1%"
},
series: [
{
name: 'Access From',
type: 'pie',
radius: this.radius,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: true,
position:'inner',
formatter: '{d}%',
},
labelLine: {
show: true
},
data: this.data,
colorBy: "data"
}
]
}
}
},
props: {
text: {
type: String,
default: ''
},
name: {
type: String,
default: ''
},
subtext: {
type: String,
default: ''
},
radius:{
type: Array,
default() {
return ['40%', '70%']
}
},
data: {
type: Array,
default() {
return []
}
}
},
watch: {
data() {
}
},
}
</script>
<style scoped>
</style>

View File

@ -8,7 +8,10 @@
@select="handleSelect"
:key="menuKey"
router>
<el-menu-item index="/workstation" v-if="check('my_workstation')" onselectstart="return false"
v-permission="['PROJECT_API_DEFINITION:READ','PROJECT_API_SCENARIO:READ','PROJECT_API_REPORT:READ']">
{{ $t('commons.my_workstation') }}
</el-menu-item>
<el-menu-item index="/track" v-if="check('testTrack')" onselectstart="return false"
v-permission="['PROJECT_TRACK_CASE:READ','PROJECT_TRACK_PLAN:READ','PROJECT_TRACK_REVIEW:READ', 'PROJECT_TRACK_ISSUE:READ', 'PROJECT_TRACK_REPORT:READ']">
{{ $t('test_track.test_track') }}

View File

@ -8,13 +8,13 @@ import Track from "@/business/components/track/router";
import ReportStatistics from "@/business/components/reportstatistics/router";
import Project from "@/business/components/project/router";
import {getCurrentUserId} from "@/common/js/utils";
import {workstation} from "@/business/components/xpack/router";
// const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
// const Report = requireContext.keys().map(key => requireContext(key).report);
// const ReportObj = Report && Report != null && Report.length > 0 && Report[0] != undefined ? Report : [{path: "/sidebar"}];
Vue.use(VueRouter);
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
const router = new VueRouter({
routes: [
{path: "/", redirect: '/setting/personsetting'},
@ -24,6 +24,7 @@ const router = new VueRouter({
sidebar: RouterSidebar
}
},
...requireContext.keys().map(key => requireContext(key).workstation),
Setting,
API,
Performance,

View File

@ -177,7 +177,6 @@ export default {
});
},
'$route'(to, from) {
this.init(to);
if (to.path.indexOf('/track/case/all') == -1) {
if (this.$refs && this.$refs.autoScenarioConfig) {
this.$refs.autoScenarioConfig.forEach(item => {
@ -185,6 +184,7 @@ export default {
});
}
}
this.init(to);
},
activeName(newVal, oldVal) {
if (oldVal !== 'default' && newVal === 'default' && this.$refs.minder) {
@ -338,11 +338,14 @@ export default {
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
this.testCaseReadOnly = false;
let caseId = this.$route.params.caseId;
let routeTestCase = this.$route.params.testCase;
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
if (caseId) {
if(routeTestCase){
this.editTestCase(routeTestCase);
}else if (caseId) {
this.$get('test/case/get/' + caseId, response => {
let testCase = response.data;
this.editTestCase(testCase);

View File

@ -280,7 +280,9 @@ export default {
},
projectId() {
return getCurrentProjectID();
}
},
},
created() {
this.getMaintainerOptions();

@ -1 +1 @@
Subproject commit 344e5e800be1a55c9ff48b2a25f1d3132c3c775e
Subproject commit 5f6377671afbd55c4e4897b7de1b8e428c5feb2e

View File

@ -46,6 +46,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'casePassingRate', key: 'a', label: 'api_test.definition.api_case_passing_rate'},
{id: 'status', key: 'b', label: 'api_test.definition.api_status'},
{id: 'createTime', key: 'c', label: 'commons.create_time'},
{id: 'projectName', key: '10', label: 'api_test.definition.api_project'},
],
//接口用例
API_CASE: [
@ -59,6 +60,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'createUser', key: '8', label: 'api_test.creator'},
{id: 'updateTime', key: '9', label: 'api_test.definition.api_last_time'},
{id: 'createTime', key: 'a', label: 'commons.create_time'},
{id: 'projectName', key: 'a', label: 'commons.project'},
{id: 'passRate', key: 'b', label: 'commons.pass_rate'},
],
//场景测试
@ -194,6 +196,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'description', key: '7', label: 'test_track.issue.description'},
{id: 'caseCount', key: '9', label: 'api_test.definition.api_case_number'},
{id: 'createTime', key: '8', label: 'commons.create_time'},
{id: 'projectName', key: '10', label: 'test_track.issue.project_came'},
]
}

View File

@ -86,6 +86,7 @@ export default {
test_resource_pool: 'Resource Pool',
system_setting: 'Settings',
api: 'API',
my_workstation:'MyWorkstation',
performance: 'Performance',
functional: 'Functional test',
input_content: 'Please enter content',
@ -332,6 +333,22 @@ export default {
invalid: 'invalid',
expired: 'expired',
},
workstation:{
dash_board: 'My DashBoard',
upcoming: 'My Upcoming',
focus: 'My Focus',
creation: 'My Creation',
table_name:{
track_case:'Track Case',
track_plan:'Track Plan',
track_review:'Track Review',
track_issue:'Track issue',
api_definition:'Api Definition',
api_automation:'Api Automation',
api_case:'Api Case',
performance:'Performance',
}
},
display: {
title: 'Theme',
logo: 'System LOGO',
@ -888,6 +905,7 @@ export default {
create_tip: "Note: Detailed interface information can be filled out on the edit page",
api_import: "Api Import",
check_select: "Please check the API",
api_project:"Project",
select_comp: {
no_data: "No Data",
add_data: "Add Data"
@ -1816,6 +1834,7 @@ export default {
description: "Issue Description",
status: "Issue Status",
platform: "Platform",
issue_project:"Project",
operate: "Operate",
close: "Close",
delete: "Delete",

View File

@ -89,6 +89,7 @@ export default {
api: '接口测试',
performance: '性能测试',
functional: '功能测试',
my_workstation:'我的工作台',
input_content: '请输入内容',
create: '新建',
edit: '编辑',
@ -333,6 +334,22 @@ export default {
invalid: '无效',
expired: '已过期',
},
workstation:{
dash_board: '我的仪表盘',
upcoming: '我的待办',
focus: '我关注的',
creation: '我创建的',
table_name:{
track_case:'功能用例',
track_plan:'测试计划',
track_review:'用例评审',
track_issue:'缺陷管理',
api_definition:'接口定义',
api_automation:'接口自动化',
api_case:'接口用例',
performance:'性能测试',
}
},
display: {
title: '显示设置',
logo: '系统 LOGO',
@ -894,6 +911,7 @@ export default {
create_tip: "注: 详细的接口信息可以在编辑页面填写",
api_import: "接口导入",
check_select: "请勾选接口",
api_project:"所属项目",
select_comp: {
no_data: "无数据",
add_data: "去添加"
@ -1824,6 +1842,7 @@ export default {
title: "缺陷标题",
description: "缺陷描述",
status: "缺陷状态",
issue_project:"所属项目",
platform: "平台",
operate: "操作",
close: "关闭缺陷",

View File

@ -90,6 +90,7 @@ export default {
performance: '性能測試',
functional: '功能測試',
input_content: '請輸入內容',
my_workstation:'我的工作台',
create: '新建',
edit: '編輯',
copy: '復製',
@ -333,6 +334,22 @@ export default {
invalid: '無效',
expired: '已過期',
},
workstation:{
dash_board: '我的儀錶盤',
upcoming: '我的待辦',
focus: '我關注的',
creation: '我創建的',
table_name:{
track_case:'功能用例',
track_plan:'測試計劃',
track_review:'用例評審',
track_issue:'缺陷管理',
api_definition:'接口定義',
api_automation:'接口自動化',
api_case:'接口用例',
performance:'性能測試',
}
},
display: {
title: '顯示設置',
logo: '系統 LOGO',
@ -894,6 +911,7 @@ export default {
create_tip: "註: 詳細的接口信息可以在編輯頁面填寫",
api_import: "接口導入",
check_select: "請勾選接口",
api_project:"所屬項目",
select_comp: {
no_data: "無數據",
add_data: "去添加"
@ -1824,6 +1842,7 @@ export default {
title: "缺陷標題",
description: "缺陷描述",
status: "缺陷狀態",
issue_project:"所屬項目",
platform: "平臺",
operate: "操作",
close: "關閉缺陷",