Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cbcb464f55
|
@ -220,14 +220,14 @@
|
||||||
if (tab.name === 'add') {
|
if (tab.name === 'add') {
|
||||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");
|
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");
|
||||||
}
|
}
|
||||||
if(this.$refs.apiConfig) {
|
if (this.$refs.apiConfig) {
|
||||||
this.$refs.apiConfig.forEach(item => {
|
this.$refs.apiConfig.forEach(item => {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
item.removeListener();
|
item.removeListener();
|
||||||
}); // 删除所有tab的 ctrl + s 监听
|
}); // 删除所有tab的 ctrl + s 监听
|
||||||
let tabs = this.apiTabs;
|
let tabs = this.apiTabs;
|
||||||
let index = tabs.findIndex(item => item.name === tab.name); // 找到当前选中tab的index
|
let index = tabs.findIndex(item => item.name === tab.name); // 找到当前选中tab的index
|
||||||
if(index != -1) {
|
if (index != -1) {
|
||||||
this.$refs.apiConfig[index - 1].addListener(); // 为选中tab添加 ctrl + s 监听(index-1的原因是要除去第一个固有tab)
|
this.$refs.apiConfig[index - 1].addListener(); // 为选中tab添加 ctrl + s 监听(index-1的原因是要除去第一个固有tab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,11 @@
|
||||||
} else {
|
} else {
|
||||||
let condition = {};
|
let condition = {};
|
||||||
let url = "/api/definition/list/all";
|
let url = "/api/definition/list/all";
|
||||||
condition.filters = ["Prepare", "Underway", "Completed"];
|
condition.filters = new Map(
|
||||||
|
[
|
||||||
|
["status", ["Prepare", "Underway", "Completed"]],
|
||||||
|
]
|
||||||
|
);
|
||||||
condition.projectId = getCurrentProjectID();
|
condition.projectId = getCurrentProjectID();
|
||||||
this.$post(url, condition, response => {
|
this.$post(url, condition, response => {
|
||||||
obj.data = response.data;
|
obj.data = response.data;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<el-form-item :label="$t('api_report.request')" prop="url">
|
<el-form-item :label="$t('api_report.request')" prop="url">
|
||||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-model="debugForm.url"
|
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-model="debugForm.url"
|
||||||
class="ms-http-input" size="small" :disabled="testCase!=undefined">
|
class="ms-http-input" size="small" :disabled="testCase!=undefined" @blur="urlChange">
|
||||||
<el-select v-model="debugForm.method" slot="prepend" style="width: 100px" size="small">
|
<el-select v-model="debugForm.method" slot="prepend" style="width: 100px" size="small">
|
||||||
<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
|
<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -55,6 +55,7 @@
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
import MsRequestResultTail from "../response/RequestResultTail";
|
import MsRequestResultTail from "../response/RequestResultTail";
|
||||||
import MsJmxStep from "../step/JmxStep";
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
import {KeyValue} from "../../model/ApiTestModel";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiConfig",
|
name: "ApiConfig",
|
||||||
|
@ -167,7 +168,35 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
urlChange() {
|
||||||
|
if (!this.debugForm.url || this.debugForm.url.indexOf('?') === -1) return;
|
||||||
|
let url = this.getURL(this.addProtocol(this.debugForm.url));
|
||||||
|
if (url) {
|
||||||
|
this.debugForm.url = decodeURIComponent(this.debugForm.url.substr(0, this.debugForm.url.indexOf("?")));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addProtocol(url) {
|
||||||
|
if (url) {
|
||||||
|
if (!url.toLowerCase().startsWith("https") && !url.toLowerCase().startsWith("http")) {
|
||||||
|
return "https://" + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
},
|
||||||
|
getURL(urlStr) {
|
||||||
|
try {
|
||||||
|
let url = new URL(urlStr);
|
||||||
|
url.searchParams.forEach((value, key) => {
|
||||||
|
if (key && value) {
|
||||||
|
this.request.arguments.splice(0, 0, new KeyValue({name: key, required: false, value: value}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return url;
|
||||||
|
} catch (e) {
|
||||||
|
this.$error(this.$t('api_test.request.url_invalid'), 2000);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<ms-node-tree
|
<ms-node-tree
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
:tree-nodes="data"
|
:tree-nodes="data"
|
||||||
|
allLabel="默认模块"
|
||||||
@add="add"
|
@add="add"
|
||||||
:type="'edit'"
|
:type="'edit'"
|
||||||
@edit="edit"
|
@edit="edit"
|
||||||
|
@ -97,6 +98,10 @@
|
||||||
this.$warning("请选择一个模块");
|
this.$warning("请选择一个模块");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.currentModule.id === "root") {
|
||||||
|
this.$warning("不能选默认模块,请重新选择一个模块");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let arr = Array.from(this.selectIds);
|
let arr = Array.from(this.selectIds);
|
||||||
let obj = {testIds: arr, projectId: getCurrentProjectID(), modulePath: this.getPath(this.currentModule.id), moduleId: this.currentModule.id};
|
let obj = {testIds: arr, projectId: getCurrentProjectID(), modulePath: this.getPath(this.currentModule.id), moduleId: this.currentModule.id};
|
||||||
|
|
Loading…
Reference in New Issue