接口测试增加导出配置
This commit is contained in:
parent
8bd1a34131
commit
5ae9522282
|
@ -39,6 +39,9 @@
|
|||
<el-dropdown-item command="performance" :disabled="create || isReadOnly">
|
||||
{{$t('api_test.create_performance_test')}}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="export" :disabled="isDisabled || isReadOnly">
|
||||
{{$t('api_test.export_config')}}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
|
@ -57,7 +60,7 @@
|
|||
import {Test} from "./model/ScenarioModel"
|
||||
import MsApiReportStatus from "../report/ApiReportStatus";
|
||||
import MsApiReportDialog from "./ApiReportDialog";
|
||||
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
|
||||
import {checkoutTestManagerOrTestUser, downloadFile} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsApiTestConfig",
|
||||
|
@ -201,6 +204,9 @@
|
|||
path: "/performance/test/create"
|
||||
})
|
||||
break;
|
||||
case "export":
|
||||
downloadFile(this.test.name + ".json", JSON.stringify(this.test));
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -125,7 +125,7 @@ export function _filter(filters, condition) {
|
|||
if (!condition.filters) {
|
||||
condition.filters = {};
|
||||
}
|
||||
for(let filter in filters) {
|
||||
for (let filter in filters) {
|
||||
if (filters[filter] && filters[filter].length > 0) {
|
||||
condition.filters[filter] = filters[filter];
|
||||
} else {
|
||||
|
@ -157,3 +157,19 @@ export function _sort(column, condition) {
|
|||
condition.orders.push({name: column.prop, type: column.order});
|
||||
}
|
||||
}
|
||||
|
||||
export function downloadFile(name, content) {
|
||||
const blob = new Blob([content]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
// 非IE下载
|
||||
// chrome/firefox
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = name;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
// IE10+下载
|
||||
navigator.msSaveBlob(blob, name)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ export default {
|
|||
key: "Key",
|
||||
value: "Value",
|
||||
create_performance_test: "Create Performance Test",
|
||||
export_config: "Export Configuration",
|
||||
scenario: {
|
||||
config: "Scenario Config",
|
||||
input_name: "Please enter the scenario name",
|
||||
|
|
|
@ -282,6 +282,7 @@ export default {
|
|||
key: "键",
|
||||
value: "值",
|
||||
create_performance_test: "创建性能测试",
|
||||
export_config: "导出配置",
|
||||
scenario: {
|
||||
config: "场景配置",
|
||||
input_name: "请输入场景名称",
|
||||
|
|
|
@ -280,6 +280,7 @@ export default {
|
|||
key: "鍵",
|
||||
value: "值",
|
||||
create_performance_test: "創建性能測試",
|
||||
export_config: "匯出配寘",
|
||||
scenario: {
|
||||
creator: "創建人",
|
||||
config: "場景配寘",
|
||||
|
|
Loading…
Reference in New Issue