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

View File

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

View File

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

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

View File

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

View File

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

View File

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