Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
27e405fde5
|
@ -14,9 +14,9 @@ import java.util.List;
|
|||
public class SwaggerApiExportResult extends ApiExportResult{
|
||||
private String openapi;
|
||||
private SwaggerInfo info;
|
||||
private String externalDocs;
|
||||
private JSONObject externalDocs;
|
||||
private List<String> servers;
|
||||
private List<SwaggerTag> tags;
|
||||
private JSONObject paths; // Map<String, Object>, Object 里放 Operation 对象
|
||||
private List<String> components;
|
||||
private JSONObject components;
|
||||
}
|
||||
|
|
|
@ -231,6 +231,9 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
MediaType mediaType = content.get(contentType);
|
||||
if (mediaType == null) {
|
||||
Set<String> contentTypes = content.keySet();
|
||||
if(contentTypes.size() == 0) { // 防止空指针
|
||||
return;
|
||||
}
|
||||
contentType = contentTypes.iterator().next();
|
||||
if (StringUtils.isBlank(contentType)) {
|
||||
return;
|
||||
|
@ -410,26 +413,34 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
result.setInfo(new SwaggerInfo());
|
||||
result.setServers(new ArrayList<>());
|
||||
result.setTags(new ArrayList<>());
|
||||
result.setComponents(new ArrayList<>());
|
||||
result.setComponents(new JSONObject());
|
||||
result.setExternalDocs(new JSONObject());
|
||||
|
||||
JSONObject paths = new JSONObject();
|
||||
JSONObject swaggerPath = new JSONObject();
|
||||
for(ApiDefinitionWithBLOBs apiDefinition : apiDefinitionList) {
|
||||
SwaggerApiInfo swaggerApiInfo = new SwaggerApiInfo(); // {tags:, summary:, description:, parameters:}
|
||||
swaggerApiInfo.setSummary(apiDefinition.getName());
|
||||
// 设置导入后的模块名 (根据 api 的 moduleID 查库获得所属模块,作为导出的模块名)
|
||||
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
String moduleName = apiModuleService.getNode(apiDefinition.getModuleId()).getName();
|
||||
String moduleName = "";
|
||||
if(apiDefinition.getModuleId() != null) { // module_id 可能为空
|
||||
moduleName = apiModuleService.getNode(apiDefinition.getModuleId()).getName();
|
||||
}
|
||||
swaggerApiInfo.setTags(Arrays.asList(moduleName));
|
||||
// 设置请求体
|
||||
JSONObject requestObject = JSON.parseObject(apiDefinition.getRequest()); // 将api的request属性转换成JSON对象以便获得参数
|
||||
JSONObject requestBody = buildRequestBody(requestObject);
|
||||
swaggerApiInfo.setRequestBody(requestBody);
|
||||
// 设置响应体
|
||||
swaggerApiInfo.setResponses(new JSONObject());
|
||||
// 设置请求参数列表
|
||||
List<JSONObject> paramsList = buildParameters(requestObject);
|
||||
swaggerApiInfo.setParameters(paramsList);
|
||||
swaggerPath.put(apiDefinition.getMethod().toLowerCase(), JSON.parseObject(JSON.toJSONString(swaggerApiInfo))); // 设置api的请求类型和api定义、参数
|
||||
paths.put(apiDefinition.getPath(), swaggerPath);
|
||||
JSONObject methodDetail = JSON.parseObject(JSON.toJSONString(swaggerApiInfo));
|
||||
if(paths.getJSONObject(apiDefinition.getPath()) == null) {
|
||||
paths.put(apiDefinition.getPath(), new JSONObject());
|
||||
} // 一个路径下有多个发方法,如post,get,因此是一个 JSONObject 类型
|
||||
paths.getJSONObject(apiDefinition.getPath()).put(apiDefinition.getMethod().toLowerCase(), methodDetail);
|
||||
}
|
||||
result.setPaths(paths);
|
||||
return result;
|
||||
|
@ -477,7 +488,9 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
schema.put("format", null);
|
||||
typeName.put("schema", schema);
|
||||
JSONObject content = new JSONObject();
|
||||
if (type != null && StringUtils.isNotBlank(type)) {
|
||||
content.put(typeMap.get(type), typeName);
|
||||
}
|
||||
requestBody.put("content", content);
|
||||
return requestBody;
|
||||
}
|
||||
|
|
|
@ -14,4 +14,5 @@ public class SwaggerApiInfo {
|
|||
private String summary; // 对应 API 的名字
|
||||
private List<JSONObject> parameters; // 对应 API 的请求参数
|
||||
private JSONObject requestBody;
|
||||
private JSONObject responses;
|
||||
}
|
||||
|
|
|
@ -267,6 +267,9 @@
|
|||
open(api) {
|
||||
if (api) {
|
||||
let data = JSON.parse(JSON.stringify(api));
|
||||
if (data.protocol === "dubbo://") {
|
||||
data.protocol = "DUBBO";
|
||||
}
|
||||
data.id = getUUID();
|
||||
this.httpForm = {id: data.id, name: data.name, protocol: data.protocol, path: data.path, method: api.method, userId: getCurrentUser().id, request: data};
|
||||
this.getMaintainerOptions();
|
||||
|
|
|
@ -162,6 +162,7 @@
|
|||
|
||||
.script-content {
|
||||
height: calc(100vh - 570px);
|
||||
min-height: 250px;
|
||||
}
|
||||
|
||||
.script-index {
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
</span>
|
||||
</el-tooltip>
|
||||
<el-row>
|
||||
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887"> {{ $t("commons.batch_add") }}
|
||||
<el-link class="ms-variable-link" @click="batchAdd" style="color: #783887" :disabled="disabled"> {{ $t("commons.batch_add") }}
|
||||
</el-link>
|
||||
</el-row>
|
||||
<div style="min-height: 400px">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{{ description }}
|
||||
</span>
|
||||
<el-row>
|
||||
<el-checkbox v-model="isSelectAll" v-if="items.length > 1"/>
|
||||
<el-checkbox v-model="isSelectAll" v-if="isShowEnable === true && items.length > 1"/>
|
||||
</el-row>
|
||||
<div class="kv-row item" v-for="(item, index) in items" :key="index">
|
||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||
|
@ -52,7 +52,6 @@
|
|||
valuePlaceholder: String,
|
||||
isShowEnable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
description: String,
|
||||
items: Array,
|
||||
|
|
|
@ -155,6 +155,11 @@
|
|||
created() {
|
||||
this.getEnvironments();
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return this.$store.state.projectId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addPre() {
|
||||
let jsr223PreProcessor = createComponent("JSR223PreProcessor");
|
||||
|
@ -210,7 +215,8 @@
|
|||
|
||||
getEnvironments() {
|
||||
this.environments = [];
|
||||
this.$get('/api/environment/list/' + getCurrentProjectID(), response => {
|
||||
let id = this.request.projectId ? this.request.projectId : this.projectId;
|
||||
this.$get('/api/environment/list/' + id, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-form :model="request" :rules="rules" ref="request" label-width="100px" size="small" v-loading="loading"
|
||||
:disabled="isReadOnly">
|
||||
<el-button class="get-provider" type="primary" size="small" @click="getProviderList">Get Provider List</el-button>
|
||||
<el-button class="get-provider" type="primary" size="mini" @click="getProviderList">Get Provider List</el-button>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Interfaces" prop="interfaces">
|
||||
|
|
|
@ -8,20 +8,10 @@
|
|||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane">
|
||||
<!--<div style="width: 400px">-->
|
||||
<!--<pre>{{ response.responseResult.headers }}</pre>-->
|
||||
<!--</div>-->
|
||||
<ms-code-edit :mode="'text'" :read-only="true" :data.sync="response.responseResult.headers"/>
|
||||
|
||||
</el-tab-pane>
|
||||
<!--<el-tab-pane label="Cookie" name="cookie" class="pane cookie">-->
|
||||
<!--<pre>{{response.cookies}}</pre>-->
|
||||
<!--</el-tab-pane>-->
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||
<!--<div style="width: 400px">-->
|
||||
<!--<pre>{{response.responseResult.console}}</pre>-->
|
||||
<!--</div>-->
|
||||
<ms-code-edit :mode="'text'" :read-only="true" :data.sync="response.responseResult.console"/>
|
||||
</el-tab-pane>
|
||||
|
||||
|
@ -30,29 +20,10 @@
|
|||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.request.extract.label')" name="label" class="pane">
|
||||
<!--<div style="width: 400px">-->
|
||||
<!--<pre>{{response.responseResult.vars}}</pre>-->
|
||||
<!--</div>-->
|
||||
<ms-code-edit :mode="'text'" :read-only="true" :data.sync="response.responseResult.vars"/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane">
|
||||
<!--<div class="ms-div">-->
|
||||
<!--{{$t('api_test.request.address')}} :-->
|
||||
<!--<pre>{{ response.url }}</pre>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="ms-div">-->
|
||||
<!--{{$t('api_test.scenario.headers')}} :-->
|
||||
<!--<pre>{{ response.headers }}</pre>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="ms-div">-->
|
||||
<!--Cookies :-->
|
||||
<!--<pre>{{response.cookies}}</pre>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="ms-div">-->
|
||||
<!--Body :-->
|
||||
<!--<pre>{{response.body ? response.body:""}}</pre>-->
|
||||
<!--</div>-->
|
||||
<ms-code-edit :mode="'text'" :read-only="true" :data.sync="reqMessages"/>
|
||||
</el-tab-pane>
|
||||
|
||||
|
|
|
@ -190,8 +190,8 @@ export default {
|
|||
let req = this.api.request;
|
||||
req.id = getUUID();
|
||||
data.request = JSON.stringify(req);
|
||||
data.method = this.api.method;
|
||||
data.path = this.api.path;
|
||||
data.method = req.method;
|
||||
data.path = req.path;
|
||||
data.url = this.api.url;
|
||||
data.status = this.api.status;
|
||||
data.userId = this.api.userId;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="title">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
|
@ -22,6 +22,7 @@
|
|||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
</el-button>
|
||||
|
@ -132,6 +133,7 @@
|
|||
|
||||
<script>
|
||||
import {hasLicense} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
|
||||
const TASK_TYPE = 'DEFECT_TASK';
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
|
@ -140,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
|||
export default {
|
||||
name: "DefectTaskNotification",
|
||||
components: {
|
||||
MsCodeEdit,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
},
|
||||
props: {
|
||||
|
@ -149,6 +152,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: "<!DOCTYPE html>\n" +
|
||||
"<html lang=\"en\">\n" +
|
||||
"<head>\n" +
|
||||
|
@ -274,6 +278,7 @@ export default {
|
|||
.el-row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="title">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
|
@ -19,9 +19,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
</el-button>
|
||||
|
@ -136,6 +136,7 @@
|
|||
|
||||
<script>
|
||||
import {hasLicense} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
|
||||
const TASK_TYPE = 'JENKINS_TASK';
|
||||
|
||||
|
@ -145,6 +146,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
|||
export default {
|
||||
name: "JenkinsNotification",
|
||||
components: {
|
||||
MsCodeEdit,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
},
|
||||
props: {
|
||||
|
@ -154,6 +156,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: '<!DOCTYPE html>\n' +
|
||||
'<html lang="en">\n' +
|
||||
'<head>\n' +
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="title">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
|
@ -19,9 +19,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
width="200"
|
||||
trigger="click" >
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
</el-button>
|
||||
|
@ -136,6 +136,7 @@
|
|||
|
||||
<script>
|
||||
import {hasLicense} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
|
||||
|
@ -143,6 +144,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
|||
export default {
|
||||
name: "ScheduleTaskNotification",
|
||||
components: {
|
||||
MsCodeEdit,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
},
|
||||
props: {
|
||||
|
@ -155,6 +157,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: '<!DOCTYPE html>\n' +
|
||||
'<html lang="en">\n' +
|
||||
'<head>\n' +
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="title">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
|
@ -19,9 +19,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
</el-button>
|
||||
|
@ -133,6 +133,7 @@
|
|||
|
||||
<script>
|
||||
import {hasLicense} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
|
||||
const TASK_TYPE = 'TEST_PLAN_TASK';
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
|
@ -141,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
|||
export default {
|
||||
name: "TestPlanTaskNotification",
|
||||
components: {
|
||||
MsCodeEdit,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
},
|
||||
props: {
|
||||
|
@ -150,6 +152,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: "<!DOCTYPE html>\n" +
|
||||
"<html lang=\"en\">\n" +
|
||||
"<head>\n" +
|
||||
|
@ -308,6 +311,7 @@ export default {
|
|||
.el-row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="title">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.mail_template_example') }}
|
||||
</el-button>
|
||||
|
@ -19,9 +19,9 @@
|
|||
<el-popover
|
||||
placement="right-end"
|
||||
title="示例"
|
||||
width="400"
|
||||
trigger="click"
|
||||
:content="robotTitle">
|
||||
width="600"
|
||||
trigger="click">
|
||||
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
|
||||
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
|
||||
{{ $t('organization.message.robot_template') }}
|
||||
</el-button>
|
||||
|
@ -133,6 +133,7 @@
|
|||
|
||||
<script>
|
||||
import {hasLicense} from "@/common/js/utils";
|
||||
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
|
||||
|
||||
const TASK_TYPE = 'REVIEW_TASK';
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
|
@ -141,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
|||
export default {
|
||||
name: "TestReviewNotification",
|
||||
components: {
|
||||
MsCodeEdit,
|
||||
"NoticeTemplate": noticeTemplate.default
|
||||
},
|
||||
props: {
|
||||
|
@ -150,6 +152,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
modes: ['text', 'html'],
|
||||
title: "<!DOCTYPE html>\n" +
|
||||
"<html lang=\"en\">\n" +
|
||||
"<head>\n" +
|
||||
|
@ -313,6 +316,7 @@ export default {
|
|||
.el-row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
id="inputDelay"
|
||||
type="primary"
|
||||
:content="$t('commons.save')"
|
||||
size="small" @exec="saveCase"
|
||||
size="small" @click="saveCase"
|
||||
icon=""
|
||||
title="ctrl + s"/>
|
||||
<el-dropdown v-else split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
|
@ -62,14 +62,14 @@
|
|||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="评审状态" :label-width="formLabelWidth" prop="reviewStatus">
|
||||
<el-select size="small" v-model="form.reviewStatus" class="ms-case-input">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="7">-->
|
||||
<!-- <el-form-item label="评审状态" :label-width="formLabelWidth" prop="reviewStatus">-->
|
||||
<!-- <el-select size="small" v-model="form.reviewStatus" class="ms-case-input">-->
|
||||
<!-- <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="7">
|
||||
<el-form-item :label="$t('commons.tag')" :label-width="formLabelWidth" prop="tag">
|
||||
<ms-input-tag :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/>
|
||||
|
@ -88,8 +88,6 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item :label="$t('test_track.case.priority')" :label-width="formLabelWidth" prop="priority">
|
||||
<el-select :disabled="readOnly" v-model="form.priority" clearable
|
||||
|
@ -101,16 +99,18 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="7">
|
||||
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth">
|
||||
<el-cascader filterable placeholder="请选择要关联的测试" show-all-levels v-model="form.selected" :props="props"
|
||||
class="ms-case"></el-cascader>
|
||||
<el-cascader :options="sysList" filterable placeholder="请选择要关联的测试" show-all-levels
|
||||
v-model="form.selected" :props="props"
|
||||
class="ms-case" @change="clearInput" ref="cascade"></el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="关联需求" :label-width="formLabelWidth" prop="demandId">
|
||||
<el-select filterable :disabled="readOnly" v-model="form.demandId" @visible-change="visibleChange"
|
||||
placeholder="请选择要关联的需求" class="ms-case-input">
|
||||
|
@ -124,7 +124,7 @@
|
|||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="需求ID/名称" :label-width="formLabelWidth" prop="demandName"
|
||||
v-if="form.demandId=='other'">
|
||||
<el-input v-model="form.demandName"></el-input>
|
||||
|
@ -290,7 +290,7 @@
|
|||
<script>
|
||||
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||
import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getCurrentUser, handleCtrlSEvent, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {Message} from "element-ui";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
import {buildNodePath} from "../../../api/definition/model/NodeTree";
|
||||
|
@ -315,43 +315,10 @@ export default {
|
|||
return {
|
||||
props: {
|
||||
multiple: true,
|
||||
lazy: true,
|
||||
lazyLoad: ((node, resolve) => {
|
||||
const {level} = node;
|
||||
if (node.level == 0) {
|
||||
const nodes = TEST
|
||||
.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
leaf: level >= 1
|
||||
}));
|
||||
resolve(nodes)
|
||||
}
|
||||
if (node.level == 1) {
|
||||
this.testOptions = [];
|
||||
let url = '';
|
||||
this.form.type = node.data.value
|
||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||
url = '/' + this.form.type + '/list/' + this.projectId
|
||||
}
|
||||
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
||||
this.$get(url, response => {
|
||||
const nodes = response.data
|
||||
.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
leaf: level >= 1
|
||||
}));
|
||||
resolve(nodes)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}),
|
||||
//lazy: true,
|
||||
//lazyLoad:this.lazyLoad
|
||||
},
|
||||
sysList: [],//一级选择框的数据
|
||||
options: REVIEW_STATUS,
|
||||
statuOptions: API_STATUS,
|
||||
comments: [],
|
||||
|
@ -395,6 +362,7 @@ export default {
|
|||
{max: 255, message: this.$t('test_track.length_less_than') + '255', trigger: 'blur'}
|
||||
],
|
||||
module: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
||||
demandName: [{required: true, message: this.$t('test_track.case.input_demand_name'), trigger: 'change'}],
|
||||
maintainer: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||
priority: [{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
||||
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
||||
|
@ -462,8 +430,87 @@ export default {
|
|||
this.$emit('setModuleOptions', this.moduleOptions);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadOptions();
|
||||
this.addListener(); // 添加 ctrl s 监听
|
||||
},
|
||||
methods: {
|
||||
|
||||
clearInput() {
|
||||
//this.$refs['cascade'].panel.clearCheckedNodes()
|
||||
},
|
||||
async loadOptions(sysLib) {
|
||||
sysLib = TEST
|
||||
.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
}));
|
||||
let array = [];
|
||||
for (let i = 0; i < sysLib.length; i++) {
|
||||
if (sysLib.length > 0) {
|
||||
let res = await this.getTestOptions(sysLib[i].value);
|
||||
sysLib[i].children = res;
|
||||
}
|
||||
array.push(sysLib[i]);
|
||||
}
|
||||
this.sysList = array;
|
||||
},
|
||||
getTestOptions(val) {
|
||||
this.form.type = val
|
||||
this.testOptions = [];
|
||||
let url = '';
|
||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||
url = '/' + this.form.type + '/list/' + this.projectId
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$get(url).then(res => {
|
||||
console.log(res.data.data)
|
||||
const data = res.data.data.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
leaf: true
|
||||
}))
|
||||
resolve(data)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
/* lazyLoad(node, resolve){
|
||||
const { level } = node;
|
||||
if(node.level==0){
|
||||
const nodes = TEST
|
||||
.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
leaf: level >= 1
|
||||
}));
|
||||
resolve(nodes)
|
||||
}
|
||||
if(node.level==1){
|
||||
this.projectId = getCurrentProjectID()
|
||||
this.testOptions = [];
|
||||
let url = '';
|
||||
this.form.type=node.data.value
|
||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||
url = '/' + this.form.type + '/list/' + this.projectId
|
||||
}
|
||||
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
||||
this.$get(url, response => {
|
||||
const nodes = response.data
|
||||
.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
leaf: level >= 1
|
||||
}));
|
||||
resolve(nodes)
|
||||
});
|
||||
}
|
||||
}
|
||||
},*/
|
||||
handleCommand(e) {
|
||||
if (e === "ADD_AND_CREATE") {
|
||||
this.$refs['caseFrom'].validate((valid) => {
|
||||
|
@ -506,6 +553,9 @@ export default {
|
|||
this.$nextTick(() => (this.isStepTableAlive = true));
|
||||
},
|
||||
open(testCase) {
|
||||
/*
|
||||
this.form.selected=[["automation", "3edaaf31-3fa4-4a53-9654-320205c2953a"],["automation", "3aa58bd1-c986-448c-8060-d32713dbd4eb"]]
|
||||
*/
|
||||
if (window.history && window.history.pushState) {
|
||||
history.pushState(null, null, document.URL);
|
||||
window.addEventListener('popstate', this.close);
|
||||
|
@ -577,7 +627,7 @@ export default {
|
|||
})
|
||||
})
|
||||
},
|
||||
setFormData(testCase) {
|
||||
async setFormData(testCase) {
|
||||
testCase.tags = JSON.parse(testCase.tags);
|
||||
testCase.selected = JSON.parse(testCase.testId);
|
||||
let tmp = {};
|
||||
|
@ -587,11 +637,12 @@ export default {
|
|||
tmp.steps = []
|
||||
}
|
||||
Object.assign(this.form, tmp);
|
||||
console.log(this.form.selected)
|
||||
this.form.module = testCase.nodeId;
|
||||
/*
|
||||
this.form.testId=testCase.selected
|
||||
*/
|
||||
this.getFileMetaData(testCase);
|
||||
/* testCase.selected = JSON.parse(testCase.testId);
|
||||
this.form.selected= testCase.selected*/
|
||||
await this.loadOptions(this.sysList)
|
||||
},
|
||||
setTestCaseExtInfo(testCase) {
|
||||
this.testCase = {};
|
||||
|
@ -710,7 +761,7 @@ export default {
|
|||
if (this.form.tags instanceof Array) {
|
||||
this.form.tags = JSON.stringify(this.form.tags);
|
||||
}
|
||||
param.testId = JSON.stringify(this.form.selected)
|
||||
param.testId=JSON.stringify(this.form.selected)
|
||||
param.tags = this.form.tags;
|
||||
param.type = 'functional'
|
||||
return param;
|
||||
|
@ -782,21 +833,7 @@ export default {
|
|||
this.maintainerOptions = response.data;
|
||||
});
|
||||
},
|
||||
getTestOptions(val) {
|
||||
this.testOptions = [];
|
||||
let url = '';
|
||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||
url = '/' + this.form.type + '/list/' + this.projectId
|
||||
}
|
||||
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
||||
this.result = this.$get(url, response => {
|
||||
this.testOptions = response.data;
|
||||
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
visibleChange(flag) {
|
||||
if (flag) {
|
||||
this.getDemandOptions();
|
||||
|
@ -936,6 +973,15 @@ export default {
|
|||
/// todo: 是否需要对文件内容和大小做限制
|
||||
return file.size > 0;
|
||||
},
|
||||
addListener() {
|
||||
document.addEventListener("keydown", this.createCtrlSHandle);
|
||||
},
|
||||
removeListener() {
|
||||
document.removeEventListener("keydown", this.createCtrlSHandle);
|
||||
},
|
||||
createCtrlSHandle(event) {
|
||||
handleCtrlSEvent(event, this.saveCase);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1166,6 +1166,7 @@ export default {
|
|||
input_type: "Please select type",
|
||||
input_method: "Please select method",
|
||||
input_prerequisite: "Please select prerequisite",
|
||||
input_demand_name: "Please input demand id or name",
|
||||
delete_confirm: "Confirm delete test case",
|
||||
delete: "Delete case",
|
||||
save_create_continue: "Save and create continue",
|
||||
|
|
|
@ -1170,6 +1170,7 @@ export default {
|
|||
input_type: "请选择用例类型",
|
||||
input_method: "请选择测试方式",
|
||||
input_prerequisite: "请输入前置条件",
|
||||
input_demand_name: "请输入需求ID或名称",
|
||||
delete_confirm: "确认删除测试用例",
|
||||
delete: "删除用例",
|
||||
save_create_continue: "保存并继续创建",
|
||||
|
|
|
@ -1168,6 +1168,7 @@ export default {
|
|||
input_type: "請選擇用例類型",
|
||||
input_method: "請選擇測試方式",
|
||||
input_prerequisite: "請輸入前置條件",
|
||||
input_demand_name: "請輸入請求ID或名稱",
|
||||
delete_confirm: "確認刪除測試用例",
|
||||
delete: "刪除用例",
|
||||
save_create_continue: "保存並繼續創建",
|
||||
|
|
Loading…
Reference in New Issue