Merge remote-tracking branch 'origin/master'

This commit is contained in:
q4speed 2020-10-20 16:05:49 +08:00
commit 9f1198fe9e
10 changed files with 52 additions and 32 deletions

View File

@ -98,8 +98,8 @@
</sql> </sql>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase"> <select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
from test_case left join test_case_review_test_case as T2 on test_case.id=T2.case_id
<where> <where>
<if test="request.combine != null"> <if test="request.combine != null">
<include refid="combine"> <include refid="combine">
@ -107,7 +107,7 @@
<property name="name" value="request.name"/> <property name="name" value="request.name"/>
</include> </include>
</if> </if>
and test_case.id not in (select case_id from test_case_review_test_case where review_id =#{request.reviewId}) and T2.case_id is null
<if test="request.name != null"> <if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%') and test_case.name like CONCAT('%', #{request.name},'%')
</if> </if>
@ -152,8 +152,8 @@
</select> </select>
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase"> <select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
from test_case left join test_plan_test_case as T2 on test_case.id=T2.case_id
<where> <where>
<if test="request.combine != null"> <if test="request.combine != null">
<include refid="combine"> <include refid="combine">
@ -161,7 +161,7 @@
<property name="name" value="request.name"/> <property name="name" value="request.name"/>
</include> </include>
</if> </if>
and test_case.id not in (select case_id from test_plan_test_case where plan_id =#{request.planId}) and T2.case_id is null
<if test="request.name != null"> <if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%') and test_case.name like CONCAT('%', #{request.name},'%')
</if> </if>

View File

@ -9,7 +9,18 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
public class PlanCaseRelevanceRequest { public class PlanCaseRelevanceRequest {
/**
* 测试计划ID
*/
private String planId; private String planId;
private String projectId;
/**
* 当选择关联全部用例时把加载条件送到后台从后台查询
*/
private QueryTestCaseRequest request;
/**
* 具体要关联的用例
*/
private List<String> testCaseIds = new ArrayList<>(); private List<String> testCaseIds = new ArrayList<>();
} }

View File

@ -1,5 +1,6 @@
package io.metersphere.track.request.testreview; package io.metersphere.track.request.testreview;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -9,7 +10,18 @@ import java.util.List;
@Getter @Getter
@Setter @Setter
public class ReviewRelevanceRequest { public class ReviewRelevanceRequest {
/**
* 评审ID
*/
private String reviewId; private String reviewId;
private String projectId;
/**
* 当选择关联全部用例时把加载条件送到后台从后台查询
*/
private QueryTestCaseRequest request;
/**
* 具体选择要关联的用例
*/
private List<String> testCaseIds = new ArrayList<>(); private List<String> testCaseIds = new ArrayList<>();
} }

View File

@ -326,12 +326,9 @@ public class TestCaseReviewService {
if (testCaseIds.isEmpty()) { if (testCaseIds.isEmpty()) {
return; return;
} }
// 如果是关联全部指令则从新查询未关联的案例 // 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) { if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest(); List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
req.setReviewId(request.getReviewId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(req);
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList()); testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
} }

View File

@ -211,12 +211,9 @@ public class TestPlanService {
return; return;
} }
// 如果是关联全部指令则从新查询未关联的案例 // 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) { if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest(); List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(request.getRequest());
req.setPlanId(request.getPlanId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(req);
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList()); testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
} }

View File

@ -116,17 +116,13 @@
return true; return true;
}, },
validateDomain(domain) { validateDomain(domain) {
let url = {}; let strRegex = "^(?=^.{3,255}$)(http(s)?:\\/\\/)?(www\\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\\d+)*(\\/\\w+\\.\\w+)*$";
try { const re = new RegExp(strRegex);
if (!domain.startsWith("http") || !domain.startsWith("https")) { if (re.test(domain) && domain.length < 26) {
domain += "http://"; return true;
}
url = new URL(domain);
} catch (e) {
this.$warning(this.$t('load_test.input_domain'));
return false
} }
return true; this.$warning(this.$t('load_test.input_domain'));
return false;
}, },
dblHostTable: function (row) { dblHostTable: function (row) {
row.status = 'edit'; row.status = 'edit';

View File

@ -46,7 +46,10 @@
handleRemove(file) { handleRemove(file) {
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
for (let i = 0; i < this.parameter.files.length; i++) { for (let i = 0; i < this.parameter.files.length; i++) {
if (file.file.name === this.parameter.files[i].file.name) { let fileName = file.file ? file.file.name : file.name;
let paramFileName = this.parameter.files[i].file ?
this.parameter.files[i].file.name : this.parameter.files[i].name;
if (fileName === paramFileName) {
this.parameter.files.splice(i, 1); this.parameter.files.splice(i, 1);
this.$refs.upload.handleRemove(file); this.$refs.upload.handleRemove(file);
break; break;

View File

@ -176,7 +176,7 @@
let param = {}; let param = {};
param.planId = this.planId; param.planId = this.planId;
param.testCaseIds = [...this.selectIds]; param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId; param.request = this.condition;
// //
if (this.testCases.length === param.testCaseIds.length) { if (this.testCases.length === param.testCaseIds.length) {
param.testCaseIds = ['all']; param.testCaseIds = ['all'];

View File

@ -5,7 +5,7 @@
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" <ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_name_or_id')"> :show-create="false" :tip="$t('commons.search_by_name_or_id')">
<template v-slot:title> <template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/> <node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="breadcrumbRefresh"/>
</template> </template>
<template v-slot:button> <template v-slot:button>
<ms-table-button :is-tester-permission="true" v-if="!showMyTestCase" icon="el-icon-s-custom" <ms-table-button :is-tester-permission="true" v-if="!showMyTestCase" icon="el-icon-s-custom"
@ -392,6 +392,10 @@ export default {
this.selectRows.clear(); this.selectRows.clear();
this.$emit('refresh'); this.$emit('refresh');
}, },
breadcrumbRefresh() {
this.showMyTestCase = false;
this.refresh();
},
refreshTableAndPlan() { refreshTableAndPlan() {
this.getTestPlanById(); this.getTestPlanById();
this.initTableData(); this.initTableData();

View File

@ -185,7 +185,7 @@
let param = {}; let param = {};
param.reviewId = this.reviewId; param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds]; param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId; param.request = this.condition;
// //
if (this.testReviews.length === param.testCaseIds.length) { if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all']; param.testCaseIds = ['all'];