feat(版本对比): 接口自动化版本部分数据对比显示

--user=郭雨琦 接口自动化版本部分数据对比显示,初始页面自动化对比以及
This commit is contained in:
guoyuqi 2022-01-12 18:52:59 +08:00 committed by fit2-zhao
parent fce525d6e0
commit a7d3ece348
15 changed files with 159 additions and 22 deletions

View File

@ -353,12 +353,10 @@
:module-options="moduleOptions"
:old-scenario-definition="scenarioDefinition"
:new-scenario-definition="newScenarioDefinition"
:project-env-map = "projectEnvMap"
:new-project-env-map="newProjectEnvMap"
:type ="type"
></scenario-diff>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible=false"> </el-button>
<el-button type="primary" > </el-button>
</span>
</el-dialog>
</el-card>
@ -480,6 +478,7 @@ export default {
response: {},
projectIds: new Set,
projectEnvMap: new Map,
newProjectEnvMap: new Map,
projectList: [],
debugResult: new Map,
drawer: false,
@ -1735,6 +1734,12 @@ export default {
let obj = JSON.parse(res.data.scenarioDefinition);
if(obj){
this.newScenarioDefinition = obj.hashTree;
if (response.data.environmentJson) {
this.newProjectEnvMap = objToStrMap(JSON.parse(response.data.environmentJson));
} else {
//
this.newProjectEnvMap.set(this.projectId, obj.environmentId);
}
}
}
this.newData = res.data;

View File

@ -15,7 +15,7 @@
<el-input :draggable="draggable" size="mini" v-model="data.name" class="name-input" @focus="active(data)"
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
</span>
<span :class="isMax?'ms-step-name':'scenario-name'" v-else>
<span :class="showVersion?'scenario-name':'scenario-version'" v-else>
<i class="el-icon-edit" style="cursor:pointer;" @click="editName"
v-if="data.referenced!='REF' && !data.disabled"/>
<el-tooltip placement="top" :content="data.name">
@ -24,23 +24,21 @@
<el-tag size="mini" v-if="data.method && !data.pluginId" style="margin-left: 1rem">{{ getMethod() }}</el-tag>
<slot name = "afterTitle"/>
</span>
</slot>
<slot name="scenarioEnable"/>
</span>
<div v-if="!ifFromVariableAdvance" class="header-right" @click.stop>
<slot name="message"></slot>
<slot name="debugStepCode"></slot>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root" style="width: 30px"/>
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root&&showVersion" style="width: 30px"/>
</el-tooltip>
<slot name="button"></slot>
<el-tooltip content="Copy" placement="top">
<slot name="button" v-if="showVersion"></slot>
<el-tooltip content="Copy" placement="top" v-if="showVersion">
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" :disabled="data.disabled && !data.root"/>
</el-tooltip>
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && (!data.disabled || data.root)"/>
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && (!data.disabled || data.root)&&showVersion"/>
</div>
</div>
@ -88,6 +86,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
data: {
type: Object,
default() {
@ -221,17 +223,81 @@ export default {
white-space: nowrap;
width: 140px;
}
.scenario-version{
display: inline-block;
font-size: 13px;
margin: 0 5px;
/*overflow-x: hidden;*/
overflow-x: scroll;
overflow-y: hidden;
padding-bottom: 0;
/*text-overflow: ellipsis;*/
vertical-align: middle;
white-space: nowrap;
width: calc(100% - 20rem);
height: auto;
}
.scenario-version::-webkit-scrollbar
{
background-color: #fff;
}
/*定义滚动条轨道 内阴影+圆角*/
.scenario-version::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px #fff;
border-radius: 1px;
background-color: #ffffff;
}
/*定义滑块 内阴影+圆角*/
.scenario-version::-webkit-scrollbar-thumb
{
border-radius: 1px;
-webkit-box-shadow: inset 0 0 6px #fff;
background-color: #7c3030;
}
.scenario-version::-webkit-scrollbar {
/* width: 0px; */
height: 3px;
position: fixed;
}
.scenario-name {
display: inline-block;
font-size: 13px;
margin: 0 5px;
overflow-x: hidden;
/*overflow-x: hidden;*/
overflow-x: scroll;
overflow-y: hidden;
padding-bottom: 0;
text-overflow: ellipsis;
/*text-overflow: ellipsis;*/
vertical-align: middle;
white-space: nowrap;
width: calc(100% - 35rem);
width: calc(100% - 25rem);
height: auto;
}
.scenario-name::-webkit-scrollbar
{
background-color: #fff;
}
/*定义滚动条轨道 内阴影+圆角*/
.scenario-name::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px #fff;
border-radius: 1px;
background-color: #ffffff;
}
/*定义滑块 内阴影+圆角*/
.scenario-name::-webkit-scrollbar-thumb
{
border-radius: 1px;
-webkit-box-shadow: inset 0 0 6px #fff;
background-color: #7c3030;
}
.scenario-name::-webkit-scrollbar {
/* width: 0px; */
height: 3px;
position: fixed;
}
/deep/ .el-step__icon {

View File

@ -11,6 +11,7 @@
:background-color="displayColor.backgroundColor"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
:title="displayTitle"
:if-from-variable-advance="ifFromVariableAdvance">
@ -21,7 +22,7 @@
<i class="el-icon-warning"/>
</el-tooltip>
</span>
<span v-xpack v-if="request.versionEnable">{{$t('project.version.name')}}: {{ request.versionName }}</span>
<span v-xpack v-if="request.versionEnable&&showVersion">{{$t('project.version.name')}}: {{ request.versionName }}</span>
</template>
<template v-slot:behindHeaderLeft>
@ -171,6 +172,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
currentEnvironmentId: String,
projectList: Array,
expandedNode: Array,

View File

@ -11,6 +11,7 @@
:is-disabled="true"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
color="#606266"
background-color="#F4F4F5"
:if-from-variable-advance="ifFromVariableAdvance"
@ -89,6 +90,10 @@ export default {
type: Boolean,
default: true,
},
showVersion:{
type: Boolean,
default: true,
},
draggable: {
type: Boolean,
default: false,

View File

@ -5,6 +5,7 @@
v-bind:is="component"
:isMax="isMax"
:show-btn="showBtn"
:show-version = "showVersion"
:expandedNode="expandedNode"
:scenario="scenario"
:controller="scenario"
@ -87,6 +88,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
currentScenario: {},
expandedNode: Array,
currentEnvironmentId: String,

View File

@ -7,6 +7,7 @@
:draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
color="#E6A23C"
background-color="#FCF6EE"
:if-from-variable-advance="ifFromVariableAdvance"
@ -57,6 +58,10 @@
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
index: Object,
draggable: {
type: Boolean,

View File

@ -8,6 +8,7 @@
:color="color"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
:background-color="backgroundColor"
:title="title" v-loading="loading">
@ -46,6 +47,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
isReadOnly: {
type: Boolean,
default:

View File

@ -8,6 +8,7 @@
:color="defColor"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
:background-color="defBackgroundColor"
:title="request.elementType">
<div style="height: 300px;width: 100%">
@ -56,6 +57,10 @@
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
request: {
type: Object,
},

View File

@ -8,6 +8,7 @@
:color="color"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
:background-color="backgroundColor"
:if-from-variable-advance="ifFromVariableAdvance"
:title="title" v-loading="loading">
@ -57,6 +58,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
isReadOnly: {
type: Boolean,
default:

View File

@ -1,7 +1,7 @@
<template>
<div>
<ms-run :debug="true" :environment="envMap" :reportId="reportId" :saved="false" :runMode="'DEFINITION'" :run-data="debugData" @runRefresh="runRefresh" ref="runTest"/>
<api-base-component :if-from-variable-advance="ifFromVariableAdvance" @copy="copyRow" @active="active(controller)" @remove="remove" :data="controller" :draggable="draggable" :is-max="isMax" :show-btn="showBtn" color="#02A7F0" background-color="#F4F4F5" :title="$t('api_test.automation.loop_controller')" v-loading="loading">
<api-base-component :if-from-variable-advance="ifFromVariableAdvance" @copy="copyRow" @active="active(controller)" @remove="remove" :data="controller" :draggable="draggable" :is-max="isMax" :show-btn="showBtn" :show-version="showVersion" color="#02A7F0" background-color="#F4F4F5" :title="$t('api_test.automation.loop_controller')" v-loading="loading">
<template v-slot:headerLeft>
<i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" style="margin-right: 10px" v-if="!isMax"/>
@ -107,6 +107,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
index: Object,
draggable: {
type: Boolean,

View File

@ -9,6 +9,7 @@
:color="defColor"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
:background-color="defBackgroundColor"
:title="pluginName">
@ -126,6 +127,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
request: {
type: Object,
},

View File

@ -7,6 +7,7 @@
:draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
color="#6D317C"
background-color="#FCF6EE"
:if-from-variable-advance="ifFromVariableAdvance"
@ -48,6 +49,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
index: Object,
draggable: {
type: Boolean,

View File

@ -1,6 +1,6 @@
<template>
<div class="compare-class">
<el-card style="width: 50%;" ref="old">
<el-card ref="old">
<el-card>
<div class="card-content">
<div class="ms-main-div" @click="showAll" >
@ -149,6 +149,8 @@
:type="data.type"
:scenario="data"
:node="node"
:env-map="projectEnvMap"
:show-version="false"
/>
</span>
</el-tree>
@ -160,7 +162,7 @@
</div>
</el-card>
</el-card>
<el-card style="width: 50%;" ref="new">
<el-card ref="new">
<el-card>
<div class="card-content">
<div class="ms-main-div" @click="showAll" v-if="type!=='detail'">
@ -309,6 +311,8 @@
:type="data.type"
:scenario="data"
:node="node"
:env-map="newProjectEnvMap"
:show-version="false"
/>
</span>
</el-tree>
@ -321,7 +325,6 @@
</div>
</el-card>
</el-card>
<button @click="getDiff"></button>
</div>
</template>
<script>
@ -374,8 +377,8 @@ export default{
oldEnableCookieShare:{},
oldOnSampleError:{},
newOnSampleError:{},
oldProjectEnvMap:{},
newProjectEnvMap:{},
projectEnvMap: {},
newProjectEnvMap: {},
type:{}
},
components:{
@ -411,7 +414,6 @@ export default{
stepEnable:true,
}
},
methods:{
@ -609,6 +611,11 @@ export default{
},
created() {
this.getWsProjects();
},
mounted() {
this.$nextTick(function () {
setTimeout(this.getDiff,(this.$refs.old.$children.length+1)*1000)
})
}
}

View File

@ -8,6 +8,7 @@
:draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
color="#A30014"
background-color="#F7E6E9"
:title="$t('api_test.definition.request.assertions_rule')">
@ -143,6 +144,10 @@ export default {
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
assertions: {},
node: {},
request: {},

View File

@ -7,6 +7,7 @@
:draggable="draggable"
:is-max="isMax"
:show-btn="showBtn"
:show-version="showVersion"
color="#015478"
background-color="#E6EEF2"
:if-from-variable-advance="ifFromVariableAdvance"
@ -86,6 +87,10 @@
type: Boolean,
default: true,
},
showVersion: {
type: Boolean,
default: true,
},
ifFromVariableAdvance: {
type: Boolean,
default: false,