fix(接口测试): 修复场景多数据源切换执行提示错误问题
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001012622
This commit is contained in:
parent
0b60824853
commit
d3587bd4c9
|
@ -345,6 +345,8 @@ export default {
|
|||
this.tabs = [];
|
||||
this.activeName = "default";
|
||||
this.isSave = false;
|
||||
// 清除vuex中缓存的环境
|
||||
this.$store.state.scenarioEnvMap = new Map();
|
||||
} else {
|
||||
this.isSave = false;
|
||||
}
|
||||
|
@ -384,7 +386,6 @@ export default {
|
|||
},
|
||||
diff(t) {
|
||||
if (t.currentScenario.type !== "add") {
|
||||
|
||||
let v1 = t.currentScenario.scenarioDefinitionOrg;
|
||||
let v2 = {
|
||||
apiScenarioModuleId: t.currentScenario.apiScenarioModuleId,
|
||||
|
@ -506,11 +507,6 @@ export default {
|
|||
if (tab && this.isSave) {
|
||||
message += tab.currentScenario.name + ",";
|
||||
}
|
||||
if (tab) {
|
||||
let index = this.tabs.filter(t => t === tab);
|
||||
index.splice(0, 1);
|
||||
tab = undefined;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (message !== "") {
|
||||
|
@ -535,6 +531,22 @@ export default {
|
|||
}
|
||||
},
|
||||
removeTab(targetName) {
|
||||
let index = this.tabs.findIndex(item => item.name === targetName);
|
||||
if (index !== -1) {
|
||||
// 清除vuex中缓存的环境
|
||||
let tab = this.tabs[index];
|
||||
if (tab && tab.currentScenario && this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map) {
|
||||
this.$store.state.scenarioEnvMap.forEach((v, k) => {
|
||||
if (k.indexOf(tab.currentScenario.id) !== -1) {
|
||||
this.$store.state.scenarioEnvMap.delete(k);
|
||||
}
|
||||
})
|
||||
}
|
||||
this.tabs.splice(index, 1);
|
||||
if (tab) {
|
||||
tab = undefined;
|
||||
}
|
||||
}
|
||||
this.tabs = this.tabs.filter(tab => tab.name !== targetName);
|
||||
if (this.tabs.length > 0) {
|
||||
this.activeName = this.tabs[this.tabs.length - 1].name;
|
||||
|
@ -542,10 +554,6 @@ export default {
|
|||
} else {
|
||||
this.activeName = "default";
|
||||
}
|
||||
let index = this.tabs.findIndex(item => item.name === targetName);
|
||||
if (index !== -1) {
|
||||
this.tabs.splice(index, 1);
|
||||
}
|
||||
},
|
||||
setTabLabel(data) {
|
||||
for (const tab of this.tabs) {
|
||||
|
|
|
@ -1583,7 +1583,12 @@ export default {
|
|||
// 兼容历史数据
|
||||
this.projectEnvMap.set(this.projectId, obj.environmentId);
|
||||
}
|
||||
this.$store.state.scenarioEnvMap = this.projectEnvMap;
|
||||
if (!this.$store.state.scenarioEnvMap || !(this.$store.state.scenarioEnvMap instanceof Map)) {
|
||||
this.$store.state.scenarioEnvMap = new Map();
|
||||
}
|
||||
this.projectEnvMap.forEach((v, k) => {
|
||||
this.$store.state.scenarioEnvMap.set(this.currentScenario.id + "_" + k, v);
|
||||
})
|
||||
this.envGroupId = response.data.environmentGroupId;
|
||||
if (response.data.environmentType) {
|
||||
this.environmentType = response.data.environmentType;
|
||||
|
@ -1777,7 +1782,15 @@ export default {
|
|||
},
|
||||
setProjectEnvMap(projectEnvMap) {
|
||||
this.projectEnvMap = projectEnvMap;
|
||||
this.$store.state.scenarioEnvMap = projectEnvMap;
|
||||
if (!this.$store.state.scenarioEnvMap) {
|
||||
this.$store.state.scenarioEnvMap = new Map();
|
||||
}
|
||||
let map = objToStrMap(JSON.parse(JSON.stringify(this.$store.state.scenarioEnvMap)));
|
||||
this.projectEnvMap.forEach((v, k) => {
|
||||
let key = this.currentScenario.id + "_" + k;
|
||||
map.set(key, v);
|
||||
});
|
||||
this.$store.state.scenarioEnvMap = map;
|
||||
this.setDomain(true);
|
||||
},
|
||||
setEnvGroup(id) {
|
||||
|
|
|
@ -99,10 +99,7 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
@ -189,9 +186,10 @@ export default {
|
|||
getEnvironments() {
|
||||
let envId = "";
|
||||
let id = this.request.projectId ? this.request.projectId : this.projectId;
|
||||
let scenarioEnvId = this.isScenario ? (this.isScenario + "_" + id) : id;
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(id)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(id);
|
||||
&& this.$store.state.scenarioEnvMap.has(scenarioEnvId)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId);
|
||||
}
|
||||
if (this.request.referenced === 'Created' && this.isScenario && !this.request.isRefEnvironment) {
|
||||
this.itselfEnvironment();
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
:isShowEnable="true"
|
||||
:response="response"
|
||||
:referenced="true"
|
||||
:isScenario="true"
|
||||
:isScenario="currentScenario.id"
|
||||
:headers="request.headers "
|
||||
:is-read-only="isCompReadOnly"
|
||||
:request="request"/>
|
||||
|
@ -101,21 +101,21 @@
|
|||
:is-read-only="isCompReadOnly"
|
||||
:response="response"
|
||||
:show-pre-script="true"
|
||||
:isScenario="true"
|
||||
:isScenario="currentScenario.id"
|
||||
:show-script="true" :request="request"/>
|
||||
|
||||
<ms-sql-basis-parameters
|
||||
v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
|
||||
:request="request"
|
||||
:response="response"
|
||||
:isScenario="true"
|
||||
:isScenario="currentScenario.id"
|
||||
:is-read-only="isCompReadOnly"
|
||||
:showScript="true"/>
|
||||
|
||||
<ms-dubbo-basis-parameters
|
||||
v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
|
||||
:request="request"
|
||||
:isScenario="true"
|
||||
:isScenario="currentScenario.id"
|
||||
:response="response"
|
||||
:is-read-only="isCompReadOnly"
|
||||
:showScript="true"/>
|
||||
|
@ -252,7 +252,11 @@ export default {
|
|||
this.request.projectId = getCurrentProjectID();
|
||||
}
|
||||
this.request.customizeReq = this.isCustomizeReq;
|
||||
|
||||
this.request.currentScenarioId = this.currentScenario.id;
|
||||
// 传递场景ID
|
||||
if (this.request.hashTree) {
|
||||
this.setOwnEnvironment(this.request.hashTree);
|
||||
}
|
||||
if (this.request.num) {
|
||||
this.isShowNum = true;
|
||||
this.request.root = true;
|
||||
|
@ -357,6 +361,17 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
setOwnEnvironment(scenarioDefinition) {
|
||||
for (let i in scenarioDefinition) {
|
||||
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
|
||||
if (typeArray.indexOf(scenarioDefinition[i].type) !== -1) {
|
||||
scenarioDefinition[i].currentScenarioId = this.currentScenario.id;
|
||||
}
|
||||
if (scenarioDefinition[i].hashTree !== undefined && scenarioDefinition[i].hashTree.length > 0) {
|
||||
this.setOwnEnvironment(scenarioDefinition[i].hashTree);
|
||||
}
|
||||
}
|
||||
},
|
||||
forStatus() {
|
||||
this.reqSuccess = true;
|
||||
if (this.request.result && this.request.result.length > 0) {
|
||||
|
|
|
@ -35,10 +35,7 @@ export default {
|
|||
ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit
|
||||
},
|
||||
props: {
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
draggable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -149,10 +149,7 @@ export default {
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
@ -279,9 +276,10 @@ export default {
|
|||
getEnvironments() {
|
||||
let envId = "";
|
||||
let id = this.request.projectId ? this.request.projectId : this.projectId;
|
||||
let scenarioEnvId = this.request.currentScenarioId ? (this.request.currentScenarioId + "_" + id) : id;
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(id)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(id);
|
||||
&& this.$store.state.scenarioEnvMap.has(scenarioEnvId)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId);
|
||||
}
|
||||
if (this.request.referenced === 'Created' && this.isScenario && !this.request.isRefEnvironment) {
|
||||
this.itselfEnvironment();
|
||||
|
|
|
@ -116,10 +116,7 @@ export default {
|
|||
MsJmxStep
|
||||
},
|
||||
props: {
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
request: {},
|
||||
basisData: {},
|
||||
moduleOptions: Array,
|
||||
|
|
|
@ -210,10 +210,7 @@ export default {
|
|||
return false;
|
||||
}
|
||||
},
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
showScript: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
|
|
@ -202,10 +202,7 @@ export default {
|
|||
MsJmxStep
|
||||
},
|
||||
props: {
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
request: {},
|
||||
basisData: {},
|
||||
response: {},
|
||||
|
|
|
@ -139,10 +139,7 @@ export default {
|
|||
tabType: String,
|
||||
response: {},
|
||||
apiId: String,
|
||||
isScenario: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isScenario: String,
|
||||
showScript: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
|
Loading…
Reference in New Issue