Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-01-21 15:22:32 +08:00
commit d97772a36a
8 changed files with 85 additions and 66 deletions

View File

@ -238,7 +238,7 @@
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
select
atc.id, atc.project_id, atc.name, atc.api_definition_id, atc.priority, atc.description, atc.create_user_id, atc.update_user_id, atc.create_time, atc.update_time, atc.num,
a.module_id, a.path, a.protocol
a.module_id, a.path, a.protocol, atc.tags
from
api_test_case atc
inner join
@ -279,7 +279,7 @@
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and atc.name like CONCAT('%', #{request.name},'%')
and (atc.name like CONCAT('%', #{request.name},'%') or atc.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.createTime > 0">
and atc.create_time >= #{request.createTime}

View File

@ -54,7 +54,7 @@
</foreach>
</if>
<if test="request.name != null and request.name!=''">
and c.name like CONCAT('%', #{request.name},'%')
and (c.name like CONCAT('%', #{request.name},'%') or c.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
and a.module_id in

View File

@ -105,7 +105,7 @@ public class ShiroDBRealm extends AuthorizingRealm {
if (user == null) {
msg = "The user does not exist: " + userId;
logger.warn(msg);
throw new UnknownAccountException(Translator.get("password_is_incorrect") + userId);
throw new UnknownAccountException(Translator.get("password_is_incorrect"));
}
}
return user;
@ -119,7 +119,7 @@ public class ShiroDBRealm extends AuthorizingRealm {
if (user == null) {
msg = "The user does not exist: " + userId;
logger.warn(msg);
throw new UnknownAccountException(Translator.get("password_is_incorrect") + userId);
throw new UnknownAccountException(Translator.get("password_is_incorrect"));
}
userId = user.getId();
}

View File

@ -218,7 +218,6 @@
import MsApiReportDetail from "../report/ApiReportDetail";
import MsVariableList from "./variable/VariableList";
import ApiImport from "../../definition/components/import/ApiImport";
import InputTag from 'vue-input-tag'
import "@/common/css/material-icons.css"
import OutsideClick from "@/common/js/outside-click";
import ScenarioApiRelevance from "./api/ApiRelevance";
@ -240,7 +239,6 @@
MsInputTag, MsRun,
MsApiCustomize,
ApiImport,
InputTag,
MsComponentConfig,
},
data() {

View File

@ -50,16 +50,8 @@
@setEnvironment="setEnvironment"/>
</div>
</el-col>
<el-col :span="1" v-if="!(isReadOnly || isCaseEdit)">
<el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="addCase"
@command="handleCommand" v-tester>
+{{$t('api_test.definition.request.case')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="run">{{$t('api_test.automation.batch_execute')}}</el-dropdown-item>
<el-dropdown-item command="batch_edit_case">{{$t('test_track.case.batch_edit_case')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button size="small" type="primary" @click="addCase">+{{$t('api_test.definition.request.case')}}</el-button>
</el-col>
</el-row>
</el-card>
@ -166,14 +158,6 @@
addCase() {
this.$emit('addCase');
},
handleCommand(e) {
if (e === "run") {
this.$emit('batchRun');
}
if (e === 'batch_edit_case') {
this.$emit('batchEditCase');
}
},
getColor(enable, method) {
if (enable) {
return this.methodColorMap.get(method);

View File

@ -3,17 +3,23 @@
<div @click="active(apiCase)">
<el-row>
<el-col :span="5">
<el-checkbox class="item-select" v-model="apiCase.selected"/>
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{ index + 1 }}</div>
</div>
<label class="ms-api-label">{{ $t('test_track.case.priority') }}</label>
<el-select size="small" v-model="apiCase.priority" class="ms-api-select" @change="changePriority(apiCase)">
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
</el-select>
<el-row>
<el-col :span="2" style="margin-top: 5px">
<el-checkbox class="item-select" v-model="apiCase.selected"/>
</el-col>
<el-col :span="2" style="margin-top: 2px">
<show-more-btn :is-show="apiCase.selected" :buttons="buttons"/>
</el-col>
<el-col :span="20">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">{{ index + 1 }}</div>
</div>
<label class="ms-api-label">{{ $t('test_track.case.priority') }}</label>
<el-select size="small" v-model="apiCase.priority" class="ms-api-select" @change="changePriority(apiCase)">
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
</el-select>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
@ -41,7 +47,7 @@
<el-col :span="4">
<div class="tag-item">
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase)"/>
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase)"/>
</div>
</el-col>
@ -114,6 +120,7 @@
import MsRequestResultTail from "../response/RequestResultTail";
import MsJmxStep from "../step/JmxStep";
import ApiResponseComponent from "../../../automation/scenario/component/ApiResponseComponent";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
export default {
name: "ApiCaseItem",
@ -130,7 +137,8 @@
MsDubboBasisParameters,
MsApiExtendBtns,
MsRequestResultTail,
MsJmxStep
MsJmxStep,
ShowMoreBtn
},
data() {
return {
@ -146,6 +154,10 @@
condition: {},
responseData: {type: 'HTTP', responseResult: {}, subRequestResults: []},
isShowInput: false,
buttons: [
{name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleRunBatch},
{name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleEditBatch}
],
}
},
props: {
@ -172,6 +184,12 @@
},
watch: {},
methods: {
handleRunBatch() {
this.$emit('batchRun');
},
handleEditBatch() {
this.$emit('batchEditCase');
},
deleteCase(index, row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
@ -327,6 +345,12 @@
margin-right: 10px;
}
.ms-opt-btn {
position: fixed;
left: 60px;
z-index: 1;
}
.tag-item {
margin-right: 20px;
}

View File

@ -7,9 +7,7 @@
@getApiTest="getApiTest"
@setEnvironment="setEnvironment"
@addCase="addCase"
@batchRun="batchRun"
@selectAll="selectAll"
@batchEditCase="batchEditCase"
:condition="condition"
:priorities="priorities"
:apiCaseList="apiCaseList"
@ -28,6 +26,8 @@
@singleRun="singleRun"
@copyCase="copyCase"
@showExecResult="showExecResult"
@batchEditCase="batchEditCase"
@batchRun="batchRun"
:environment="environment"
:is-case-edit="isCaseEdit"
:api="api"

View File

@ -51,6 +51,14 @@
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column prop="tags" :label="$t('commons.tag')">
<template v-slot:default="scope">
<div v-for="(itemName,index) in scope.row.tags" :key="index">
<ms-tag type="success" effect="plain" :content="itemName"/>
</div>
</template>
</el-table-column>
<el-table-column
prop="createUser"
:label="'创建人'"
@ -100,35 +108,34 @@
<script>
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
import MsTablePagination from "../../../../common/pagination/TablePagination";
import MsTag from "../../../../common/components/MsTag";
import MsApiCaseList from "../case/ApiCaseList";
import ApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../basis/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, REQ_METHOD} from "../../model/JsonData";
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import ApiCaseList from "../case/ApiCaseList";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
import MsSetEnvironment from "@/business/components/api/definition/components/basis/SetEnvironment";
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
import {getBodyUploadFiles, getCurrentProjectID} from "@/common/js/utils";
import ApiListContainer from "./ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsApiCaseTableExtendBtns from "../reference/ApiCaseTableExtendBtns";
import MsReferenceView from "../reference/ReferenceView";
import MsSetEnvironment from "@/business/components/api/definition/components/basis/SetEnvironment";
import TestPlan from "@/business/components/api/definition/components/jmeter/components/test-plan";
import ThreadGroup from "@/business/components/api/definition/components/jmeter/components/thread-group";
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import {API_CASE_CONFIGS} from "@/business/components/common/components/search/search-components";
export default {
export default {
name: "ApiCaseSimpleList",
components: {
MsTableSelectAll,
@ -290,6 +297,12 @@
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.unSelection = response.data.listObject.map(s => s.id);
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
})
});
}
},