This commit is contained in:
chenjianxing 2020-09-23 18:06:30 +08:00
commit dced33e977
7 changed files with 29 additions and 24 deletions

View File

@ -3,9 +3,11 @@ package io.metersphere.api.dto.scenario.request;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import io.metersphere.api.dto.scenario.assertions.Assertions;
import io.metersphere.api.dto.scenario.controller.IfController;
import io.metersphere.api.dto.scenario.extract.Extract;
import io.metersphere.api.dto.scenario.processor.JSR223PostProcessor;
import io.metersphere.api.dto.scenario.processor.JSR223PreProcessor;
import io.metersphere.api.dto.scenario.timer.ConstantTimer;
import lombok.Data;
@Data
@ -41,4 +43,8 @@ public class SqlRequest implements Request {
private String resultVariable;
@JSONField(ordinal = 14)
private String variableNames;
@JSONField(ordinal = 15)
private IfController controller;
@JSONField(ordinal = 16)
private ConstantTimer timer;
}

View File

@ -12,7 +12,7 @@
</el-select>
</el-col>
<el-col :span="6">
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasNullOperator"/>
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')" v-if="!hasEmptyOperator"/>
</el-col>
<el-col :span="4">
<el-switch v-model="controller.enable" :inactive-text="$t('api_test.scenario.enable_disable')"/>
@ -60,13 +60,13 @@ export default {
label: "commons.adv_search.operators.lt",
value: "<"
},
IS_NULL: {
label: "commons.adv_search.operators.is_null",
value: "is null"
IS_EMPTY: {
label: "commons.adv_search.operators.is_empty",
value: "is empty"
},
IS_NOT_NULL: {
label: "commons.adv_search.operators.is_not_null",
value: "is not null"
IS_NOT_EMPTY: {
label: "commons.adv_search.operators.is_not_empty",
value: "is not empty"
}
}
}
@ -89,14 +89,14 @@ export default {
this.visible = false;
},
change(value) {
if (value.indexOf("null") > 0) {
if (value.indexOf("empty") > 0 && !!this.controller.value) {
this.controller.value = "";
}
}
},
computed: {
hasNullOperator() {
return !!this.controller.operator && this.controller.operator.indexOf("null") > 0;
hasEmptyOperator() {
return !!this.controller.operator && this.controller.operator.indexOf("empty") > 0;
}
}
}

View File

@ -306,8 +306,8 @@ export class Request extends BaseConfig {
super();
this.type = type;
options.id = options.id || uuid();
options.timer = new ConstantTimer(options.timer);
options.controller = new IfController(options.controller);
this.timer = options.timer = new ConstantTimer(options.timer);
this.controller = options.controller = new IfController(options.controller);
}
showType() {
@ -484,7 +484,7 @@ export class DubboRequest extends Request {
export class SqlRequest extends Request {
constructor(options = {}) {
super(RequestFactory.TYPES.SQL);
super(RequestFactory.TYPES.SQL, options);
this.id = options.id || uuid();
this.name = options.name;
this.useEnvironment = options.useEnvironment;
@ -502,7 +502,6 @@ export class SqlRequest extends Request {
this.jsr223PostProcessor = new JSR223Processor(options.jsr223PostProcessor);
this.sets({args: KeyValue, attachmentArgs: KeyValue}, options);
}
isValid() {
@ -879,7 +878,7 @@ export class IfController extends Controller {
}
isValid() {
if (!!this.operator && this.operator.indexOf("null") > 0) {
if (!!this.operator && this.operator.indexOf("empty") > 0) {
return !!this.variable && !!this.operator;
}
return !!this.variable && !!this.operator && !!this.value;
@ -1247,13 +1246,13 @@ class JMXGenerator {
value = "\".*" + value + ".*\"";
}
if (operator === "is null") {
if (operator === "is empty") {
variable = "empty(\"" + variable + "\")";
operator = "";
value = "";
}
if (operator === "is not null") {
if (operator === "is not empty") {
variable = "!empty(\"" + variable + "\")";
operator = "";
value = "";

@ -1 +1 @@
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
Subproject commit 17422063acb5936497660a35675e88eba997e767

View File

@ -142,8 +142,8 @@ export default {
and: 'All',
or: 'any one',
operators: {
is_null: "Is null",
is_not_null: "Is not null",
is_empty: "Is empty",
is_not_empty: "Is not empty",
like: "Contains",
not_like: "Not included",
in: "Belong to",

View File

@ -142,8 +142,8 @@ export default {
and: '所有',
or: '任意一个',
operators: {
is_null: "空",
is_not_null: "非空",
is_empty: "空",
is_not_empty: "非空",
like: "包含",
not_like: "不包含",
in: "属于",

View File

@ -142,8 +142,8 @@ export default {
and: '所有',
or: '任意壹個',
operators: {
is_null: "空",
is_not_null: "非空",
is_empty: "空",
is_not_empty: "非空",
like: "包含",
not_like: "不包含",
in: "屬於",