This commit is contained in:
chenjianxing 2020-10-20 16:48:45 +08:00
commit 8dad580a6a
11 changed files with 76 additions and 79 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

@ -49,43 +49,35 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item :label="$t('api_test.request.refer_to_environment')">
<el-switch <el-switch
v-model="request.useEnvironment" v-model="request.useEnvironment"
:active-text="$t('api_test.request.refer_to_environment')"
@change="useEnvironmentChange"> @change="useEnvironmentChange">
</el-switch> </el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-switch <el-checkbox v-model="request.reUseConnection"/>
v-model="request.reUseConnection"
:active-text="$t('api_test.request.tcp.re_use_connection')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-switch <el-checkbox v-model="request.closeConnection"/>
v-model="request.closeConnection"
:active-text="$t('api_test.request.tcp.close_connection')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-switch <el-checkbox v-model="request.nodelay"/>
v-model="request.nodelay"
:active-text="$t('api_test.request.tcp.no_delay')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item :label="$t('api_test.request.tcp.request')" prop="request"> <el-form-item :label="$t('api_test.request.tcp.request')" prop="request">
<el-input type="textarea" v-model="request.request" :autosize="{minRows: 4, maxRows: 6}"> <div class="send-request">
</el-input> <ms-code-edit mode="text" :read-only="isReadOnly" :data.sync="request.request"
:modes="['text', 'json', 'xml', 'html']" theme="eclipse"/>
</div>
</el-form-item> </el-form-item>
<el-row :gutter="10"> <el-row :gutter="10">
@ -128,10 +120,11 @@ import {Scenario, TCPConfig, TCPRequest} from "@/business/components/api/test/mo
import MsApiAssertions from "@/business/components/api/test/components/assertion/ApiAssertions"; import MsApiAssertions from "@/business/components/api/test/components/assertion/ApiAssertions";
import MsApiExtract from "@/business/components/api/test/components/extract/ApiExtract"; import MsApiExtract from "@/business/components/api/test/components/extract/ApiExtract";
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor"; import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
export default { export default {
name: "MsApiTcpRequestForm", name: "MsApiTcpRequestForm",
components: {MsJsr233Processor, MsApiExtract, MsApiAssertions}, components: {MsCodeEdit, MsJsr233Processor, MsApiExtract, MsApiAssertions},
props: { props: {
request: TCPRequest, request: TCPRequest,
scenario: Scenario, scenario: Scenario,
@ -144,15 +137,7 @@ export default {
return { return {
activeName: "assertions", activeName: "assertions",
classes: TCPConfig.CLASSES, classes: TCPConfig.CLASSES,
rules: { rules: {}
server: [
{
required: true,
message: this.$t('commons.required', [this.$t('api_test.request.tcp.server')]),
trigger: 'blur'
}
],
}
} }
}, },
@ -175,4 +160,9 @@ export default {
.tcp >>> .el-input-number { .tcp >>> .el-input-number {
width: 100%; width: 100%;
} }
.send-request {
padding: 15px 0;
height: 300px;
}
</style> </style>

View File

@ -22,22 +22,25 @@
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6"> <el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.connect')" prop="ctimeout"> <el-form-item :label="$t('api_test.request.tcp.connect')" prop="ctimeout">
<el-input-number v-model="config.ctimeout" controls-position="right" :min="0" :step="1000" :controls="false"/> <el-input-number v-model="config.ctimeout" controls-position="right" :min="0" :step="1000" :controls="false"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.response')" prop="timeout"> <el-form-item :label="$t('api_test.request.tcp.response')" prop="timeout">
<el-input-number v-model="config.timeout" controls-position="right" :min="0" :step="1000" :controls="false"/> <el-input-number v-model="config.timeout" controls-position="right" :min="0" :step="1000" :controls="false"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> </el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.so_linger')" prop="soLinger"> <el-form-item :label="$t('api_test.request.tcp.so_linger')" prop="soLinger">
<el-input v-model="config.soLinger"/> <el-input v-model="config.soLinger"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.eol_byte')" prop="eolByte"> <el-form-item :label="$t('api_test.request.tcp.eol_byte')" prop="eolByte">
<el-input v-model="config.eolByte"/> <el-input v-model="config.eolByte"/>
</el-form-item> </el-form-item>
@ -46,27 +49,18 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="8"> <el-col :span="8">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-switch <el-checkbox v-model="config.reUseConnection"/>
v-model="config.reUseConnection"
:active-text="$t('api_test.request.tcp.re_use_connection')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-switch <el-checkbox v-model="config.closeConnection"/>
v-model="config.closeConnection"
:active-text="$t('api_test.request.tcp.close_connection')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item> <el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-switch <el-checkbox v-model="config.nodelay"/>
v-model="config.nodelay"
:active-text="$t('api_test.request.tcp.no_delay')">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

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

@ -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'];

@ -1 +1 @@
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1 Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9