fix(接口自动化): 修复历史数据升级问题,调整系统变量样式

This commit is contained in:
fit2-zhao 2021-04-30 11:19:39 +08:00 committed by fit2-zhao
parent e79f209665
commit 2cb10c1e03
3 changed files with 51 additions and 36 deletions

View File

@ -66,6 +66,8 @@ public class MsLoopController extends MsTestElement {
// 不打开执行成功后轮询功能则成功后就停止循环 // 不打开执行成功后轮询功能则成功后就停止循环
if (StringUtils.equals(this.loopType, LoopConstants.LOOP_COUNT.name()) && this.countController != null && !countController.isProceed()) { if (StringUtils.equals(this.loopType, LoopConstants.LOOP_COUNT.name()) && this.countController != null && !countController.isProceed()) {
ResultAction resultAction = new ResultAction(); ResultAction resultAction = new ResultAction();
resultAction.setProperty(TestElement.TEST_CLASS, ResultAction.class.getName());
resultAction.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ResultActionGui"));
resultAction.setName("ResultAction"); resultAction.setName("ResultAction");
resultAction.setProperty("OnError.action", "1000"); resultAction.setProperty("OnError.action", "1000");
groupTree.add(resultAction); groupTree.add(resultAction);

View File

@ -258,6 +258,7 @@ public class HistoricalDataUpgradeService {
if (StringUtils.isEmpty(preProcessor.getName())) { if (StringUtils.isEmpty(preProcessor.getName())) {
preProcessor.setName("JSR223PreProcessor"); preProcessor.setName("JSR223PreProcessor");
} }
preProcessor.setScriptLanguage(request.getJsr223PreProcessor().getLanguage());
preProcessor.setType("JSR223PreProcessor"); preProcessor.setType("JSR223PreProcessor");
preProcessor.setIndex(index + ""); preProcessor.setIndex(index + "");
preProcessor.setHashTree(new LinkedList<>()); preProcessor.setHashTree(new LinkedList<>());
@ -271,6 +272,7 @@ public class HistoricalDataUpgradeService {
if (StringUtils.isEmpty(preProcessor.getName())) { if (StringUtils.isEmpty(preProcessor.getName())) {
preProcessor.setName("JSR223PostProcessor"); preProcessor.setName("JSR223PostProcessor");
} }
preProcessor.setScriptLanguage(request.getJsr223PostProcessor().getLanguage());
preProcessor.setType("JSR223PostProcessor"); preProcessor.setType("JSR223PostProcessor");
preProcessor.setIndex(index + ""); preProcessor.setIndex(index + "");
preProcessor.setHashTree(new LinkedList<>()); preProcessor.setHashTree(new LinkedList<>());

View File

@ -1,44 +1,50 @@
<template> <template>
<el-form :model="condition" :rules="rules" ref="httpConfig" class="ms-el-form-item__content">
<el-form-item prop="socket">
<span class="ms-env-span">{{$t('api_test.environment.socket')}}</span>
<el-input v-model="condition.socket" style="width: 80%" :placeholder="$t('api_test.request.url_description')" clearable size="small" :disabled="httpConfig.isMock">
<template slot="prepend">
<el-select v-model="condition.protocol" class="request-protocol-select" size="small">
<el-option label="http://" value="http"/>
<el-option label="https://" value="https"/>
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item prop="enable">
<span class="ms-env-span">{{$t('api_test.environment.condition_enable')}}</span>
<el-radio-group v-model="condition.type" @change="typeChange" :disabled="condition.id!==undefined && condition.id!==''">
<el-radio label="NONE">{{ $t('api_test.definition.document.data_set.none') }}</el-radio>
<el-radio label="MODULE">{{$t('test_track.module.module')}}</el-radio>
<el-radio label="PATH">{{$t('api_test.definition.api_path')}}</el-radio>
</el-radio-group>
<el-button type="primary" v-if="!condition.id" style="float: right" size="mini" @click="add">{{$t('commons.add')}}</el-button>
<el-button type="primary" v-else style="float: right" size="mini" @click="update">{{$t('commons.update')}}</el-button>
<div v-if="condition.type === 'MODULE'"> <el-form :model="condition" :rules="rules" ref="httpConfig" class="ms-el-form-item__content">
<ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule" :obj="moduleObj" clearable checkStrictly multiple v-if="!loading"/> <div class="ms-border">
</div> <el-form-item prop="socket">
<div v-if="condition.type === 'PATH'"> <span class="ms-env-span">{{$t('api_test.environment.socket')}}</span>
<el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small"> <el-input v-model="condition.socket" style="width: 80%" :placeholder="$t('api_test.request.url_description')" clearable size="small" :disabled="httpConfig.isMock">
<template v-slot:prepend> <template slot="prepend">
<el-select v-model="pathDetails.value" class="request-protocol-select" size="small"> <el-select v-model="condition.protocol" class="request-protocol-select" size="small">
<el-option :label="$t('api_test.request.assertions.contains')" value="contains"/> <el-option label="http://" value="http"/>
<el-option :label="$t('commons.adv_search.operators.equals')" value="equals"/> <el-option label="https://" value="https"/>
</el-select> </el-select>
</template> </template>
</el-input> </el-input>
</div> </el-form-item>
<el-form-item prop="enable">
<span class="ms-env-span">{{$t('api_test.environment.condition_enable')}}</span>
<el-radio-group v-model="condition.type" @change="typeChange" :disabled="condition.id!==undefined && condition.id!==''">
<el-radio label="NONE">{{ $t('api_test.definition.document.data_set.none') }}</el-radio>
<el-radio label="MODULE">{{$t('test_track.module.module')}}</el-radio>
<el-radio label="PATH">{{$t('api_test.definition.api_path')}}</el-radio>
</el-radio-group>
<div v-if="condition.type === 'MODULE'" style="margin-top: 6px">
<ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule" :obj="moduleObj" clearable checkStrictly multiple v-if="!loading"/>
</div>
<div v-if="condition.type === 'PATH'" style="margin-top: 6px">
<el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small">
<template v-slot:prepend>
<el-select v-model="pathDetails.value" class="request-protocol-select" size="small">
<el-option :label="$t('api_test.request.assertions.contains')" value="contains"/>
<el-option :label="$t('commons.adv_search.operators.equals')" value="equals"/>
</el-select>
</template>
</el-input>
</div>
<p>{{$t('api_test.request.headers')}}</p> <p>{{$t('api_test.request.headers')}}</p>
<ms-api-key-value :items="condition.headers" :isShowEnable="true" :suggestions="headerSuggestions"/> <ms-api-key-value :items="condition.headers" :isShowEnable="true" :suggestions="headerSuggestions"/>
<div style="margin-top: 20px">
</el-form-item> <el-button v-if="!condition.id" type="primary" style="float: right" size="mini" @click="add">{{$t('commons.add')}}</el-button>
<div v-else>
<el-button type="primary" style="float: right;margin-left: 10px" size="mini" @click="clear">{{$t('commons.clear')}}</el-button>
<el-button type="primary" style="float: right" size="mini" @click="update">{{$t('commons.update')}}</el-button>
</div>
</div>
</el-form-item>
</div>
<div class="ms-border"> <div class="ms-border">
<el-table :data="httpConfig.conditions" highlight-current-row @current-change="selectRow" v-if="!loading"> <el-table :data="httpConfig.conditions" highlight-current-row @current-change="selectRow" v-if="!loading">
<el-table-column prop="socket" :label="$t('load_test.domain')" show-overflow-tooltip width="180"> <el-table-column prop="socket" :label="$t('load_test.domain')" show-overflow-tooltip width="180">
@ -195,7 +201,6 @@
}); });
} }
} }
this.reload();
}, },
typeChange() { typeChange() {
switch (this.condition.type) { switch (this.condition.type) {
@ -228,6 +233,9 @@
data.forEach((item) => { data.forEach((item) => {
this.condition.details.push(new KeyValue({name: item.name, value: item.id})); this.condition.details.push(new KeyValue({name: item.name, value: item.id}));
}); });
} else {
this.condition.ids = [];
this.condition.details = [];
} }
}, },
update() { update() {
@ -246,6 +254,9 @@
this.reload(); this.reload();
} }
}, },
clear() {
this.condition = {type: "NONE", details: [new KeyValue({name: "", value: "contains"})], protocol: "http", socket: "", domain: "", headers: [new KeyValue()]};
},
reload() { reload() {
this.loading = true this.loading = true
this.$nextTick(() => { this.$nextTick(() => {