Merge remote-tracking branch 'remotes/origin/jmx-convert' into local-api-delimit

# Conflicts:
#	backend/src/main/java/io/metersphere/api/dto/scenario/KeyValue.java
#	backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java
#	frontend/src/business/components/api/test/ApiTestConfig.vue
#	frontend/src/business/components/api/test/model/ScenarioModel.js
This commit is contained in:
fit2-zhao 2020-11-13 10:44:03 +08:00
parent fccabe6311
commit 1a7d70a142
4 changed files with 41 additions and 25 deletions

View File

@ -1,7 +1,5 @@
package io.metersphere.api.controller; package io.metersphere.api.controller;
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.*; import io.metersphere.api.dto.*;
@ -21,10 +19,11 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
@RestController @RestController

View File

@ -146,34 +146,34 @@
</sql> </sql>
<select id="list" resultType="io.metersphere.api.dto.delimit.ApiTestCaseResult"> <select id="list" resultType="io.metersphere.api.dto.delimit.ApiTestCaseResult">
select api_test_case.id, api_test_case.project_id, select atc.id, atc.project_id,
api_test_case.name,api_test_case.priority,api_test_case.api_delimit_id,T1.name as createUser ,T2.name as atc.name,atc.priority,atc.api_delimit_id,T1.name as createUser ,T2.name as updateUser,
updateUser, atc.description,atc.request,atc.response,atc.create_user_id,
api_test_case.description,api_test_case.request,api_test_case.response,api_test_case.create_user_id, atc.create_time,atc.update_user_id, atc.update_time,ader.status execResult
api_test_case.create_time,api_test_case.update_user_id, api_test_case.update_time from api_test_case atc left join user T1 on atc.create_user_id = T1.id left join user T2 on
from api_test_case left join user T1 on api_test_case.create_user_id = T1.id left join user T2 on atc.update_user_id = T2.id left join api_delimit_exec_result ader on atc.id = ader.resource_id
api_test_case.update_user_id = T2.id
<where> <where>
<if test="request.name != null and request.name!=''"> <if test="request.name != null and request.name!=''">
and api_test_case.name like CONCAT('%', #{request.name},'%')
and atc.name like CONCAT('%', #{request.name},'%')
</if> </if>
<if test="request.id != null and request.id!=''"> <if test="request.id != null and request.id!=''">
AND api_test_case.id = #{request.id} AND atc.id = #{request.id}
</if> </if>
<if test="request.priority != null and request.priority!=''"> <if test="request.priority != null and request.priority!=''">
AND api_test_case.priority = #{request.priority} AND atc.priority = #{request.priority}
</if> </if>
<if test="request.projectId != null and request.projectId!=''"> <if test="request.projectId != null and request.projectId!=''">
AND api_test_case.project_id = #{request.projectId} AND atc.project_id = #{request.projectId}
</if> </if>
<if test="request.apiDelimitId != null and request.apiDelimitId!=''"> <if test="request.apiDelimitId != null and request.apiDelimitId!=''">
AND api_test_case.api_delimit_id = #{request.apiDelimitId} AND atc.api_delimit_id = #{request.apiDelimitId}
</if> </if>
</where> </where>
<if test="request.orders != null and request.orders.size() > 0"> <if test="request.orders != null and request.orders.size() > 0">
order by order by
<foreach collection="request.orders" separator="," item="order"> <foreach collection="request.orders" separator="," item="order">
api_test_case.${order.name} ${order.type} atc.${order.name} ${order.type}
</foreach> </foreach>
</if> </if>
</select> </select>

View File

@ -39,7 +39,7 @@
"vue-pdf": "^4.2.0", "vue-pdf": "^4.2.0",
"diffable-html": "^4.0.0", "diffable-html": "^4.0.0",
"xml-js": "^1.6.11", "xml-js": "^1.6.11",
"jsoneditor": "^9.1.2", "jsoneditor": "^9.1.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",

View File

@ -61,16 +61,27 @@
</div> </div>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<div class="ms-api-header-select"> <!--<div class="ms-api-header-select">-->
<el-button size="small" style="background-color: #783887;color: white" @click="createCase"> <!--<el-button size="small" style="background-color: #783887;color: white" @click="createCase">-->
+{{$t('api_test.delimit.request.case')}} <!--+{{$t('api_test.delimit.request.case')}}-->
</el-button> <!--</el-button>-->
</div> <!--</div>-->
<el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="createCase"
@command="handleCommand">
+{{$t('api_test.delimit.request.case')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="run">{{$t('commons.test')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<button type="button" aria-label="Close" class="el-card-btn" @click="apiCaseClose()"><i <button type="button" aria-label="Close" class="el-card-btn" @click="apiCaseClose()"><i
class="el-dialog__close el-icon el-icon-close"></i></button> class="el-dialog__close el-icon el-icon-close"></i></button>
</el-col> </el-col>
</el-row> </el-row>
</el-card> </el-card>
@ -123,7 +134,7 @@
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<div v-if="item.type!='create'">{{getResult(item.execute_result)}}</div> <div v-if="item.type!='create'">{{getResult(item.execResult)}}</div>
<div v-if="item.type!='create'" style="color: #999999;font-size: 12px"> <div v-if="item.type!='create'" style="color: #999999;font-size: 12px">
<span> {{item.updateTime | timestampFormatDate }}</span> <span> {{item.updateTime | timestampFormatDate }}</span>
{{item.updateUser}} {{item.updateUser}}
@ -215,14 +226,19 @@
}, },
methods: { methods: {
getResult(data) { getResult(data) {
if (data === 'PASS') { if (data === 'success') {
return '执行结果:通过'; return '执行结果:通过';
} else if (data === 'UN_PASS') { } else if (data === 'error') {
return '执行结果:未通过'; return '执行结果:未通过';
} else { } else {
return '执行结果:未执行'; return '执行结果:未执行';
} }
}, },
handleCommand(e) {
if (e === "run") {
this.runCase();
}
},
showInput(row) { showInput(row) {
row.type = "create"; row.type = "create";
row.active = true; row.active = true;
@ -446,6 +462,7 @@
.ms-api-header-select { .ms-api-header-select {
margin-left: 20px; margin-left: 20px;
min-width: 100px;
} }
.el-card-btn { .el-card-btn {