fix(接口测试): 修复插件数据源不能动态切换问题
This commit is contained in:
parent
9ad0401fe3
commit
fc1d966cb2
|
@ -210,6 +210,7 @@ public class ApiScenarioImportUtil {
|
||||||
object.put("resourceId", test.getId());
|
object.put("resourceId", test.getId());
|
||||||
object.put("projectId", projectId);
|
object.put("projectId", projectId);
|
||||||
object.put("useEnvironment","");
|
object.put("useEnvironment","");
|
||||||
|
object.put("environmentId","");
|
||||||
object.put("url","");
|
object.put("url","");
|
||||||
JSONObject objectNew = JSONObject.parseObject(object.toJSONString(), Feature.DisableSpecialKeyDetect);
|
JSONObject objectNew = JSONObject.parseObject(object.toJSONString(), Feature.DisableSpecialKeyDetect);
|
||||||
objectNew.remove("refType");
|
objectNew.remove("refType");
|
||||||
|
@ -252,6 +253,7 @@ public class ApiScenarioImportUtil {
|
||||||
object.put("resourceId", apiTestCase.getId());
|
object.put("resourceId", apiTestCase.getId());
|
||||||
object.put("projectId", projectId);
|
object.put("projectId", projectId);
|
||||||
object.put("useEnvironment","");
|
object.put("useEnvironment","");
|
||||||
|
object.put("environmentId","");
|
||||||
JSONObject objectNew = JSONObject.parseObject(object.toJSONString(),Feature.DisableSpecialKeyDetect);
|
JSONObject objectNew = JSONObject.parseObject(object.toJSONString(),Feature.DisableSpecialKeyDetect);
|
||||||
objectNew.remove("refType");
|
objectNew.remove("refType");
|
||||||
objectNew.remove("referenced");
|
objectNew.remove("referenced");
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<div class="el-step__icon-inner">{{ request.preSize }}</div>
|
<div class="el-step__icon-inner">{{ request.preSize }}</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<ms-jmx-step :request="request" :apiId="request.id" :response="response" :tab-type="'pre'" ref="preStep"/>
|
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" :tab-type="'pre'" ref="preStep"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate">
|
<el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate">
|
||||||
<span class="item-tabs" effect="dark" placement="top-start" slot="label">
|
<span class="item-tabs" effect="dark" placement="top-start" slot="label">
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<div class="el-step__icon-inner">{{ request.postSize }}</div>
|
<div class="el-step__icon-inner">{{ request.postSize }}</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<ms-jmx-step :request="request" :apiId="request.id" :response="response" :tab-type="'post'" ref="postStep"/>
|
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" :tab-type="'post'" ref="postStep"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule">
|
<el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule">
|
||||||
<span class="item-tabs" effect="dark" placement="top-start" slot="label">
|
<span class="item-tabs" effect="dark" placement="top-start" slot="label">
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<div style="margin-right: 20px">
|
<div style="margin-right: 20px">
|
||||||
<ms-jmx-step :request="request" :apiId="request.id" :response="response" @reload="reload" :tab-type="'assertionsRule'" ref="assertionsRule"/>
|
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" @reload="reload" :tab-type="'assertionsRule'" ref="assertionsRule"/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
|
|
@ -348,11 +348,15 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
singleRun(data) {
|
singleRun(data) {
|
||||||
if (this.api.protocol !== "SQL" && this.api.protocol != "DUBBO" && this.api.protocol != "dubbo://" && !this.environment) {
|
if (data.apiMethod !== "SQL" && data.apiMethod !== "DUBBO" && data.apiMethod !== "dubbo://" && data.apiMethod !== "TCP" && !this.environment) {
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data.request.useEnvironment = this.environment;
|
if (data.apiMethod !== "SQL" && data.apiMethod !== "DUBBO" && data.apiMethod !== "dubbo://" && data.apiMethod !== "TCP") {
|
||||||
|
data.request.useEnvironment = this.environment;
|
||||||
|
} else {
|
||||||
|
data.request.useEnvironment = data.request.environmentId;
|
||||||
|
}
|
||||||
this.$emit('singleRun', data);
|
this.$emit('singleRun', data);
|
||||||
},
|
},
|
||||||
stop(data) {
|
stop(data) {
|
||||||
|
|
|
@ -386,7 +386,7 @@ export default {
|
||||||
this.$emit('showExecResult', row);
|
this.$emit('showExecResult', row);
|
||||||
},
|
},
|
||||||
singleRun(row) {
|
singleRun(row) {
|
||||||
if (this.currentApi.protocol !== "SQL" && this.currentApi.protocol !== "DUBBO" && this.currentApi.protocol !== "dubbo://" && !this.environment) {
|
if (row.apiMethod !== "SQL" && row.apiMethod !== "DUBBO" && row.apiMethod !== "dubbo://" && row.apiMethod !== "TCP" && !this.environment) {
|
||||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,11 @@ export default {
|
||||||
this.singleLoading = true;
|
this.singleLoading = true;
|
||||||
this.singleRunId = row.id;
|
this.singleRunId = row.id;
|
||||||
row.request.name = row.id;
|
row.request.name = row.id;
|
||||||
row.request.useEnvironment = this.environment;
|
if (row.apiMethod !== "SQL" && row.apiMethod !== "DUBBO" && row.apiMethod !== "dubbo://" && row.apiMethod !== "TCP") {
|
||||||
|
row.request.useEnvironment = this.environment;
|
||||||
|
} else {
|
||||||
|
row.request.useEnvironment = row.request.environmentId;
|
||||||
|
}
|
||||||
row.request.projectId = this.projectId;
|
row.request.projectId = this.projectId;
|
||||||
row.request.id = row.id;
|
row.request.id = row.id;
|
||||||
this.runData.push(row.request);
|
this.runData.push(row.request);
|
||||||
|
|
|
@ -63,10 +63,7 @@
|
||||||
:description="$t('api_test.scenario.kv_description')"/>
|
:description="$t('api_test.scenario.kv_description')"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.request.sql.sql_script')" name="sql">
|
<el-tab-pane :label="$t('api_test.request.sql.sql_script')" name="sql">
|
||||||
<div class="sql-content">
|
<ms-code-edit mode="sql" :read-only="isReadOnly" :modes="['sql']" :data.sync="request.query" :height="200" theme="eclipse" ref="codeEdit"/>
|
||||||
<ms-code-edit mode="sql" :read-only="isReadOnly" :modes="['sql']" :data.sync="request.query"
|
|
||||||
theme="eclipse" ref="codeEdit"/>
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- 脚本步骤/断言步骤 -->
|
<!-- 脚本步骤/断言步骤 -->
|
||||||
<el-tab-pane :label="$t('api_test.definition.request.pre_operation')" name="preOperate" v-if="showScript">
|
<el-tab-pane :label="$t('api_test.definition.request.pre_operation')" name="preOperate" v-if="showScript">
|
||||||
|
|
Loading…
Reference in New Issue