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>
<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
from test_case
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
left join test_case_review_test_case as T2 on test_case.id=T2.case_id
<where>
<if test="request.combine != null">
<include refid="combine">
@ -107,7 +107,7 @@
<property name="name" value="request.name"/>
</include>
</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">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
@ -152,8 +152,8 @@
</select>
<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
from test_case
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
left join test_plan_test_case as T2 on test_case.id=T2.case_id
<where>
<if test="request.combine != null">
<include refid="combine">
@ -161,7 +161,7 @@
<property name="name" value="request.name"/>
</include>
</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">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>

View File

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

View File

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

View File

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

View File

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

View File

@ -116,17 +116,13 @@
return true;
},
validateDomain(domain) {
let url = {};
try {
if (!domain.startsWith("http") || !domain.startsWith("https")) {
domain += "http://";
}
url = new URL(domain);
} catch (e) {
this.$warning(this.$t('load_test.input_domain'));
return false
}
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+)*$";
const re = new RegExp(strRegex);
if (re.test(domain) && domain.length < 26) {
return true;
}
this.$warning(this.$t('load_test.input_domain'));
return false;
},
dblHostTable: function (row) {
row.status = 'edit';

View File

@ -46,7 +46,10 @@
handleRemove(file) {
this.$refs.upload.handleRemove(file);
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.$refs.upload.handleRemove(file);
break;

View File

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

View File

@ -5,7 +5,7 @@
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_name_or_id')">
<template v-slot:title>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="breadcrumbRefresh"/>
</template>
<template v-slot:button>
<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.$emit('refresh');
},
breadcrumbRefresh() {
this.showMyTestCase = false;
this.refresh();
},
refreshTableAndPlan() {
this.getTestPlanById();
this.initTableData();

View File

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