refactor: 统一显示标签
This commit is contained in:
parent
73f09844bb
commit
67c71ff01a
|
@ -6,6 +6,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -24,7 +25,7 @@ public class ApiBatchRequest extends ApiDefinitionWithBLOBs {
|
|||
*/
|
||||
private boolean isSelectAllDate;
|
||||
|
||||
private List<String> filters;
|
||||
private Map<String, List<String>> filters;
|
||||
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 接口定义模块-批量处理请求类
|
||||
|
@ -24,7 +25,7 @@ public class ApiDefinitionBatchProcessingRequest {
|
|||
*/
|
||||
private boolean isSelectAllDate;
|
||||
|
||||
private List<String> filters;
|
||||
private Map<String, List<String>> filters;
|
||||
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ApiDefinitionRequest {
|
|||
private String planId;
|
||||
private boolean recent = false;
|
||||
private List<OrderRequest> orders;
|
||||
private List<String> filters;
|
||||
private Map<String, List<String>> filters;
|
||||
private Map<String, Object> combine;
|
||||
private List<String> ids;
|
||||
private boolean isSelectThisWeedData = false;
|
||||
|
|
|
@ -6,7 +6,6 @@ import io.metersphere.base.domain.Schedule;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Setter
|
||||
|
@ -49,5 +48,5 @@ public class SaveApiDefinitionRequest {
|
|||
|
||||
private List<String> bodyUploadIds;
|
||||
|
||||
private List<String> tags = new ArrayList<>();
|
||||
private String tags;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import io.metersphere.api.dto.definition.request.MsTestElement;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Setter
|
||||
|
@ -37,5 +36,5 @@ public class SaveApiTestCaseRequest {
|
|||
|
||||
private List<String> bodyUploadIds;
|
||||
|
||||
private List<String> tags = new ArrayList<>();
|
||||
private String tags;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.i18n.Translator;
|
||||
|
@ -235,7 +234,7 @@ public class ApiDefinitionService {
|
|||
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
||||
test.setEnvironmentId(request.getEnvironmentId());
|
||||
test.setUserId(request.getUserId());
|
||||
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||
test.setTags(request.getTags());
|
||||
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(test);
|
||||
return test;
|
||||
|
@ -266,7 +265,7 @@ public class ApiDefinitionService {
|
|||
test.setUserId(request.getUserId());
|
||||
}
|
||||
test.setDescription(request.getDescription());
|
||||
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||
test.setTags(request.getTags());
|
||||
apiDefinitionMapper.insert(test);
|
||||
return test;
|
||||
}
|
||||
|
@ -342,6 +341,7 @@ public class ApiDefinitionService {
|
|||
|
||||
/**
|
||||
* 内部构建HashTree 定时任务发起的执行
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
|
@ -362,12 +362,14 @@ public class ApiDefinitionService {
|
|||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
new TypeReference<LinkedList<MsTestElement>>() {});
|
||||
new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
scenario.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||
new TypeReference<LinkedList<KeyValue>>() {});
|
||||
new TypeReference<LinkedList<KeyValue>>() {
|
||||
});
|
||||
scenario.setVariables(variables);
|
||||
}
|
||||
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||
|
@ -572,9 +574,9 @@ public class ApiDefinitionService {
|
|||
apiDefinitionMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
private List<String> getAllApiIdsByFontedSelect(List<String> filter, String name, List<String> moduleIds, String projectId, List<String> unSelectIds) {
|
||||
private List<String> getAllApiIdsByFontedSelect(Map<String, List<String>> filters, String name, List<String> moduleIds, String projectId, List<String> unSelectIds) {
|
||||
ApiDefinitionRequest request = new ApiDefinitionRequest();
|
||||
request.setFilters(filter);
|
||||
request.setFilters(filters);
|
||||
request.setName(name);
|
||||
request.setModuleIds(moduleIds);
|
||||
request.setProjectId(projectId);
|
||||
|
|
|
@ -222,7 +222,7 @@ public class ApiTestCaseService {
|
|||
test.setPriority(request.getPriority());
|
||||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setDescription(request.getDescription());
|
||||
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||
test.setTags(request.getTags());
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(test);
|
||||
return test;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public class ApiTestCaseService {
|
|||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setDescription(request.getDescription());
|
||||
test.setNum(getNextNum(request.getApiDefinitionId()));
|
||||
test.setTags(JSON.toJSONString(new HashSet<>(request.getTags())));
|
||||
test.setTags(request.getTags());
|
||||
apiTestCaseMapper.insert(test);
|
||||
return test;
|
||||
}
|
||||
|
|
|
@ -243,10 +243,18 @@
|
|||
</foreach>
|
||||
</if>
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
<choose>
|
||||
<when test="key=='status'">
|
||||
and api_definition.status in
|
||||
<foreach collection="request.filters" item="value" separator="," open="(" close=")">
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiCaseCoverage == 'uncoverage' ">
|
||||
and api_definition.id not in
|
||||
|
|
|
@ -16,5 +16,4 @@ public class EditTestCaseRequest extends TestCaseWithBLOBs {
|
|||
* 复制测试用例后,要进行复制的文件Id list
|
||||
*/
|
||||
private List<String> fileIds = new ArrayList<>();
|
||||
private List<String> caseTags = new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -585,7 +585,6 @@ public class TestCaseService {
|
|||
throw new IllegalArgumentException(Translator.get("file_cannot_be_null"));
|
||||
}
|
||||
|
||||
request.setTags(JSON.toJSONString(new HashSet<>(request.getCaseTags())));
|
||||
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
|
||||
|
||||
// 复制用例时传入文件ID进行复制
|
||||
|
@ -642,7 +641,6 @@ public class TestCaseService {
|
|||
});
|
||||
}
|
||||
|
||||
request.setTags(JSON.toJSONString(new HashSet<>(request.getCaseTags())));
|
||||
editTestCase(request);
|
||||
return request.getId();
|
||||
}
|
||||
|
|
|
@ -24,26 +24,7 @@
|
|||
|
||||
|
||||
<label class="ms-api-label" style="padding-left: 20px; padding-right: 20px;">{{ $t('commons.tag') }}</label>
|
||||
<el-tag
|
||||
:key="apiCase.id + '_' + index"
|
||||
v-for="(tag, index) in apiCase.tags"
|
||||
closable
|
||||
size="mini"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="inputVisible"
|
||||
v-model="inputValue"
|
||||
ref="saveTagInput"
|
||||
size="mini"
|
||||
@keyup.enter.native="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="mini" @click="showTagInput">+</el-button>
|
||||
<ms-input-tag :currentScenario="apiCase" ref="tag" style="float: right;margin-right: 215px;margin-top: -3px;"/>
|
||||
|
||||
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
||||
<span>
|
||||
|
@ -112,10 +93,12 @@ import MsSqlBasisParameters from "../request/database/BasisParameters";
|
|||
import MsTcpBasisParameters from "../request/tcp/BasisParameters";
|
||||
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseItem",
|
||||
components: {
|
||||
MsInputTag,
|
||||
MsTag,
|
||||
MsTipButton,
|
||||
MsApiRequestForm,
|
||||
|
@ -139,8 +122,6 @@ export default {
|
|||
visible: false,
|
||||
condition: {},
|
||||
isShowInput: false,
|
||||
inputVisible: false,
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -213,21 +194,25 @@ export default {
|
|||
}
|
||||
},
|
||||
saveTestCase(row) {
|
||||
let tmp = JSON.parse(JSON.stringify(row));
|
||||
this.isShowInput = false;
|
||||
if (this.validate(row)) {
|
||||
if (this.validate(tmp)) {
|
||||
return;
|
||||
}
|
||||
let bodyFiles = this.getBodyUploadFiles(row);
|
||||
row.projectId = getCurrentProjectID();
|
||||
row.active = true;
|
||||
row.request.path = this.api.path;
|
||||
row.request.method = this.api.method;
|
||||
row.apiDefinitionId = row.apiDefinitionId || this.api.id;
|
||||
let bodyFiles = this.getBodyUploadFiles(tmp);
|
||||
tmp.projectId = getCurrentProjectID();
|
||||
tmp.active = true;
|
||||
tmp.request.path = this.api.path;
|
||||
tmp.request.method = this.api.method;
|
||||
tmp.apiDefinitionId = tmp.apiDefinitionId || this.api.id;
|
||||
let url = "/api/testcase/create";
|
||||
if (row.id) {
|
||||
if (tmp.id) {
|
||||
url = "/api/testcase/update";
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, row, () => {
|
||||
if (tmp.tags instanceof Array) {
|
||||
tmp.tags = JSON.stringify(tmp.tags);
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, tmp, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('refresh');
|
||||
});
|
||||
|
@ -293,28 +278,6 @@ export default {
|
|||
}
|
||||
return bodyUploadFiles;
|
||||
},
|
||||
handleClose(tag) {
|
||||
this.apiCase.tags.splice(this.apiCase.tags.indexOf(tag), 1);
|
||||
this.saveTestCase(this.apiCase)
|
||||
},
|
||||
|
||||
showTagInput() {
|
||||
this.inputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInput.$refs.input.focus();
|
||||
});
|
||||
},
|
||||
|
||||
handleInputConfirm() {
|
||||
let inputValue = this.inputValue;
|
||||
if (inputValue) {
|
||||
this.apiCase.tags.push(inputValue);
|
||||
this.saveTestCase(this.apiCase)
|
||||
}
|
||||
this.inputVisible = false;
|
||||
this.inputValue = '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -356,22 +319,4 @@ export default {
|
|||
.is-selected {
|
||||
background: #EFF7FF;
|
||||
}
|
||||
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
margin-left: 10px;
|
||||
height: 20px;
|
||||
/*line-height: 30px;*/
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.input-new-tag {
|
||||
width: 90px;
|
||||
margin-left: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -177,9 +177,7 @@ export default {
|
|||
this.addCase();
|
||||
}
|
||||
this.apiCaseList.forEach(apiCase => {
|
||||
if (!apiCase.tags) {
|
||||
apiCase.tags = [];
|
||||
} else {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<el-option :key="0" :value="''">
|
||||
<div style="margin-left: 40px">
|
||||
<span style="font-size: 14px;color: #606266;font-weight: 48.93">{{ $t('api_test.definition.select_comp.no_data') }},
|
||||
</span><el-link type="primary" @click="createModules">{{$t('api_test.definition.select_comp.add_data')}}</el-link>
|
||||
</span>
|
||||
<el-link type="primary" @click="createModules">{{ $t('api_test.definition.select_comp.add_data') }}</el-link>
|
||||
</div>
|
||||
</el-option>
|
||||
</div>
|
||||
|
@ -54,27 +55,7 @@
|
|||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('commons.tag')" prop="tag">
|
||||
<el-tag
|
||||
:key="basicForm + '_' + index"
|
||||
v-for="(tag, index) in basicForm.tags"
|
||||
closable
|
||||
size="mini"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="inputVisible"
|
||||
v-model="inputValue"
|
||||
ref="saveTagInput"
|
||||
size="mini"
|
||||
@keyup.enter.native="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||
|
||||
<ms-input-tag :currentScenario="basicForm" ref="tag"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
|
@ -94,10 +75,11 @@
|
|||
<script>
|
||||
import {API_STATUS} from "../../model/JsonData";
|
||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
|
||||
export default {
|
||||
name: "MsBasisApi",
|
||||
components: {},
|
||||
components: {MsInputTag},
|
||||
props: {
|
||||
currentProtocol: {
|
||||
type: String,
|
||||
|
@ -108,11 +90,6 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.getMaintainerOptions();
|
||||
if (!this.basisData.tags) {
|
||||
this.basisData.tags = [];
|
||||
} else {
|
||||
this.basisData.tags = JSON.parse(this.basisData.tags);
|
||||
}
|
||||
this.basicForm = this.basisData;
|
||||
},
|
||||
data() {
|
||||
|
@ -133,8 +110,6 @@ export default {
|
|||
},
|
||||
value: API_STATUS[0].id,
|
||||
options: API_STATUS,
|
||||
inputVisible: false,
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -160,45 +135,9 @@ export default {
|
|||
createModules() {
|
||||
this.$emit("createRootModelInTree");
|
||||
},
|
||||
handleClose(tag) {
|
||||
this.basicForm.tags.splice(this.basicForm.tags.indexOf(tag), 1);
|
||||
},
|
||||
|
||||
showInput() {
|
||||
this.inputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInput.$refs.input.focus();
|
||||
});
|
||||
},
|
||||
|
||||
handleInputConfirm() {
|
||||
let inputValue = this.inputValue;
|
||||
if (inputValue) {
|
||||
this.basicForm.tags.push(inputValue);
|
||||
}
|
||||
this.inputVisible = false;
|
||||
this.inputValue = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
margin-left: 10px;
|
||||
height: 20px;
|
||||
/*line-height: 30px;*/
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.input-new-tag {
|
||||
width: 90px;
|
||||
margin-left: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
<br/>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm" @callback="callback"/>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm"
|
||||
@callback="callback"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
@ -62,6 +63,9 @@
|
|||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
console.log(this.basisData)
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -77,27 +77,7 @@
|
|||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('commons.tag')" prop="tag">
|
||||
<el-tag
|
||||
:key="httpForm + '_' + index"
|
||||
v-for="(tag, index) in httpForm.tags"
|
||||
closable
|
||||
size="mini"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="inputVisible"
|
||||
v-model="inputValue"
|
||||
ref="saveTagInput"
|
||||
size="mini"
|
||||
@keyup.enter.native="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||
|
||||
<ms-input-tag :currentScenario="httpForm" ref="tag"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
|
@ -134,10 +114,11 @@ import {WORKSPACE_ID} from '../../../../../../common/js/constants';
|
|||
import {API_STATUS, REQ_METHOD} from "../../model/JsonData";
|
||||
import MsJsr233Processor from "../processor/Jsr233Processor";
|
||||
import {KeyValue} from "../../model/ApiTestModel";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
|
||||
export default {
|
||||
name: "MsAddCompleteHttpApi",
|
||||
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor},
|
||||
components: {MsResponseText, MsApiRequestForm, MsJsr233Processor, MsInputTag},
|
||||
data() {
|
||||
let validateURL = (rule, value, callback) => {
|
||||
if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) {
|
||||
|
@ -165,8 +146,6 @@ export default {
|
|||
currentModule: {},
|
||||
reqOptions: REQ_METHOD,
|
||||
options: API_STATUS,
|
||||
inputVisible: false,
|
||||
inputValue: ''
|
||||
}
|
||||
},
|
||||
props: {moduleOptions: {}, request: {}, response: {}, basisData: {}},
|
||||
|
@ -192,6 +171,9 @@ export default {
|
|||
this.request.path = this.httpForm.path;
|
||||
this.request.method = this.httpForm.method;
|
||||
this.httpForm.request.useEnvironment = undefined;
|
||||
if (this.httpForm.tags instanceof Array) {
|
||||
this.httpForm.tags = JSON.stringify(this.httpForm.tags);
|
||||
}
|
||||
},
|
||||
saveApi() {
|
||||
this.$refs['httpForm'].validate((valid) => {
|
||||
|
@ -243,26 +225,6 @@ export default {
|
|||
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||
}
|
||||
},
|
||||
|
||||
handleClose(tag) {
|
||||
this.httpForm.tags.splice(this.httpForm.tags.indexOf(tag), 1);
|
||||
},
|
||||
|
||||
showInput() {
|
||||
this.inputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInput.$refs.input.focus();
|
||||
});
|
||||
},
|
||||
|
||||
handleInputConfirm() {
|
||||
let inputValue = this.inputValue;
|
||||
if (inputValue) {
|
||||
this.httpForm.tags.push(inputValue);
|
||||
}
|
||||
this.inputVisible = false;
|
||||
this.inputValue = '';
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
@ -270,11 +232,6 @@ export default {
|
|||
if (!this.basisData.environmentId) {
|
||||
this.basisData.environmentId = "";
|
||||
}
|
||||
if (!this.basisData.tags) {
|
||||
this.basisData.tags = [];
|
||||
} else {
|
||||
this.basisData.tags = JSON.parse(this.basisData.tags);
|
||||
}
|
||||
|
||||
this.httpForm = JSON.parse(JSON.stringify(this.basisData));
|
||||
}
|
||||
|
@ -314,22 +271,4 @@ export default {
|
|||
.ms-left-buttion {
|
||||
margin: 6px 0px 8px 30px;
|
||||
}
|
||||
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
margin-left: 10px;
|
||||
height: 20px;
|
||||
/*line-height: 30px;*/
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.input-new-tag {
|
||||
width: 90px;
|
||||
margin-left: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
<br/>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm" @callback="callback"/>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm"
|
||||
@callback="callback"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
@ -60,6 +61,9 @@
|
|||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.method = this.basisData.protocol;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
<br/>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm" @callback="callback"/>
|
||||
<ms-basis-api @createRootModelInTree="createRootModelInTree" :moduleOptions="moduleOptions" :basisData="basisData" ref="basicForm"
|
||||
@callback="callback"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
@ -61,6 +62,9 @@
|
|||
saveApi() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
<el-table v-loading="result.loading"
|
||||
ref="apiDefinitionTable"
|
||||
border
|
||||
@sort-change="sort"
|
||||
@filter-change="filter"
|
||||
:data="tableData" row-key="id" class="test-content adjust-table ms-select-all"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelect" :height="screenHeight">
|
||||
|
@ -27,18 +29,21 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="num" label="ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
|
||||
<el-table-column prop="num" label="ID" show-overflow-tooltip
|
||||
sortable="custom"/>
|
||||
<el-table-column prop="name" :label="$t('api_test.definition.api_name')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"/>
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="api_status"
|
||||
:label="$t('api_test.definition.api_status')"
|
||||
show-overflow-tooltip>
|
||||
column-key="status"
|
||||
sortable="custom"
|
||||
:filters="statusFilters"
|
||||
:label="$t('api_test.definition.api_status')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-if="scope.row.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
|
||||
<ms-tag v-if="scope.row.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
|
||||
<ms-tag v-if="scope.row.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
|
||||
<ms-tag v-if="scope.row.status == 'Trash'" type="danger" effect="plain" content="废弃"/>
|
||||
<span class="el-dropdown-link">
|
||||
<api-status :value="scope.row.status"/>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -66,10 +71,9 @@
|
|||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||
:key="tag + '_' + index"
|
||||
:effect="'light'"
|
||||
:content="tag"/>
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -128,14 +132,16 @@ import MsBottomContainer from "../BottomContainer";
|
|||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, API_STATUS, REQ_METHOD} from "../../model/JsonData";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import {_filter, _sort, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import ApiListContainer from "./ApiListContainer";
|
||||
import MsTableSelectAll from "../../../../common/components/table/MsTableSelectAll";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
|
||||
export default {
|
||||
name: "ApiList",
|
||||
components: {
|
||||
ApiStatus,
|
||||
MsTableSelectAll,
|
||||
ApiListContainer,
|
||||
MsTableButton,
|
||||
|
@ -168,6 +174,12 @@ export default {
|
|||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'userId', name: this.$t('api_test.definition.api_principal')},
|
||||
],
|
||||
statusFilters: [
|
||||
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
|
||||
{text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'},
|
||||
{text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'},
|
||||
{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'},
|
||||
],
|
||||
valueArr: {
|
||||
status: API_STATUS,
|
||||
method: REQ_METHOD,
|
||||
|
@ -208,6 +220,7 @@ export default {
|
|||
},
|
||||
},
|
||||
created: function () {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
this.initTable();
|
||||
this.getMaintainerOptions();
|
||||
},
|
||||
|
@ -220,8 +233,12 @@ export default {
|
|||
},
|
||||
trashEnable() {
|
||||
if (this.trashEnable) {
|
||||
this.initTable();
|
||||
this.condition.filters = {status: ["Trash"]};
|
||||
this.condition.moduleIds = [];
|
||||
} else {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
}
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -235,14 +252,8 @@ export default {
|
|||
this.unSelection = [];
|
||||
this.selectDataCounts = 0;
|
||||
|
||||
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
||||
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (this.trashEnable) {
|
||||
this.condition.filters = ["Trash"];
|
||||
this.condition.moduleIds = [];
|
||||
}
|
||||
|
||||
this.condition.projectId = getCurrentProjectID();
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
|
@ -256,15 +267,6 @@ export default {
|
|||
case 'thisWeekCount':
|
||||
this.condition.selectThisWeedData = true;
|
||||
break;
|
||||
case 'Prepare':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'Completed':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'Underway':
|
||||
this.condition.filters = [this.selectDataRange];
|
||||
break;
|
||||
case 'uncoverage':
|
||||
this.condition.apiCaseCoverage = 'uncoverage';
|
||||
break;
|
||||
|
@ -278,8 +280,10 @@ export default {
|
|||
this.tableData = response.data.listObject;
|
||||
this.unSelection = response.data.listObject.map(s => s.id);
|
||||
|
||||
this.tableData.forEach(row => {
|
||||
row.showTags = JSON.parse(row.tags);
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -342,9 +346,13 @@ export default {
|
|||
this.$emit('editApi', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
row.request = null;
|
||||
row.response = null;
|
||||
let rows = [row];
|
||||
let tmp = JSON.parse(JSON.stringify(row));
|
||||
tmp.request = null;
|
||||
tmp.response = null;
|
||||
if (tmp.tags instanceof Array) {
|
||||
tmp.tags = JSON.stringify(tmp.tags);
|
||||
}
|
||||
let rows = [tmp];
|
||||
this.$post('/api/definition/reduction/', rows, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
|
@ -495,7 +503,19 @@ export default {
|
|||
let rowArray = Array.from(rowSets)
|
||||
let ids = rowArray.map(s => s.id);
|
||||
return ids;
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<template>
|
||||
<span>
|
||||
<ms-tag v-if="value === 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
|
||||
<ms-tag v-if="value === 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
|
||||
<ms-tag v-if="value === 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
|
||||
<ms-tag v-if="value === 'Trash'" type="danger" effect="plain" content="废弃"/>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
|
||||
export default {
|
||||
name: "ApiStatus",
|
||||
components: {MsTag},
|
||||
props: {
|
||||
value: {
|
||||
type: String
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -69,27 +69,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('commons.tag')" :label-width="formLabelWidth" prop="tag">
|
||||
<el-tag
|
||||
:key="form + '_' + index"
|
||||
v-for="(tag, index) in form.caseTags"
|
||||
closable
|
||||
size="mini"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="inputVisible"
|
||||
v-model="inputValue"
|
||||
ref="saveTagInput"
|
||||
size="mini"
|
||||
@keyup.enter.native="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="mini" @click="showInput">+</el-button>
|
||||
|
||||
<ms-input-tag :currentScenario="form" ref="tag"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -298,10 +278,11 @@ import TestCaseAttachment from "@/business/components/track/case/components/Test
|
|||
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||
import {buildNodePath} from "../../../api/definition/model/NodeTree";
|
||||
import CaseComment from "@/business/components/track/case/components/CaseComment";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
|
||||
export default {
|
||||
name: "TestCaseEdit",
|
||||
components: {CaseComment, MsDialogFooter, TestCaseAttachment},
|
||||
components: {MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
|
@ -323,7 +304,6 @@ export default {
|
|||
result: ''
|
||||
}],
|
||||
remark: '',
|
||||
caseTags: []
|
||||
},
|
||||
moduleOptions: [],
|
||||
maintainerOptions: [],
|
||||
|
@ -355,8 +335,6 @@ export default {
|
|||
{value: 'manual', label: this.$t('test_track.case.manual')}
|
||||
],
|
||||
testCase: {},
|
||||
inputVisible: false,
|
||||
inputValue: ''
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
@ -387,7 +365,7 @@ export default {
|
|||
open(testCase) {
|
||||
this.testCase = {};
|
||||
if (testCase) {
|
||||
testCase.caseTags = JSON.parse(testCase.tags);
|
||||
testCase.tags = JSON.parse(testCase.tags);
|
||||
// 复制 不查询评论
|
||||
this.testCase = testCase.isCopy ? {} : testCase;
|
||||
}
|
||||
|
@ -425,7 +403,6 @@ export default {
|
|||
this.form.type = 'functional';
|
||||
this.form.method = 'manual';
|
||||
this.form.maintainer = user.id;
|
||||
this.form.caseTags = [];
|
||||
}
|
||||
|
||||
this.getSelectOptions();
|
||||
|
@ -538,6 +515,10 @@ export default {
|
|||
if (param.method != 'auto') {
|
||||
param.testId = null;
|
||||
}
|
||||
if (this.form.tags instanceof Array) {
|
||||
this.form.tags = JSON.stringify(this.form.tags);
|
||||
}
|
||||
param.tags = this.form.tags;
|
||||
return param;
|
||||
},
|
||||
getOption(param) {
|
||||
|
@ -641,7 +622,6 @@ export default {
|
|||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
this.caseTags = [];
|
||||
this.uploadList = [];
|
||||
this.fileList = [];
|
||||
this.tableData = [];
|
||||
|
@ -729,26 +709,6 @@ export default {
|
|||
/// todo: 是否需要对文件内容和大小做限制
|
||||
return file.size > 0;
|
||||
},
|
||||
|
||||
handleClose(tag) {
|
||||
this.form.caseTags.splice(this.form.caseTags.indexOf(tag), 1);
|
||||
},
|
||||
|
||||
showInput() {
|
||||
this.inputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveTagInput.$refs.input.focus();
|
||||
});
|
||||
},
|
||||
|
||||
handleInputConfirm() {
|
||||
let inputValue = this.inputValue;
|
||||
if (inputValue) {
|
||||
this.form.caseTags.push(inputValue);
|
||||
}
|
||||
this.inputVisible = false;
|
||||
this.inputValue = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -788,21 +748,4 @@ export default {
|
|||
height: calc(100vh - 120px);
|
||||
}
|
||||
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
margin-left: 10px;
|
||||
height: 20px;
|
||||
/*line-height: 30px;*/
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.input-new-tag {
|
||||
width: 90px;
|
||||
margin-left: 10px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -113,10 +113,9 @@
|
|||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||
:key="tag + '_' + index"
|
||||
:effect="'light'"
|
||||
:content="tag"/>
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -319,8 +318,10 @@ export default {
|
|||
this.tableData = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
this.tableData.forEach(row => {
|
||||
row.showTags = JSON.parse(row.tags);
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
@ -62,10 +62,9 @@
|
|||
|
||||
<el-table-column prop="tags" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(tag, index) in scope.row.showTags"
|
||||
:key="tag + '_' + index"
|
||||
:effect="'light'"
|
||||
:content="tag"/>
|
||||
<div v-for="(itemName,index) in scope.row.tags" :key="index">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -265,8 +264,10 @@ export default {
|
|||
this.result = this.$post('/test/plan/api/case/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
this.tableData.forEach(row => {
|
||||
row.showTags = JSON.parse(row.tags);
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
@ -479,7 +480,4 @@ export default {
|
|||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -161,7 +161,7 @@ html,body {
|
|||
overflow: visible;
|
||||
}
|
||||
|
||||
.ms-select-all .el-icon-arrow-down {
|
||||
.ms-select-all th:nth-child(2) .el-icon-arrow-down {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
top: -7px;
|
||||
|
|
|
@ -1085,6 +1085,7 @@ export default {
|
|||
plan_status_prepare: "Not started",
|
||||
plan_status_running: "Starting",
|
||||
plan_status_completed: "Completed",
|
||||
plan_status_trash: "Trashed",
|
||||
planned_start_time: "Scheduled Start Time",
|
||||
planned_end_time: "Scheduled End Time",
|
||||
actual_start_time: "Actual Start Time",
|
||||
|
|
|
@ -1086,6 +1086,7 @@ export default {
|
|||
plan_status_prepare: "未开始",
|
||||
plan_status_running: "进行中",
|
||||
plan_status_completed: "已完成",
|
||||
plan_status_trash: "废弃",
|
||||
planned_start_time: "计划开始",
|
||||
planned_end_time: "计划结束",
|
||||
actual_start_time: "实际开始",
|
||||
|
|
|
@ -1085,6 +1085,7 @@ export default {
|
|||
plan_status_prepare: "未開始",
|
||||
plan_status_running: "進行中",
|
||||
plan_status_completed: "已完成",
|
||||
plan_status_trash: "廢棄",
|
||||
planned_start_time: "計劃開始",
|
||||
planned_end_time: "計劃結束",
|
||||
actual_start_time: "實際開始",
|
||||
|
|
Loading…
Reference in New Issue