From e54c9567813210d5e01004a4ec279359a011dfa7 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 23 Dec 2020 18:52:10 +0800 Subject: [PATCH] Merge branch 'master' of https://github.com/metersphere/metersphere # Conflicts: # frontend/src/business/components/api/automation/scenario/EditApiScenario.vue --- .../automation/scenario/EditApiScenario.vue | 231 ++++++++---------- 1 file changed, 96 insertions(+), 135 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 3773b2e4b1..93d5c5f62d 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -2,8 +2,14 @@
- {{$t('commons.save')}} - + + + +
+ {{$t('commons.save')}} +
+
+
{{$t('test_track.plan_view.base_info')}}
@@ -99,11 +105,9 @@
- - - - {{currentScenario.name}} - + + + {{currentScenario.name ===undefined || ''? $t('api_test.scenario.name') : currentScenario.name}} {{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}} @@ -115,7 +119,7 @@ 共享cookie - + {{$t('api_test.definition.request.run_env')}}:
- - {{$t('commons.show_all')}} -
-
- +{{$t('api_test.automation.api_list_import')}} -
-
- +{{$t('api_test.automation.external_import')}} -
-
- +{{$t('api_test.automation.wait_controller')}} -
-
- +{{$t('api_test.automation.if_controller')}} -
-
- +{{$t('api_test.automation.scenario_import')}} -
-
- +{{$t('api_test.automation.customize_script')}} -
-
- +{{$t('api_test.automation.customize_req')}} -
-
- +{{$t('api_test.definition.request.pre_script')}} -
-
- +{{$t('api_test.definition.request.post_script')}} -
-
- +{{$t('api_test.definition.request.assertions_rule')}} -
-
- +{{$t('api_test.definition.request.extract_param')}} -
+ + + +
@@ -278,6 +259,7 @@ import MsScenarioParameters from "./ScenarioParameters"; import ApiImport from "../../definition/components/import/ApiImport"; import InputTag from 'vue-input-tag' + import "@/common/css/material-icons.css" export default { name: "EditApiScenario", @@ -359,7 +341,7 @@ , watch: {} , - computed:{ + computed: { buttons() { let buttons = [ { @@ -465,7 +447,7 @@ } }, methods: { - getIdx(index){ + getIdx(index) { return -1 * index - 2.25; // 为了向下展示菜单 }, showButton(...names) { @@ -519,7 +501,8 @@ } this.sort(); this.reload(); - }, + } + , nodeClick(e) { if (e.referenced != 'REF' && e.referenced != 'Deleted') { this.operatingElements = ELEMENTS.get(e.type); @@ -527,16 +510,19 @@ this.operatingElements = []; } this.selectedTreeNode = e; - }, + } + , showAll() { this.operatingElements = ELEMENTS.get("ALL"); this.selectedTreeNode = undefined; this.reload(); - }, + } + , apiListImport() { this.visibleRef = getUUID(); this.apiListVisible = true; - }, + } + , recursiveSorting(arr) { for (let i in arr) { arr[i].index = Number(i) + 1; @@ -544,7 +530,8 @@ this.recursiveSorting(arr[i].hashTree); } } - }, + } + , sort() { for (let i in this.scenarioDefinition) { this.scenarioDefinition[i].index = Number(i) + 1; @@ -552,7 +539,8 @@ this.recursiveSorting(this.scenarioDefinition[i].hashTree); } } - }, + } + , addCustomizeApi(request) { this.customizeVisible = false; request.enable === undefined ? request.enable = true : request.enable; @@ -564,7 +552,8 @@ this.customizeRequest = {}; this.sort(); this.reload(); - }, + } + , addScenario(arr) { if (arr && arr.length > 0) { arr.forEach(item => { @@ -579,7 +568,8 @@ this.sort(); this.reload(); this.scenarioVisible = false; - }, + } + , setApiParameter(item, refType, referenced) { let request = {}; if (Object.prototype.toString.call(item.request).indexOf("String") > 0) { @@ -608,7 +598,8 @@ } else { this.scenarioDefinition.push(request); } - }, + } + , pushApiOrCase(referenced) { if (this.currentRow.cases.length === 0 && this.currentRow.apis.length === 0) { this.$warning(this.$t('api_test.automation.reference_info')); @@ -625,13 +616,15 @@ this.currentRow.apis = []; this.sort(); this.reload(); - }, + } + , getMaintainerOptions() { let workspaceId = localStorage.getItem(WORKSPACE_ID); this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.maintainerOptions = response.data; }); - }, + } + , openTagConfig() { if (!this.projectId) { this.$error(this.$t('api_test.select_project')); @@ -646,7 +639,8 @@ hashTree.splice(index, 1); this.sort(); this.reload(); - }, + } + , copyRow(row, node) { const parent = node.parent const hashTree = parent.data.hashTree || parent.data; @@ -656,13 +650,15 @@ hashTree.push(obj); this.sort(); this.reload(); - }, + } + , reload() { this.loading = true this.$nextTick(() => { this.loading = false }) - }, + } + , runDebug() { /*触发执行操作*/ if (!this.currentEnvironmentId) { @@ -675,7 +671,8 @@ environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition }; this.reportId = getUUID().substring(0, 8); - }, + } + , getEnvironments() { if (this.projectId) { this.$get('/api/environment/list/' + this.projectId, response => { @@ -685,17 +682,20 @@ }); }); } - }, + } + , openEnvironmentConfig() { if (!this.projectId) { this.$error(this.$t('api_test.select_project')); return; } this.$refs.environmentConfig.open(this.projectId); - }, + } + , environmentConfigClose() { this.getEnvironments(); - }, + } + , allowDrop(draggingNode, dropNode, dropType) { if (dropType != "inner") { return true; @@ -705,21 +705,25 @@ return true; } return false; - }, + } + , allowDrag(draggingNode, dropNode, dropType) { this.sort(); this.reload(); - }, + } + , nodeExpand(data) { if (data.resourceId) { this.expandedNode.push(data.resourceId); } - }, + } + , nodeCollapse(data) { if (data.resourceId) { this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1); } - }, + } + , getPath(id) { if (id === null) { return null; @@ -728,7 +732,8 @@ return item.id === id ? item.path : ""; }); return path[0].path; - }, + } + , setFiles(item, bodyUploadFiles, obj) { if (item.body) { if (item.body.kvs) { @@ -766,7 +771,8 @@ }); } } - }, + } + , recursiveFile(arr, bodyUploadFiles, obj) { arr.forEach(item => { this.setFiles(item, bodyUploadFiles, obj); @@ -774,7 +780,8 @@ this.recursiveFile(item.hashTree, bodyUploadFiles, obj); } }); - }, + } + , getBodyUploadFiles(obj) { let bodyUploadFiles = []; obj.bodyUploadIds = []; @@ -785,7 +792,8 @@ } }) return bodyUploadFiles; - }, + } + , editScenario() { this.$refs['currentScenario'].validate((valid) => { if (valid) { @@ -804,7 +812,8 @@ }) } }) - }, + } + , getApiScenario() { if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) { this.currentScenario.tags = JSON.parse(this.currentScenario.tags); @@ -828,7 +837,8 @@ } }) } - }, + } + , setParameter() { this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.projectId = getCurrentProjectID(); @@ -847,18 +857,22 @@ this.currentScenario.apiScenarioModuleId = this.currentModule.id; } this.currentScenario.projectId = this.projectId; - }, + } + , runRefresh() { this.debugVisible = true; this.loading = false; - }, + } + , showScenarioParameters() { this.$refs.scenarioParameters.open(this.currentScenario.variables); - }, + } + , addParameters(data) { this.currentScenario.variables = data; this.reload(); - }, + } + , apiImport(importData) { if (importData && importData.data) { importData.data.forEach(item => { @@ -922,63 +936,10 @@ margin-top: 5px; } - .ms-right-buttion { - margin-top: 10px; - } - - .ms-btn-1 { - color: #F56C6C; - background-color: #FCF1F1 - } - - .ms-btn-2 { - color: #F56C6C; - background-color: #FCF1F1 - } - - .ms-btn-3 { - color: #67C23A; - background-color: #F2F9EE - } - - .ms-btn-4 { - color: #E6A23C; - background-color: #FCF6EE - } - - .ms-btn-5 { - color: #606266; - background-color: #F4F4F5 - } - - .ms-btn-6 { - color: #7B4D12; - background-color: #F1EEE9 - } - - .ms-btn-7 { - color: #008080; - background-color: #EBF2F2 - } - - .ms-btn-8 { - color: #B8741A; - background-color: #F9F1EA - } - - .ms-btn-9 { - color: #783887; - background-color: #F2ECF3 - } - - .ms-btn-10 { - color: #A30014; - background-color: #F7E6E9 - } - - .ms-btn-11 { - color: #015478; - background-color: #E6EEF2 + #fab { + bottom: unset; + right: 90px; + z-index: 5; } /deep/ .el-tree-node__content {