Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
70ce2eae17
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TestCaseCommentService {
|
|||
testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId());
|
||||
SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest();
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add(testCaseComment.getAuthor());
|
||||
userIds.add(testCaseWithBLOBs.getMaintainer());
|
||||
mailService.sendHtml(userIds, "comment", caseReviewRequest, request, testCaseWithBLOBs);
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 141ee64787b4a28ef108c5fa4dde90446de01887
|
||||
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
|
|
@ -33,12 +33,13 @@
|
|||
:description="$t('api_test.scenario.kv_description')"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
||||
<ms-api-key-value :is-read-only="isReadOnly" :isShowEnable="true" :items="scenario.headers" :suggestions="headerSuggestions"
|
||||
<ms-api-key-value :is-read-only="isReadOnly" :isShowEnable="true" :items="scenario.headers"
|
||||
:suggestions="headerSuggestions"
|
||||
:environment="scenario.environment"
|
||||
:description="$t('api_test.scenario.kv_description')"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.environment.database_config')" name="database">
|
||||
<ms-database-config :configs="scenario.databaseConfigs"/>
|
||||
<ms-database-config :configs="scenario.databaseConfigs" :is-read-only="isReadOnly"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.scenario.dubbo')" name="dubbo">
|
||||
<div class="dubbo-config-title">Config Center</div>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<span class="environment-name">{{ request.environment ? request.environment.name + ': ' : '' }}</span>
|
||||
<span class="environment-url">{{ displayUrl }}</span>
|
||||
<span v-if="!displayUrl"
|
||||
class="environment-url-tip">{{ $t('api_test.request.please_configure_environment_in_scenario') }}</span>
|
||||
class="environment-url-tip">{{ $t('api_test.request.please_configure_socket_in_environment') }}</span>
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
<el-input size="small" v-model="controller.variable" :placeholder="$t('api_test.request.condition_variable')"/>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small">
|
||||
<el-select v-model="controller.operator" :placeholder="$t('commons.please_select')" size="small"
|
||||
@change="change">
|
||||
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-input size="small" v-model="controller.value" :placeholder="$t('api_test.value')"/>
|
||||
<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')"/>
|
||||
|
@ -58,6 +59,14 @@ export default {
|
|||
LT: {
|
||||
label: "commons.adv_search.operators.lt",
|
||||
value: "<"
|
||||
},
|
||||
IS_EMPTY: {
|
||||
label: "commons.adv_search.operators.is_empty",
|
||||
value: "is empty"
|
||||
},
|
||||
IS_NOT_EMPTY: {
|
||||
label: "commons.adv_search.operators.is_not_empty",
|
||||
value: "is not empty"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +87,16 @@ export default {
|
|||
remove() {
|
||||
this.controller = new IfController();
|
||||
this.visible = false;
|
||||
},
|
||||
change(value) {
|
||||
if (value.indexOf("empty") > 0 && !!this.controller.value) {
|
||||
this.controller.value = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
hasEmptyOperator() {
|
||||
return !!this.controller.operator && this.controller.operator.indexOf("empty") > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<ms-database-from :config="currentConfig" :callback="saveConfig" ref="databaseFrom"/>
|
||||
<ms-database-from :config="currentConfig" :callback="saveConfig" ref="databaseFrom" :is-read-only="isReadOnly"/>
|
||||
<ms-database-config-list @rowSelect="rowSelect" v-if="configs.length > 0" :table-data="configs"/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -9,7 +9,7 @@
|
|||
import MsDatabaseConfigList from "./DatabaseConfigList";
|
||||
import {DatabaseConfig} from "../../../model/ScenarioModel";
|
||||
import MsDatabaseFrom from "./DatabaseFrom";
|
||||
import {getUUID} from "../../../../../../../common/js/utils";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "MsDatabaseConfig",
|
||||
|
@ -30,7 +30,7 @@
|
|||
methods: {
|
||||
saveConfig(config) {
|
||||
for (let item of this.configs) {
|
||||
if (item.name === config.name && item.id != config.id) {
|
||||
if (item.name === config.name && item.id !== config.id) {
|
||||
this.$warning(this.$t('commons.already_exists'));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ export class Scenario extends BaseConfig {
|
|||
isValid() {
|
||||
if (this.enable) {
|
||||
for (let i = 0; i < this.requests.length; i++) {
|
||||
let validator = this.requests[i].isValid(this.environmentId);
|
||||
let validator = this.requests[i].isValid(this.environmentId, this.environment);
|
||||
if (!validator.isValid) {
|
||||
return validator;
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -357,7 +357,7 @@ export class HttpRequest extends Request {
|
|||
return options;
|
||||
}
|
||||
|
||||
isValid(environmentId) {
|
||||
isValid(environmentId, environment) {
|
||||
if (this.enable) {
|
||||
if (this.useEnvironment) {
|
||||
if (!environmentId) {
|
||||
|
@ -366,6 +366,12 @@ export class HttpRequest extends Request {
|
|||
info: 'api_test.request.please_configure_environment_in_scenario'
|
||||
}
|
||||
}
|
||||
if (!environment.config.httpConfig.socket) {
|
||||
return {
|
||||
isValid: false,
|
||||
info: 'api_test.request.please_configure_socket_in_environment'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!this.url) {
|
||||
return {
|
||||
|
@ -478,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;
|
||||
|
@ -496,7 +502,6 @@ export class SqlRequest extends Request {
|
|||
this.jsr223PostProcessor = new JSR223Processor(options.jsr223PostProcessor);
|
||||
|
||||
this.sets({args: KeyValue, attachmentArgs: KeyValue}, options);
|
||||
|
||||
}
|
||||
|
||||
isValid() {
|
||||
|
@ -873,14 +878,17 @@ export class IfController extends Controller {
|
|||
}
|
||||
|
||||
isValid() {
|
||||
if (!!this.operator && this.operator.indexOf("empty") > 0) {
|
||||
return !!this.variable && !!this.operator;
|
||||
}
|
||||
return !!this.variable && !!this.operator && !!this.value;
|
||||
}
|
||||
|
||||
label() {
|
||||
if (this.isValid()) {
|
||||
let label = this.variable;
|
||||
label += " " + this.operator;
|
||||
label += " " + this.value;
|
||||
if (this.operator) label += " " + this.operator;
|
||||
if (this.value) label += " " + this.value;
|
||||
return label;
|
||||
}
|
||||
return "";
|
||||
|
@ -1053,7 +1061,7 @@ class JMXGenerator {
|
|||
|
||||
this.addScenarioCookieManager(threadGroup, scenario);
|
||||
// 放在计划或线程组中,不建议放具体某个请求中
|
||||
this.addDNSCacheManager(threadGroup, scenario.requests[0]);
|
||||
this.addDNSCacheManager(threadGroup, scenario);
|
||||
|
||||
this.addJDBCDataSources(threadGroup, scenario);
|
||||
|
||||
|
@ -1135,7 +1143,11 @@ class JMXGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
addDNSCacheManager(threadGroup, request) {
|
||||
addDNSCacheManager(threadGroup, scenario) {
|
||||
if (scenario.requests.length < 1) {
|
||||
return
|
||||
}
|
||||
let request = scenario.requests[0];
|
||||
if (request.environment) {
|
||||
let commonConfig = request.environment.config.commonConfig;
|
||||
let hosts = commonConfig.hosts;
|
||||
|
@ -1234,6 +1246,18 @@ class JMXGenerator {
|
|||
value = "\".*" + value + ".*\"";
|
||||
}
|
||||
|
||||
if (operator === "is empty") {
|
||||
variable = "empty(\"" + variable + "\")";
|
||||
operator = "";
|
||||
value = "";
|
||||
}
|
||||
|
||||
if (operator === "is not empty") {
|
||||
variable = "!empty(\"" + variable + "\")";
|
||||
operator = "";
|
||||
value = "";
|
||||
}
|
||||
|
||||
let condition = "${__jexl3(" + variable + operator + value + ")}";
|
||||
let controller = new JMXIfController(name, {condition: condition});
|
||||
controller.put(sampler);
|
||||
|
|
|
@ -26,6 +26,9 @@ const router = new VueRouter({
|
|||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
|
||||
redirectLoginPath(to.fullPath);
|
||||
|
||||
//解决localStorage清空,cookie没失效导致的卡死问题
|
||||
if (!localStorage.getItem('Admin-Token')) {
|
||||
axios.get("/signout");
|
||||
|
@ -38,4 +41,17 @@ router.beforeEach((to, from, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
// 登入后跳转至原路径
|
||||
function redirectLoginPath(originPath) {
|
||||
let redirectUrl = sessionStorage.getItem('redirectUrl');
|
||||
let loginSuccess = sessionStorage.getItem('loginSuccess');
|
||||
sessionStorage.setItem('redirectUrl', originPath);
|
||||
if (redirectUrl && loginSuccess) {
|
||||
sessionStorage.removeItem('loginSuccess');
|
||||
router.push(redirectUrl);
|
||||
}
|
||||
sessionStorage.removeItem('loginSuccess');
|
||||
}
|
||||
|
||||
|
||||
export default router
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
|
||||
Subproject commit 17422063acb5936497660a35675e88eba997e767
|
|
@ -142,6 +142,8 @@ export default {
|
|||
and: 'All',
|
||||
or: 'any one',
|
||||
operators: {
|
||||
is_empty: "Is empty",
|
||||
is_not_empty: "Is not empty",
|
||||
like: "Contains",
|
||||
not_like: "Not included",
|
||||
in: "Belong to",
|
||||
|
@ -464,6 +466,7 @@ export default {
|
|||
path: "Path",
|
||||
address: "Address",
|
||||
refer_to_environment: "Use Environment",
|
||||
please_configure_socket_in_environment: "Please Configure Path In The Environment",
|
||||
please_configure_environment_in_scenario: "Please Configure Environment In The Scenario",
|
||||
please_add_environment_to_scenario: "Please Add The Environment Configuration To The Scenario First",
|
||||
url_description: "etc: https://fit2cloud.com",
|
||||
|
|
|
@ -142,6 +142,8 @@ export default {
|
|||
and: '所有',
|
||||
or: '任意一个',
|
||||
operators: {
|
||||
is_empty: "空",
|
||||
is_not_empty: "非空",
|
||||
like: "包含",
|
||||
not_like: "不包含",
|
||||
in: "属于",
|
||||
|
@ -464,6 +466,7 @@ export default {
|
|||
path: "请求路径",
|
||||
address: "请求地址",
|
||||
refer_to_environment: "引用环境",
|
||||
please_configure_socket_in_environment: "请在环境中配置环境域名",
|
||||
please_configure_environment_in_scenario: "请在场景中配置环境",
|
||||
please_add_environment_to_scenario: "请先在场景中添加环境配置",
|
||||
url_description: "例如:https://fit2cloud.com",
|
||||
|
|
|
@ -142,6 +142,8 @@ export default {
|
|||
and: '所有',
|
||||
or: '任意壹個',
|
||||
operators: {
|
||||
is_empty: "空",
|
||||
is_not_empty: "非空",
|
||||
like: "包含",
|
||||
not_like: "不包含",
|
||||
in: "屬於",
|
||||
|
@ -464,6 +466,7 @@ export default {
|
|||
path: "請求路徑",
|
||||
address: "請求地址",
|
||||
refer_to_environment: "引用環境",
|
||||
please_configure_socket_in_environment: "請在環境中配置環境域名",
|
||||
please_configure_environment_in_scenario: "請在場景中配置環境",
|
||||
please_add_environment_to_scenario: "請先在場景中添加環境配置",
|
||||
url_description: "例如:https://fit2cloud.com",
|
||||
|
|
|
@ -143,12 +143,14 @@
|
|||
normalLogin() {
|
||||
this.result = this.$post("signin", this.form, response => {
|
||||
saveLocalStorage(response);
|
||||
sessionStorage.setItem('loginSuccess', 'true');
|
||||
this.getLanguage(response.data.language);
|
||||
});
|
||||
},
|
||||
ldapLogin() {
|
||||
this.result = this.$post("ldap/signin", this.form, response => {
|
||||
saveLocalStorage(response);
|
||||
sessionStorage.setItem('loginSuccess', 'true');
|
||||
this.getLanguage(response.data.language);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue