Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-01-26 14:20:16 +08:00
commit cbcb464f55
3 changed files with 43 additions and 5 deletions

View File

@ -220,14 +220,14 @@
if (tab.name === 'add') {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");
}
if(this.$refs.apiConfig) {
if (this.$refs.apiConfig) {
this.$refs.apiConfig.forEach(item => {
console.log(item);
item.removeListener();
}); // tab ctrl + s
let tabs = this.apiTabs;
let index = tabs.findIndex(item => item.name === tab.name); // tabindex
if(index != -1) {
if (index != -1) {
this.$refs.apiConfig[index - 1].addListener(); // tab ctrl + s index-1tab
}
}
@ -336,7 +336,11 @@
} else {
let condition = {};
let url = "/api/definition/list/all";
condition.filters = ["Prepare", "Underway", "Completed"];
condition.filters = new Map(
[
["status", ["Prepare", "Underway", "Completed"]],
]
);
condition.projectId = getCurrentProjectID();
this.$post(url, condition, response => {
obj.data = response.data;

View File

@ -7,7 +7,7 @@
<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"
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-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
</el-select>
@ -55,6 +55,7 @@
import {REQ_METHOD} from "../../model/JsonData";
import MsRequestResultTail from "../response/RequestResultTail";
import MsJmxStep from "../step/JmxStep";
import {KeyValue} from "../../model/ApiTestModel";
export default {
name: "ApiConfig",
@ -167,7 +168,35 @@
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>

View File

@ -11,6 +11,7 @@
<ms-node-tree
v-loading="result.loading"
:tree-nodes="data"
allLabel="默认模块"
@add="add"
:type="'edit'"
@edit="edit"
@ -97,6 +98,10 @@
this.$warning("请选择一个模块");
return;
}
if (this.currentModule.id === "root") {
this.$warning("不能选默认模块,请重新选择一个模块");
return;
}
this.loading = true;
let arr = Array.from(this.selectIds);
let obj = {testIds: arr, projectId: getCurrentProjectID(), modulePath: this.getPath(this.currentModule.id), moduleId: this.currentModule.id};