fix: 修复引用的场景无法复制的问题

修复引用的场景无法复制的问题
This commit is contained in:
song-tianyang 2021-06-16 18:54:18 +08:00 committed by fit2-zhao
parent 6247454d0b
commit ea1ae44dd3
3 changed files with 40 additions and 14 deletions

View File

@ -238,10 +238,14 @@ public class MsTCPSampler extends MsTestElement {
this.parameters.forEach(item -> { this.parameters.forEach(item -> {
names.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), item.getName())); names.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), item.getName()));
String value = item.getValue(); String value = item.getValue();
if(StringUtils.isNotEmpty(value)){
value = this.formatMockValue(value); value = this.formatMockValue(value);
if(StringUtils.isNotEmpty(this.getConnectEncoding())){ if(StringUtils.isNotEmpty(this.getConnectEncoding())){
if(StringUtils.equalsIgnoreCase("utf-8",this.getConnectEncoding())){ if(StringUtils.equalsIgnoreCase("utf-8",this.getConnectEncoding())){
try {
value = new String(value.getBytes(),StandardCharsets.UTF_8); value = new String(value.getBytes(),StandardCharsets.UTF_8);
}catch (Exception e){
}
}else if(StringUtils.equalsIgnoreCase("gbk",this.getConnectEncoding())){ }else if(StringUtils.equalsIgnoreCase("gbk",this.getConnectEncoding())){
try { try {
value = new String(value.getBytes(),"GBK"); value = new String(value.getBytes(),"GBK");
@ -250,6 +254,7 @@ public class MsTCPSampler extends MsTestElement {
} }
} }
threadValues.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), value)); threadValues.add(new StringProperty(new Integer(new Random().nextInt(1000000)).toString(), value));
}
}); });
} }
userParameters.setNames(new CollectionProperty(UserParameters.NAMES, names)); userParameters.setNames(new CollectionProperty(UserParameters.NAMES, names));

View File

@ -31,25 +31,33 @@
<template v-slot:request> <template v-slot:request>
<customize-req-info :is-customize-req="isCustomizeReq" :request="request"/> <customize-req-info :is-customize-req="isCustomizeReq" :request="request"/>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p> <p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<legend style="width: 100%">
<ms-api-request-form v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'" <ms-api-request-form v-if="request.protocol==='HTTP' || request.type==='HTTPSamplerProxy'"
:isShowEnable="true" :isShowEnable="true"
:referenced="true" :referenced="true"
:headers="request.headers " :headers="request.headers "
:is-read-only="isCompReadOnly"
:request="request"/> :request="request"/>
<esb-definition v-if="showXpackCompnent&&request.esbDataStruct!=null" <esb-definition v-if="showXpackCompnent&&request.esbDataStruct!=null"
v-xpack v-xpack
:request="request" :request="request"
:showScript="false" :showScript="false"
:is-read-only="isCompReadOnly"
ref="esbDefinition"/> ref="esbDefinition"/>
<ms-tcp-basis-parameters v-if="(request.protocol==='TCP'|| request.type==='TCPSampler')&& request.esbDataStruct==null " <ms-tcp-basis-parameters v-if="(request.protocol==='TCP'|| request.type==='TCPSampler')&& request.esbDataStruct==null "
:request="request" :request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/> :showScript="false"/>
<ms-sql-basis-parameters v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'" <ms-sql-basis-parameters v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
:request="request" :request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/> :showScript="false"/>
<ms-dubbo-basis-parameters v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" <ms-dubbo-basis-parameters v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
:request="request" :request="request"
:is-read-only="isCompReadOnly"
:showScript="false"/> :showScript="false"/>
</legend>
</template> </template>
<!-- 执行结果内容 --> <!-- 执行结果内容 -->
<template v-slot:result> <template v-slot:result>
@ -192,6 +200,17 @@ export default {
} }
return {}; return {};
}, },
isCompReadOnly(){
if(this.request){
if(this.request.disabled){
return this.request.disabled;
}else {
return false;
}
}else {
return false;
}
},
displayTitle() { displayTitle() {
if (this.isApiImport) { if (this.isApiImport) {
return this.$t('api_test.automation.api_list_import'); return this.$t('api_test.automation.api_list_import');

View File

@ -11,11 +11,13 @@
:background-color="backgroundColor" :background-color="backgroundColor"
:title="title" v-loading="loading"> :title="title" v-loading="loading">
<legend style="width: 100%">
<jsr233-processor-content <jsr233-processor-content
:jsr223-processor="jsr223Processor" :jsr223-processor="jsr223Processor"
:is-pre-processor="isPreProcessor" :is-pre-processor="isPreProcessor"
:node="node" :node="node"
:is-read-only="isReadOnly"/> :is-read-only="this.jsr223Processor.disabled"/>
</legend>
</api-base-component> </api-base-component>
</template> </template>