Merge remote-tracking branch 'origin/master'

This commit is contained in:
wenyann 2020-08-14 14:33:57 +08:00
commit 1cff9c1d02
25 changed files with 1904 additions and 413 deletions

View File

@ -187,6 +187,12 @@ v1.1.0 是 v1.0.0 之后的功能版本。
- 基础设施: [Docker](https://www.docker.com/), [Kubernetes](https://kubernetes.io/)
- 测试引擎: [JMeter](https://jmeter.apache.org/)
## 致谢
- [BlazeMeter](https://www.blazemeter.com/):感谢 BlazeMeter 提供的设计思路
- [JMeter](https://jmeter.apache.org/)MeterSphere 使用了 JMeter 作为测试引擎
- [Element](https://element.eleme.cn/#/):感谢 Element 提供的优秀组件库
## 加入 MeterSphere 团队
我们正在招聘 MeterSphere 技术布道师,一起打造开源明星项目,请发简历到 metersphere@fit2cloud.com

View File

@ -0,0 +1,29 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class Quota implements Serializable {
private String id;
private Integer api;
private Integer performance;
private Integer maxThreads;
private Integer duration;
private String resourcePool;
private String organizationId;
private String workspaceId;
private Boolean useDefault;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,840 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class QuotaExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public QuotaExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andApiIsNull() {
addCriterion("api is null");
return (Criteria) this;
}
public Criteria andApiIsNotNull() {
addCriterion("api is not null");
return (Criteria) this;
}
public Criteria andApiEqualTo(Integer value) {
addCriterion("api =", value, "api");
return (Criteria) this;
}
public Criteria andApiNotEqualTo(Integer value) {
addCriterion("api <>", value, "api");
return (Criteria) this;
}
public Criteria andApiGreaterThan(Integer value) {
addCriterion("api >", value, "api");
return (Criteria) this;
}
public Criteria andApiGreaterThanOrEqualTo(Integer value) {
addCriterion("api >=", value, "api");
return (Criteria) this;
}
public Criteria andApiLessThan(Integer value) {
addCriterion("api <", value, "api");
return (Criteria) this;
}
public Criteria andApiLessThanOrEqualTo(Integer value) {
addCriterion("api <=", value, "api");
return (Criteria) this;
}
public Criteria andApiIn(List<Integer> values) {
addCriterion("api in", values, "api");
return (Criteria) this;
}
public Criteria andApiNotIn(List<Integer> values) {
addCriterion("api not in", values, "api");
return (Criteria) this;
}
public Criteria andApiBetween(Integer value1, Integer value2) {
addCriterion("api between", value1, value2, "api");
return (Criteria) this;
}
public Criteria andApiNotBetween(Integer value1, Integer value2) {
addCriterion("api not between", value1, value2, "api");
return (Criteria) this;
}
public Criteria andPerformanceIsNull() {
addCriterion("performance is null");
return (Criteria) this;
}
public Criteria andPerformanceIsNotNull() {
addCriterion("performance is not null");
return (Criteria) this;
}
public Criteria andPerformanceEqualTo(Integer value) {
addCriterion("performance =", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotEqualTo(Integer value) {
addCriterion("performance <>", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceGreaterThan(Integer value) {
addCriterion("performance >", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceGreaterThanOrEqualTo(Integer value) {
addCriterion("performance >=", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceLessThan(Integer value) {
addCriterion("performance <", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceLessThanOrEqualTo(Integer value) {
addCriterion("performance <=", value, "performance");
return (Criteria) this;
}
public Criteria andPerformanceIn(List<Integer> values) {
addCriterion("performance in", values, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotIn(List<Integer> values) {
addCriterion("performance not in", values, "performance");
return (Criteria) this;
}
public Criteria andPerformanceBetween(Integer value1, Integer value2) {
addCriterion("performance between", value1, value2, "performance");
return (Criteria) this;
}
public Criteria andPerformanceNotBetween(Integer value1, Integer value2) {
addCriterion("performance not between", value1, value2, "performance");
return (Criteria) this;
}
public Criteria andMaxThreadsIsNull() {
addCriterion("max_threads is null");
return (Criteria) this;
}
public Criteria andMaxThreadsIsNotNull() {
addCriterion("max_threads is not null");
return (Criteria) this;
}
public Criteria andMaxThreadsEqualTo(Integer value) {
addCriterion("max_threads =", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsNotEqualTo(Integer value) {
addCriterion("max_threads <>", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsGreaterThan(Integer value) {
addCriterion("max_threads >", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsGreaterThanOrEqualTo(Integer value) {
addCriterion("max_threads >=", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsLessThan(Integer value) {
addCriterion("max_threads <", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsLessThanOrEqualTo(Integer value) {
addCriterion("max_threads <=", value, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsIn(List<Integer> values) {
addCriterion("max_threads in", values, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsNotIn(List<Integer> values) {
addCriterion("max_threads not in", values, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsBetween(Integer value1, Integer value2) {
addCriterion("max_threads between", value1, value2, "maxThreads");
return (Criteria) this;
}
public Criteria andMaxThreadsNotBetween(Integer value1, Integer value2) {
addCriterion("max_threads not between", value1, value2, "maxThreads");
return (Criteria) this;
}
public Criteria andDurationIsNull() {
addCriterion("duration is null");
return (Criteria) this;
}
public Criteria andDurationIsNotNull() {
addCriterion("duration is not null");
return (Criteria) this;
}
public Criteria andDurationEqualTo(Integer value) {
addCriterion("duration =", value, "duration");
return (Criteria) this;
}
public Criteria andDurationNotEqualTo(Integer value) {
addCriterion("duration <>", value, "duration");
return (Criteria) this;
}
public Criteria andDurationGreaterThan(Integer value) {
addCriterion("duration >", value, "duration");
return (Criteria) this;
}
public Criteria andDurationGreaterThanOrEqualTo(Integer value) {
addCriterion("duration >=", value, "duration");
return (Criteria) this;
}
public Criteria andDurationLessThan(Integer value) {
addCriterion("duration <", value, "duration");
return (Criteria) this;
}
public Criteria andDurationLessThanOrEqualTo(Integer value) {
addCriterion("duration <=", value, "duration");
return (Criteria) this;
}
public Criteria andDurationIn(List<Integer> values) {
addCriterion("duration in", values, "duration");
return (Criteria) this;
}
public Criteria andDurationNotIn(List<Integer> values) {
addCriterion("duration not in", values, "duration");
return (Criteria) this;
}
public Criteria andDurationBetween(Integer value1, Integer value2) {
addCriterion("duration between", value1, value2, "duration");
return (Criteria) this;
}
public Criteria andDurationNotBetween(Integer value1, Integer value2) {
addCriterion("duration not between", value1, value2, "duration");
return (Criteria) this;
}
public Criteria andResourcePoolIsNull() {
addCriterion("resource_pool is null");
return (Criteria) this;
}
public Criteria andResourcePoolIsNotNull() {
addCriterion("resource_pool is not null");
return (Criteria) this;
}
public Criteria andResourcePoolEqualTo(String value) {
addCriterion("resource_pool =", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolNotEqualTo(String value) {
addCriterion("resource_pool <>", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolGreaterThan(String value) {
addCriterion("resource_pool >", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolGreaterThanOrEqualTo(String value) {
addCriterion("resource_pool >=", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolLessThan(String value) {
addCriterion("resource_pool <", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolLessThanOrEqualTo(String value) {
addCriterion("resource_pool <=", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolLike(String value) {
addCriterion("resource_pool like", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolNotLike(String value) {
addCriterion("resource_pool not like", value, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolIn(List<String> values) {
addCriterion("resource_pool in", values, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolNotIn(List<String> values) {
addCriterion("resource_pool not in", values, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolBetween(String value1, String value2) {
addCriterion("resource_pool between", value1, value2, "resourcePool");
return (Criteria) this;
}
public Criteria andResourcePoolNotBetween(String value1, String value2) {
addCriterion("resource_pool not between", value1, value2, "resourcePool");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNull() {
addCriterion("organization_id is null");
return (Criteria) this;
}
public Criteria andOrganizationIdIsNotNull() {
addCriterion("organization_id is not null");
return (Criteria) this;
}
public Criteria andOrganizationIdEqualTo(String value) {
addCriterion("organization_id =", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotEqualTo(String value) {
addCriterion("organization_id <>", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThan(String value) {
addCriterion("organization_id >", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) {
addCriterion("organization_id >=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThan(String value) {
addCriterion("organization_id <", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLessThanOrEqualTo(String value) {
addCriterion("organization_id <=", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdLike(String value) {
addCriterion("organization_id like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotLike(String value) {
addCriterion("organization_id not like", value, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdIn(List<String> values) {
addCriterion("organization_id in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotIn(List<String> values) {
addCriterion("organization_id not in", values, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdBetween(String value1, String value2) {
addCriterion("organization_id between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andOrganizationIdNotBetween(String value1, String value2) {
addCriterion("organization_id not between", value1, value2, "organizationId");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNull() {
addCriterion("workspace_id is null");
return (Criteria) this;
}
public Criteria andWorkspaceIdIsNotNull() {
addCriterion("workspace_id is not null");
return (Criteria) this;
}
public Criteria andWorkspaceIdEqualTo(String value) {
addCriterion("workspace_id =", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotEqualTo(String value) {
addCriterion("workspace_id <>", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThan(String value) {
addCriterion("workspace_id >", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdGreaterThanOrEqualTo(String value) {
addCriterion("workspace_id >=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThan(String value) {
addCriterion("workspace_id <", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLessThanOrEqualTo(String value) {
addCriterion("workspace_id <=", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdLike(String value) {
addCriterion("workspace_id like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotLike(String value) {
addCriterion("workspace_id not like", value, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdIn(List<String> values) {
addCriterion("workspace_id in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotIn(List<String> values) {
addCriterion("workspace_id not in", values, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdBetween(String value1, String value2) {
addCriterion("workspace_id between", value1, value2, "workspaceId");
return (Criteria) this;
}
public Criteria andWorkspaceIdNotBetween(String value1, String value2) {
addCriterion("workspace_id not between", value1, value2, "workspaceId");
return (Criteria) this;
}
public Criteria andUseDefaultIsNull() {
addCriterion("use_default is null");
return (Criteria) this;
}
public Criteria andUseDefaultIsNotNull() {
addCriterion("use_default is not null");
return (Criteria) this;
}
public Criteria andUseDefaultEqualTo(Boolean value) {
addCriterion("use_default =", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultNotEqualTo(Boolean value) {
addCriterion("use_default <>", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultGreaterThan(Boolean value) {
addCriterion("use_default >", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultGreaterThanOrEqualTo(Boolean value) {
addCriterion("use_default >=", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultLessThan(Boolean value) {
addCriterion("use_default <", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultLessThanOrEqualTo(Boolean value) {
addCriterion("use_default <=", value, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultIn(List<Boolean> values) {
addCriterion("use_default in", values, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultNotIn(List<Boolean> values) {
addCriterion("use_default not in", values, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultBetween(Boolean value1, Boolean value2) {
addCriterion("use_default between", value1, value2, "useDefault");
return (Criteria) this;
}
public Criteria andUseDefaultNotBetween(Boolean value1, Boolean value2) {
addCriterion("use_default not between", value1, value2, "useDefault");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -1,8 +1,7 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Schedule implements Serializable {

View File

@ -0,0 +1,30 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.Quota;
import io.metersphere.base.domain.QuotaExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface QuotaMapper {
long countByExample(QuotaExample example);
int deleteByExample(QuotaExample example);
int deleteByPrimaryKey(String id);
int insert(Quota record);
int insertSelective(Quota record);
List<Quota> selectByExample(QuotaExample example);
Quota selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") Quota record, @Param("example") QuotaExample example);
int updateByExample(@Param("record") Quota record, @Param("example") QuotaExample example);
int updateByPrimaryKeySelective(Quota record);
int updateByPrimaryKey(Quota record);
}

View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.QuotaMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Quota">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="api" jdbcType="INTEGER" property="api" />
<result column="performance" jdbcType="INTEGER" property="performance" />
<result column="max_threads" jdbcType="INTEGER" property="maxThreads" />
<result column="duration" jdbcType="INTEGER" property="duration" />
<result column="resource_pool" jdbcType="VARCHAR" property="resourcePool" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="use_default" jdbcType="BIT" property="useDefault" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, api, performance, max_threads, duration, resource_pool, organization_id, workspace_id,
use_default, update_time
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.QuotaExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from quota
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from quota
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.QuotaExample">
delete from quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.Quota">
insert into quota (id, api, performance,
max_threads, duration, resource_pool,
organization_id, workspace_id, use_default,
update_time)
values (#{id,jdbcType=VARCHAR}, #{api,jdbcType=INTEGER}, #{performance,jdbcType=INTEGER},
#{maxThreads,jdbcType=INTEGER}, #{duration,jdbcType=INTEGER}, #{resourcePool,jdbcType=VARCHAR},
#{organizationId,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{useDefault,jdbcType=BIT},
#{updateTime,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.Quota">
insert into quota
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="api != null">
api,
</if>
<if test="performance != null">
performance,
</if>
<if test="maxThreads != null">
max_threads,
</if>
<if test="duration != null">
duration,
</if>
<if test="resourcePool != null">
resource_pool,
</if>
<if test="organizationId != null">
organization_id,
</if>
<if test="workspaceId != null">
workspace_id,
</if>
<if test="useDefault != null">
use_default,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="api != null">
#{api,jdbcType=INTEGER},
</if>
<if test="performance != null">
#{performance,jdbcType=INTEGER},
</if>
<if test="maxThreads != null">
#{maxThreads,jdbcType=INTEGER},
</if>
<if test="duration != null">
#{duration,jdbcType=INTEGER},
</if>
<if test="resourcePool != null">
#{resourcePool,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR},
</if>
<if test="useDefault != null">
#{useDefault,jdbcType=BIT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.QuotaExample" resultType="java.lang.Long">
select count(*) from quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update quota
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.api != null">
api = #{record.api,jdbcType=INTEGER},
</if>
<if test="record.performance != null">
performance = #{record.performance,jdbcType=INTEGER},
</if>
<if test="record.maxThreads != null">
max_threads = #{record.maxThreads,jdbcType=INTEGER},
</if>
<if test="record.duration != null">
duration = #{record.duration,jdbcType=INTEGER},
</if>
<if test="record.resourcePool != null">
resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
</if>
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if>
<if test="record.useDefault != null">
use_default = #{record.useDefault,jdbcType=BIT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update quota
set id = #{record.id,jdbcType=VARCHAR},
api = #{record.api,jdbcType=INTEGER},
performance = #{record.performance,jdbcType=INTEGER},
max_threads = #{record.maxThreads,jdbcType=INTEGER},
duration = #{record.duration,jdbcType=INTEGER},
resource_pool = #{record.resourcePool,jdbcType=VARCHAR},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
use_default = #{record.useDefault,jdbcType=BIT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.Quota">
update quota
<set>
<if test="api != null">
api = #{api,jdbcType=INTEGER},
</if>
<if test="performance != null">
performance = #{performance,jdbcType=INTEGER},
</if>
<if test="maxThreads != null">
max_threads = #{maxThreads,jdbcType=INTEGER},
</if>
<if test="duration != null">
duration = #{duration,jdbcType=INTEGER},
</if>
<if test="resourcePool != null">
resource_pool = #{resourcePool,jdbcType=VARCHAR},
</if>
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if>
<if test="useDefault != null">
use_default = #{useDefault,jdbcType=BIT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.Quota">
update quota
set api = #{api,jdbcType=INTEGER},
performance = #{performance,jdbcType=INTEGER},
max_threads = #{maxThreads,jdbcType=INTEGER},
duration = #{duration,jdbcType=INTEGER},
resource_pool = #{resourcePool,jdbcType=VARCHAR},
organization_id = #{organizationId,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR},
use_default = #{useDefault,jdbcType=BIT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -2,18 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ScheduleMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.Schedule">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="key" jdbcType="VARCHAR" property="key"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="value" jdbcType="VARCHAR" property="value"/>
<result column="group" jdbcType="VARCHAR" property="group"/>
<result column="job" jdbcType="VARCHAR" property="job"/>
<result column="enable" jdbcType="BIT" property="enable"/>
<result column="resource_id" jdbcType="VARCHAR" property="resourceId"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="key" jdbcType="VARCHAR" property="key" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="group" jdbcType="VARCHAR" property="group" />
<result column="job" jdbcType="VARCHAR" property="job" />
<result column="enable" jdbcType="BIT" property="enable" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.Schedule">
<result column="custom_data" jdbcType="LONGVARCHAR" property="customData" />
@ -284,18 +284,18 @@
<update id="updateByExampleWithBLOBs" parameterType="map">
update schedule
set id = #{record.id,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
custom_data = #{record.customData,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -303,17 +303,17 @@
<update id="updateByExample" parameterType="map">
update schedule
set id = #{record.id,jdbcType=VARCHAR},
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
`key` = #{record.key,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`value` = #{record.value,jdbcType=VARCHAR},
`group` = #{record.group,jdbcType=VARCHAR},
job = #{record.job,jdbcType=VARCHAR},
`enable` = #{record.enable,jdbcType=BIT},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>

View File

@ -91,7 +91,7 @@
</if>
</sql>
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.api.dto.APITestResult">
<select id="list" resultMap="BaseResultMap">
select api_test.*, project.name as project_name, user.name as user_name
from api_test
left join project on api_test.project_id = project.id

View File

@ -18,7 +18,7 @@ import java.util.List;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = "io.metersphere.base.mapper", sqlSessionFactoryRef = "sqlSessionFactory")
@MapperScan(basePackages = {"io.metersphere.base.mapper", "io.metersphere.xpack.mapper"}, sqlSessionFactoryRef = "sqlSessionFactory")
@EnableTransactionManagement
public class MybatisConfig {

View File

@ -1,36 +0,0 @@
package io.metersphere.controller;
import io.metersphere.base.domain.TestResource;
import io.metersphere.service.TestResourceService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RequestMapping("testresource")
@RestController
public class TestResourceController {
@Resource
private TestResourceService testResourceService;
@PostMapping("/add")
public TestResource addTestResource(@RequestBody TestResource testResource) {
return testResourceService.addTestResource(testResource);
}
@GetMapping("/list/{testResourcePoolId}")
public List<TestResource> getTestResourceList(@PathVariable(value = "testResourcePoolId") String testResourcePoolId) {
return testResourceService.getTestResourceList(testResourcePoolId);
}
@GetMapping("/delete/{testResourceId}")
public void deleteTestResource(@PathVariable(value = "testResourceId") String testResourceId) {
testResourceService.deleteTestResource(testResourceId);
}
@PostMapping("/update")
public void updateTestResource(@RequestBody TestResource testResource) {
testResourceService.updateTestResource(testResource);
}
}

@ -1 +1 @@
Subproject commit 85f7879c49d2d3b2444d8dc250fa007da4fc8181
Subproject commit fadab72bb656a3a2644e43bf46783c1f6cd96d4f

View File

@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS `quota`
(
`id` varchar(50) NOT NULL,
`api` int(10) DEFAULT NULL,
`performance` int(10) DEFAULT NULL,
`max_threads` int(10) DEFAULT NULL,
`duration` int(10) DEFAULT NULL,
`resource_pool` varchar(1000) DEFAULT NULL,
`organization_id` varchar(50) DEFAULT NULL,
`workspace_id` varchar(50) DEFAULT NULL,
`use_default` tinyint(1) DEFAULT NULL,
`update_time` bigint(13) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4

View File

@ -3,7 +3,7 @@
<span class="kv-description" v-if="description">
{{ description }}
</span>
<div class="kv-row" v-for="(item, index) in items" :key="index">
<div class="kv-row" v-for="(item, index) in parameters" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-if="!suggestions" :disabled="isReadOnly" v-model="item.name" size="small" maxlength="200"
@ -34,94 +34,24 @@
</el-col>
</el-row>
</div>
<el-dialog :title="$t('api_test.request.parameters_advance')"
:visible.sync="itemValueVisible"
class="advanced-item-value"
width="70%">
<el-tabs tab-position="top" style="height: 50vh;">
<el-tab-pane :label="$t('api_test.request.parameters_advance_mock')">
<el-row type="flex" :gutter="20" style="overflow-x: auto;">
<el-col :span="6">
<el-autocomplete
:disabled="isReadOnly"
size="small"
class="input-with-autocomplete"
v-model="itemValue"
:fetch-suggestions="funcSearch"
:placeholder="valueText"
value-key="name"
highlight-first-item
@select="change">
</el-autocomplete>
</el-col>
<el-col :span="6" v-for="(itemFunc, itemIndex) in itemFuncs" :key="itemIndex">
<div v-for="(func, funcIndex) in funcs"
:key="`${itemIndex}-${funcIndex}`">
<el-row>
<el-col :span="12">
<el-radio size="mini" v-model="itemFunc.name" :label="func.name"
@change="methodChange(itemFunc, func)"/>
</el-col>
<el-col :span="12" v-if="itemFunc.name === func.name">
<div v-for="(p, pIndex) in itemFunc.params" :key="`${itemIndex}-${funcIndex}-${pIndex}`">
<el-input :placeholder="p.name" size="mini" v-model="p.value" @change="showPreview"/>
</div>
</el-col>
</el-row>
</div>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="变量">
<el-row>
<el-col :span="6">
<div v-if="environment">
<el-tree :data="environmentParams" :props="{ children: 'children', label: 'name'}"></el-tree>
</div>
<div v-if="scenario">
<el-tree :data="scenarioParams" :props="{ children: 'children', label: 'name'}"></el-tree>
</div>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
<div style="padding-top: 10px;">
<el-row type="flex" align="middle">
<el-col :span="12">
<el-button size="small" type="primary" plain @click="saveAdvanced()">
{{ $t('commons.save') }}
</el-button>
<el-button size="small" type="info" plain @click="addFunc()">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
</el-col>
<el-col>
<div> {{ itemValuePreview }}</div>
</el-col>
</el-row>
</div>
</el-dialog>
<ms-api-variable-advance ref="variableAdvance" :environment="environment" :scenario="scenario" :request="request"
:current-item="currentItem"/>
</div>
</template>
<script>
import {KeyValue, Scenario} from "../model/ScenarioModel";
import {HttpRequest, KeyValue, Scenario} from "../model/ScenarioModel";
import {MOCKJS_FUNC} from "@/common/js/constants";
import {calculate} from "@/business/components/api/test/model/ScenarioModel";
import MsApiVariableAdvance from "@/business/components/api/test/components/ApiVariableAdvance";
export default {
name: "MsApiVariable",
components: {MsApiVariableAdvance},
props: {
keyPlaceholder: String,
valuePlaceholder: String,
description: String,
items: Array,
request: HttpRequest,
environment: Object,
scenario: Scenario,
isReadOnly: {
@ -130,62 +60,12 @@ export default {
},
suggestions: Array
},
mounted() {
if (this.scenario) {
let variables = this.scenario.variables;
this.scenarioParams = [
{
name: this.scenario.name,
children: variables.filter(v => v.name),
}
];
}
if (this.environment) {
let variables = JSON.parse(this.environment.variables);
this.environmentParams = [
{
name: this.environment.name,
children: variables.filter(v => v.name),
}
];
}
},
data() {
return {
itemValueVisible: false,
itemValue: null,
funcs: [
{name: "md5"},
{name: "base64"},
{name: "unbase64"},
{
name: "substr",
params: [{name: "start"}, {name: "length"}]
},
{
name: "concat",
params: [{name: "suffix"}]
},
{name: "lconcat", params: [{name: "prefix"}]},
{name: "sha1"},
{name: "sha224"},
{name: "sha256"},
{name: "sha384"},
{name: "sha512"},
{name: "lower"},
{name: "upper"},
{name: "length"},
{name: "number"}
],
itemValuePreview: null,
itemFuncs: [],
currentFunc: "",
mockFuncs: MOCKJS_FUNC,
environmentParams: [],
scenarioParams: [],
currentItem: null,
parameters: [],
}
},
computed: {
keyText() {
return this.keyPlaceholder || this.$t("api_test.key");
@ -194,19 +74,18 @@ export default {
return this.valuePlaceholder || this.$t("api_test.value");
}
},
methods: {
remove: function (index) {
this.items.splice(index, 1);
this.$emit('change', this.items);
this.parameters.splice(index, 1);
this.$emit('change', this.parameters);
},
change: function () {
let isNeedCreate = true;
let removeIndex = -1;
this.items.forEach((item, index) => {
this.parameters.forEach((item, index) => {
if (!item.name && !item.value) {
//
if (index !== this.items.length - 1) {
if (index !== this.parameters.length - 1) {
removeIndex = index;
}
//
@ -214,13 +93,13 @@ export default {
}
});
if (isNeedCreate) {
this.items.push(new KeyValue());
this.parameters.push(new KeyValue());
}
this.$emit('change', this.items);
this.$emit('change', this.parameters);
// TODO key
},
isDisable: function (index) {
return this.items.length - 1 === index;
return this.parameters.length - 1 === index;
},
querySearch(queryString, cb) {
let suggestions = this.suggestions;
@ -243,73 +122,18 @@ export default {
return (func.name.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
};
},
showPreview() {
//
if (!this.itemValue) {
return;
}
let index = this.itemValue.indexOf("|");
if (index > -1) {
this.itemValue = this.itemValue.substring(0, index).trim();
}
this.itemFuncs.forEach(f => {
if (!f.name) {
return;
}
this.itemValue += "|" + f.name;
if (f.params) {
this.itemValue += ":" + f.params.map(p => p.value).join(",");
}
});
this.itemValuePreview = calculate(this.itemValue);
},
methodChange(itemFunc, func) {
let index = this.itemFuncs.indexOf(itemFunc);
this.itemFuncs = this.itemFuncs.slice(0, index);
// deep copy
this.itemFuncs.push(JSON.parse(JSON.stringify(func)));
this.showPreview();
},
addFunc() {
if (this.itemFuncs.length > 4) {
this.$info(this.$t('api_test.request.parameters_advance_add_func_limit'));
return;
}
if (this.itemFuncs.length > 0) {
let func = this.itemFuncs[this.itemFuncs.length - 1];
if (!func.name) {
this.$warning(this.$t('api_test.request.parameters_advance_add_func_error'));
return;
}
if (func.params) {
for (let j = 0; j < func.params.length; j++) {
if (!func.params[j].value) {
this.$warning(this.$t('api_test.request.parameters_advance_add_param_error'));
return;
}
}
}
}
this.itemFuncs.push({name: '', params: []});
},
advanced(item) {
this.$refs.variableAdvance.open();
this.currentItem = item;
this.itemValueVisible = true;
this.itemValue = '';
this.itemValuePreview = null;
this.itemFuncs = [];
this.mockVariableFuncs = [];
},
saveAdvanced() {
this.currentItem.value = this.itemValue;
this.itemValueVisible = false;
this.itemFuncs = [];
}
},
created() {
if (this.items.length === 0) {
this.items.push(new KeyValue());
if (this.parameters.length === 0) {
this.parameters.push(new KeyValue());
}
}
}

View File

@ -0,0 +1,286 @@
<template>
<el-dialog :title="$t('api_test.request.parameters_advance')"
:visible.sync="itemValueVisible"
class="advanced-item-value"
width="70%">
<el-tabs tab-position="top" style="height: 50vh;" @tab-click="selectTab">
<el-tab-pane :label="$t('api_test.request.parameters_advance_mock')">
<el-row type="flex" :gutter="20">
<el-col :span="6" class="col-height">
<div>
<el-input size="small" v-model="filterText"
:placeholder="$t('api_test.request.parameters_mock_filter_tips')"/>
<el-tree class="filter-tree" ref="tree" :data="mockFuncs" :props="treeProps"
default-expand-all @node-click="selectVariable"
:filter-node-method="filterNode"></el-tree>
</div>
</el-col>
<el-col :span="6" v-for="(itemFunc, itemIndex) in mockVariableFuncs" :key="itemIndex">
<div v-for="(func, funcIndex) in funcs"
:key="`${itemIndex}-${funcIndex}`">
<el-row>
<el-col :span="12">
<el-radio size="mini" v-model="itemFunc.name" :label="func.name"
@change="methodChange(itemFunc, func)"/>
</el-col>
<el-col :span="12" v-if="itemFunc.name === func.name">
<div v-for="(p, pIndex) in itemFunc.params" :key="`${itemIndex}-${funcIndex}-${pIndex}`">
<el-input :placeholder="p.name" size="mini" v-model="p.value" @change="showPreview"/>
</div>
</el-col>
</el-row>
</div>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="变量">
<el-row>
<el-col :span="6" class="col-height">
<div v-if="environment">
<p>{{ $t('api_test.environment.environment') }}</p>
<el-tree :data="environmentParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
<div v-if="scenario">
<p>{{ $t('api_test.scenario.scenario') }}</p>
<el-tree :data="scenarioParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
<div v-if="preRequestParams">
<p>{{ $t('api_test.request.parameters_pre_request') }}</p>
<el-tree :data="preRequestParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
</el-col>
<el-col :span="6" v-for="(itemFunc, itemIndex) in jmeterVariableFuncs" :key="itemIndex" class="col-height">
<div>
<div v-for="(func, funcIndex) in jmeterFuncs"
:key="`${itemIndex}-${funcIndex}`">
<el-row>
<el-radio size="mini" v-model="itemFunc.name" :label="func.name"
@change="methodChange(itemFunc, func)"/>
</el-row>
</div>
</div>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
<el-form>
<el-form-item>
<el-input :placeholder="valueText" size="small"
v-model="itemValue"/>
</el-form-item>
</el-form>
<div style="padding-top: 10px;">
<el-row type="flex" align="middle">
<el-col :span="12">
<el-button size="small" type="primary" plain @click="saveAdvanced()">
{{ $t('commons.save') }}
</el-button>
<el-button size="small" type="info" plain @click="addFunc()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
</el-col>
<el-col>
<div> {{ itemValuePreview }}</div>
</el-col>
</el-row>
</div>
</el-dialog>
</template>
<script>
import {calculate, HttpRequest, Scenario} from "@/business/components/api/test/model/ScenarioModel";
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
export default {
name: "MsApiVariableAdvance",
props: {
request: HttpRequest,
environment: Object,
scenario: Scenario,
currentItem: Object,
},
data() {
return {
itemValueVisible: false,
filterText: '',
environmentParams: [],
scenarioParams: [],
preRequests: [],
preRequestParams: [],
treeProps: {children: 'children', label: 'name'},
currentTab: 0,
itemValue: null,
itemValuePreview: null,
funcs: [
{name: "md5"},
{name: "base64"},
{name: "unbase64"},
{
name: "substr",
params: [{name: "start"}, {name: "length"}]
},
{
name: "concat",
params: [{name: "suffix"}]
},
{name: "lconcat", params: [{name: "prefix"}]},
{name: "sha1"},
{name: "sha224"},
{name: "sha256"},
{name: "sha384"},
{name: "sha512"},
{name: "lower"},
{name: "upper"},
{name: "length"},
{name: "number"}
],
mockFuncs: MOCKJS_FUNC.map(f => {
return {name: f.name, value: f.name}
}),
jmeterFuncs: JMETER_FUNC,
mockVariableFuncs: [],
jmeterVariableFuncs: [],
}
},
computed: {
valueText() {
return this.valuePlaceholder || this.$t("api_test.value");
}
},
mounted() {
this.prepareData();
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
methods: {
open() {
this.itemValueVisible = true;
},
prepareData() {
if (this.request) {
this.parameters = this.request.parameters;
}
if (this.scenario) {
let variables = this.scenario.variables;
this.scenarioParams = [
{
name: this.scenario.name,
children: variables.filter(v => v.name).map(v => {
return {name: v.name, value: '${' + v.name + '}'}
}),
}
];
if (this.environment) {
let variables = JSON.parse(this.environment.variables);
this.environmentParams = [
{
name: this.environment.name,
children: variables.filter(v => v.name).map(v => {
return {name: v.name, value: '${' + v.name + '}'}
}),
}
];
}
let i = this.scenario.requests.indexOf(this.request);
this.preRequests = this.scenario.requests.slice(0, i);
this.preRequests.forEach(r => {
let js = r.extract.json.map(v => {
return {name: v.variable, value: v.value}
});
let xs = r.extract.xpath.map(v => {
return {name: v.variable, value: v.value}
});
let rx = r.extract.regex.map(v => {
return {name: v.variable, value: v.value}
});
let vs = [...js, ...xs, ...rx];
if (vs.length > 0) {
this.preRequestParams.push({name: r.name, children: vs});
}
});
}
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
selectVariable(node) {
this.itemValue = node.value;
},
selectTab(tab) {
this.currentTab = +tab.index;
this.itemValue = null;
this.itemValuePreview = null;
},
showPreview() {
//
if (!this.itemValue) {
return;
}
let index = this.itemValue.indexOf("|");
if (index > -1) {
this.itemValue = this.itemValue.substring(0, index).trim();
}
this.mockVariableFuncs.forEach(f => {
if (!f.name) {
return;
}
this.itemValue += "|" + f.name;
if (f.params) {
this.itemValue += ":" + f.params.map(p => p.value).join(",");
}
});
this.itemValuePreview = calculate(this.itemValue);
},
methodChange(itemFunc, func) {
let index = this.mockVariableFuncs.indexOf(itemFunc);
this.mockVariableFuncs = this.mockVariableFuncs.slice(0, index);
// deep copy
this.mockVariableFuncs.push(JSON.parse(JSON.stringify(func)));
this.showPreview();
},
addFunc() {
if (this.mockVariableFuncs.length > 4) {
this.$info(this.$t('api_test.request.parameters_advance_add_func_limit'));
return;
}
if (this.mockVariableFuncs.length > 0) {
let func = this.mockVariableFuncs[this.mockVariableFuncs.length - 1];
if (!func.name) {
this.$warning(this.$t('api_test.request.parameters_advance_add_func_error'));
return;
}
if (func.params) {
for (let j = 0; j < func.params.length; j++) {
if (!func.params[j].value) {
this.$warning(this.$t('api_test.request.parameters_advance_add_param_error'));
return;
}
}
}
}
this.mockVariableFuncs.push({name: '', params: []});
},
saveAdvanced() {
this.currentItem.value = this.itemValue;
this.itemValueVisible = false;
this.mockVariableFuncs = [];
}
}
}
</script>
<style scoped>
.col-height {
height: 40vh;
overflow: auto;
}
</style>

View File

@ -45,9 +45,11 @@
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_test.request.parameters')" name="parameters">
<ms-api-variable :is-read-only="isReadOnly" :items="request.parameters"
<ms-api-variable :is-read-only="isReadOnly"
:request="request"
:environment="request.environment"
:scenario="scenario"
:extract="request.extract"
:description="$t('api_test.request.parameters_desc')"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.request.headers')" name="headers">

View File

@ -1,20 +1,9 @@
import Vue from "vue";
import VueRouter from 'vue-router'
import RouterSidebar from "./RouterSidebar";
import Setting from "../../settings/Setting";
import User from "../../settings/system/User";
import EditPerformanceTestPlan from "../../performance/test/EditPerformanceTestPlan";
import PerformanceTestPlan from "../../performance/test/PerformanceTestPlan";
import Organization from "../../settings/system/Organization";
import OrganizationMember from "../../settings/organization/OrganizationMember";
import Member from "../../settings/workspace/WorkspaceMember";
import TestCaseReportTemplate from "../../settings/workspace/TestCaseReportTemplate";
import TestResourcePool from "../../settings/system/TestResourcePool";
import SystemParameterSetting from "../../settings/system/SystemParameterSetting";
import MsProject from "../../project/MsProject";
import OrganizationWorkspace from "../../settings/organization/OrganizationWorkspace";
import PersonSetting from "../../settings/personal/PersonSetting";
import SystemWorkspace from "../../settings/system/SystemWorkspace";
import PerformanceChart from "../../performance/report/components/PerformanceChart";
import PerformanceTestReport from "../../performance/report/PerformanceTestReport";
import ApiTest from "../../api/ApiTest";
@ -32,10 +21,7 @@ import TestCase from "../../track/case/TestCase";
import TestTrack from "../../track/TestTrack";
import ApiReportList from "../../api/report/ApiReportList";
import axios from "axios";
import ApiKeys from "../../settings/personal/ApiKeys";
import ServiceIntegration from "../../settings/organization/ServiceIntegration";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
import Setting from "@/business/components/settings/router";
Vue.use(VueRouter);
@ -48,65 +34,7 @@ const router = new VueRouter({
sidebar: RouterSidebar
}
},
...requireContext.keys().map(key => requireContext(key).default),
{
path: "/setting",
components: {
content: Setting
},
children: [
{
path: 'user',
component: User,
},
{
path: 'organization',
component: Organization,
},
{
path: 'organizationmember',
component: OrganizationMember,
},
{
path: 'organizationworkspace',
component: OrganizationWorkspace,
},
{
path: 'serviceintegration',
component: ServiceIntegration,
},
{
path: 'personsetting',
component: PersonSetting
},
{
path: 'apikeys',
component: ApiKeys
},
{
path: 'member',
component: Member
},
{
path: 'systemworkspace',
component: SystemWorkspace
},
{
path: 'testresourcepool',
component: TestResourcePool
},
{
path: 'systemparametersetting',
component: SystemParameterSetting
},
{
path: 'testcase/report/template',
name: 'testCaseReportTemplate',
component: TestCaseReportTemplate
},
]
},
Setting,
{
path: "/api",
name: "api",

View File

@ -1,48 +1,42 @@
<template>
<el-menu menu-trigger="click" :default-active="$route.path" router>
<el-menu menu-trigger="click" :default-active="$route.path" router class="setting">
<el-submenu index="1" v-permission="['admin']">
<template v-slot:title>
<font-awesome-icon class="icon account" :icon="['far', 'address-card']" size="lg"/>
<span>{{$t('commons.system')}}</span>
<span>{{ $t('commons.system') }}</span>
</template>
<el-menu-item index="/setting/user">{{$t('commons.user')}}</el-menu-item>
<el-menu-item index="/setting/organization">{{$t('commons.organization')}}</el-menu-item>
<el-menu-item index="/setting/systemworkspace">{{$t('commons.workspace')}}</el-menu-item>
<el-menu-item index="/setting/testresourcepool">{{$t('commons.test_resource_pool')}}</el-menu-item>
<el-menu-item index="/setting/systemparametersetting">{{$t('commons.system_parameter_setting')}}</el-menu-item>
<el-menu-item v-for="menu in systems" :key="menu.index" :index="menu.index" class="setting-item">
{{ $t(menu.title) }}
</el-menu-item>
</el-submenu>
<el-submenu index="2" v-permission="['org_admin']" v-if="isCurrentOrganizationAdmin">
<template v-slot:title>
<font-awesome-icon class="icon organization" :icon="['far', 'building']" size="lg"/>
<span>{{$t('commons.organization')}}</span>
<span>{{ $t('commons.organization') }}</span>
</template>
<el-menu-item index="/setting/organizationmember" v-permission="['org_admin']">{{$t('commons.member')}}
</el-menu-item>
<el-menu-item index="/setting/organizationworkspace" v-permission="['org_admin']">{{$t('commons.workspace')}}
</el-menu-item>
<el-menu-item index="/setting/serviceintegration" v-permission="['org_admin']">{{$t('organization.service_integration')}}
<el-menu-item v-for="menu in organizations" :key="menu.index" :index="menu.index" class="setting-item">
{{ $t(menu.title) }}
</el-menu-item>
</el-submenu>
<el-submenu index="3" v-permission="['test_manager']" v-if="isCurrentWorkspaceUser">
<template v-slot:title>
<font-awesome-icon class="icon workspace" :icon="['far', 'list-alt']" size="lg"/>
<span>{{$t('commons.workspace')}}</span>
<span>{{ $t('commons.workspace') }}</span>
</template>
<el-menu-item index="/setting/member">{{$t('commons.member')}}</el-menu-item>
<el-menu-item index="/setting/testcase/report/template">{{$t('test_track.plan_view.report_template')}}
<el-menu-item v-for="menu in workspaces" :key="menu.index" :index="menu.index" class="setting-item">
{{ $t(menu.title) }}
</el-menu-item>
</el-submenu>
<el-submenu index="4">
<template v-slot:title>
<font-awesome-icon class="icon" :icon="['far', 'user']" size="lg"/>
<span>{{$t('commons.personal_info')}}</span>
<span>{{ $t('commons.personal_info') }}</span>
</template>
<el-menu-item index="/setting/personsetting">{{$t('commons.personal_setting')}}</el-menu-item>
<el-menu-item v-permission="['admin', 'org_admin', 'test_manager', 'test_user', 'test_viewer']"
index="/setting/apikeys">API Keys
<el-menu-item v-for="menu in persons" :key="menu.index" :index="menu.index" class="setting-item">
{{ $t(menu.title) }}
</el-menu-item>
</el-submenu>
@ -50,47 +44,63 @@
</template>
<script>
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "../../../common/js/utils";
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "@/common/js/utils";
import Setting from "@/business/components/settings/router";
export default {
name: "MsSettingMenu",
data() {
return {
isCurrentOrganizationAdmin: false,
isCurrentWorkspaceUser: false,
}
},
mounted() {
this.isCurrentOrganizationAdmin = checkoutCurrentOrganization();
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
},
export default {
name: "MsSettingMenu",
data() {
let getMenus = function (group) {
let menus = [];
Setting.children.forEach(child => {
if (child.meta[group] === true) {
let menu = {index: Setting.path + "/" + child.path}
menu.title = child.meta.title;
menus.push(menu);
}
})
return menus;
}
return {
systems: getMenus('system'),
organizations: getMenus('organization'),
workspaces: getMenus('workspace'),
persons: getMenus('person'),
isCurrentOrganizationAdmin: false,
isCurrentWorkspaceUser: false,
}
},
mounted() {
this.isCurrentOrganizationAdmin = checkoutCurrentOrganization();
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
}
}
</script>
<style scoped>
.el-menu {
border-right: 0;
}
.setting {
border-right: 0;
}
.el-menu-item {
height: 40px;
line-height: 40px;
}
.setting .setting-item {
height: 40px;
line-height: 40px;
}
.icon {
width: 24px;
margin-right: 10px;
}
.icon {
width: 24px;
margin-right: 10px;
}
.account {
color: #5a78f0;
}
.account {
color: #5a78f0;
}
.organization {
color: #b33a5b;
}
.organization {
color: #b33a5b;
}
.workspace {
color: #44b349;
}
.workspace {
color: #44b349;
}
</style>

View File

@ -0,0 +1,96 @@
<template>
<el-menu menu-trigger="click" :default-active="$route.path" router>
<el-submenu index="1" v-permission="['admin']">
<template v-slot:title>
<font-awesome-icon class="icon account" :icon="['far', 'address-card']" size="lg"/>
<span>{{$t('commons.system')}}</span>
</template>
<el-menu-item index="/setting/user">{{$t('commons.user')}}</el-menu-item>
<el-menu-item index="/setting/organization">{{$t('commons.organization')}}</el-menu-item>
<el-menu-item index="/setting/systemworkspace">{{$t('commons.workspace')}}</el-menu-item>
<el-menu-item index="/setting/testresourcepool">{{$t('commons.test_resource_pool')}}</el-menu-item>
<el-menu-item index="/setting/systemparametersetting">{{$t('commons.system_parameter_setting')}}</el-menu-item>
</el-submenu>
<el-submenu index="2" v-permission="['org_admin']" v-if="isCurrentOrganizationAdmin">
<template v-slot:title>
<font-awesome-icon class="icon organization" :icon="['far', 'building']" size="lg"/>
<span>{{$t('commons.organization')}}</span>
</template>
<el-menu-item index="/setting/organizationmember" v-permission="['org_admin']">{{$t('commons.member')}}
</el-menu-item>
<el-menu-item index="/setting/organizationworkspace" v-permission="['org_admin']">{{$t('commons.workspace')}}
</el-menu-item>
<el-menu-item index="/setting/serviceintegration" v-permission="['org_admin']">{{$t('organization.service_integration')}}
</el-menu-item>
</el-submenu>
<el-submenu index="3" v-permission="['test_manager']" v-if="isCurrentWorkspaceUser">
<template v-slot:title>
<font-awesome-icon class="icon workspace" :icon="['far', 'list-alt']" size="lg"/>
<span>{{$t('commons.workspace')}}</span>
</template>
<el-menu-item index="/setting/member">{{$t('commons.member')}}</el-menu-item>
<el-menu-item index="/setting/testcase/report/template">{{$t('test_track.plan_view.report_template')}}
</el-menu-item>
</el-submenu>
<el-submenu index="4">
<template v-slot:title>
<font-awesome-icon class="icon" :icon="['far', 'user']" size="lg"/>
<span>{{$t('commons.personal_info')}}</span>
</template>
<el-menu-item index="/setting/personsetting">{{$t('commons.personal_setting')}}</el-menu-item>
<el-menu-item v-permission="['admin', 'org_admin', 'test_manager', 'test_user', 'test_viewer']"
index="/setting/apikeys">API Keys
</el-menu-item>
</el-submenu>
</el-menu>
</template>
<script>
import {checkoutCurrentOrganization, checkoutCurrentWorkspace} from "../../../common/js/utils";
export default {
name: "MsSettingMenuBackup",
data() {
return {
isCurrentOrganizationAdmin: false,
isCurrentWorkspaceUser: false,
}
},
mounted() {
this.isCurrentOrganizationAdmin = checkoutCurrentOrganization();
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
},
}
</script>
<style scoped>
.el-menu {
border-right: 0;
}
.el-menu-item {
height: 40px;
line-height: 40px;
}
.icon {
width: 24px;
margin-right: 10px;
}
.account {
color: #5a78f0;
}
.organization {
color: #b33a5b;
}
.workspace {
color: #44b349;
}
</style>

View File

@ -0,0 +1,88 @@
import Setting from "@/business/components/settings/Setting";
import User from "@/business/components/settings/system/User";
import Organization from "@/business/components/settings/system/Organization";
import OrganizationMember from "@/business/components/settings/organization/OrganizationMember";
import OrganizationWorkspace from "@/business/components/settings/organization/OrganizationWorkspace";
import ServiceIntegration from "@/business/components/settings/organization/ServiceIntegration";
import PersonSetting from "@/business/components/settings/personal/PersonSetting";
import ApiKeys from "@/business/components/settings/personal/ApiKeys";
import Member from "@/business/components/settings/workspace/WorkspaceMember";
import SystemWorkspace from "@/business/components/settings/system/SystemWorkspace";
import TestResourcePool from "@/business/components/settings/system/TestResourcePool";
import SystemParameterSetting from "@/business/components/settings/system/SystemParameterSetting";
import TestCaseReportTemplate from "@/business/components/settings/workspace/TestCaseReportTemplate";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
export default {
path: "/setting",
name: "Setting",
components: {
content: Setting
},
children: [
{
path: 'user',
component: User,
meta: {system: true, title: 'commons.user'}
},
{
path: 'organization',
component: Organization,
meta: {system: true, title: 'commons.organization'}
},
{
path: 'systemworkspace',
component: SystemWorkspace,
meta: {system: true, title: 'commons.workspace'}
},
{
path: 'testresourcepool',
component: TestResourcePool,
meta: {system: true, title: 'commons.test_resource_pool'}
},
{
path: 'systemparametersetting',
component: SystemParameterSetting,
meta: {system: true, title: 'commons.system_parameter_setting'}
},
...requireContext.keys().map(key => requireContext(key).system),
{
path: 'organizationmember',
component: OrganizationMember,
meta: {organization: true, title: 'commons.member'}
},
{
path: 'organizationworkspace',
component: OrganizationWorkspace,
meta: {organization: true, title: 'commons.workspace'}
},
{
path: 'serviceintegration',
component: ServiceIntegration,
meta: {organization: true, title: 'organization.service_integration'}
},
{
path: 'member',
component: Member,
meta: {workspace: true, title: 'commons.member'}
},
{
path: 'testcase/report/template',
name: 'testCaseReportTemplate',
component: TestCaseReportTemplate,
meta: {workspace: true, title: 'test_track.plan_view.report_template'}
},
{
path: 'personsetting',
component: PersonSetting,
meta: {person: true, title: 'commons.personal_setting'}
},
{
path: 'apikeys',
component: ApiKeys,
meta: {person: true, title: 'commons.api_keys'}
},
]
}

View File

@ -173,7 +173,7 @@
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
<el-form-item :label="$t('commons.email')" prop="email">
<el-input v-model="form.email" autocomplete="off" :disabled="form.source === 'LDAP' ? true : false"/>
<el-input v-model="form.email" autocomplete="off" :disabled="form.source === 'LDAP'"/>
</el-form-item>
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/>
@ -296,7 +296,7 @@
import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter";
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
import {getCurrentUser, listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsRolesTag from "../../common/components/MsRolesTag";
export default {
@ -469,7 +469,7 @@
editUserPassword(editPasswordForm) {
this.$refs[editPasswordForm].validate(valid => {
if (valid) {
this.result = this.$post(this.editPasswordPath, this.ruleForm, response => {
this.result = this.$post(this.editPasswordPath, this.ruleForm, () => {
this.$success(this.$t('commons.modify_success'));
this.editPasswordVisible = false;
this.search();
@ -492,7 +492,7 @@
let roles = data.roles;
// let userRoles = result.userRoles;
this.$set(this.tableData[i], "roles", roles);
this.$set(this.tableData[i], "isLdapUser", this.tableData[i].source === 'LDAP' ? true : false);
this.$set(this.tableData[i], "isLdapUser", this.tableData[i].source === 'LDAP');
});
}
})

@ -1 +1 @@
Subproject commit 52adadce7eb781fcab20c5e1ab7e83bd03b24b4e
Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d

View File

@ -64,6 +64,20 @@ export default {
}
}
Vue.prototype.$$get = function (url, data, success) {
let result = {loading: true};
if (!success) {
return axios.get(url, {params: data});
} else {
axios.get(url, {params: data}).then(response => {
then(success, response, result);
}).catch(error => {
exception(error, result);
});
return result;
}
};
Vue.prototype.$get = function (url, success) {
let result = {loading: true};
if (!success) {
@ -117,7 +131,7 @@ export default {
axios.all(array).then(axios.spread(callback));
};
Vue.prototype.$fileDownload = function(url) {
Vue.prototype.$fileDownload = function (url) {
axios.get(url, {responseType: 'blob'})
.then(response => {
let fileName = window.decodeURI(response.headers['content-disposition'].split('=')[1]);
@ -128,11 +142,11 @@ export default {
});
};
Vue.prototype.$fileUpload = function(url, file, param, success, failure) {
Vue.prototype.$fileUpload = function (url, file, param, success, failure) {
let formData = new FormData();
formData.append("file", file);
formData.append('request', new Blob([JSON.stringify(param)], {type: "application/json"}));
let axiosRequestConfig = {
let axiosRequestConfig = {
method: 'POST',
url: url,
data: formData,
@ -140,7 +154,7 @@ export default {
'Content-Type': undefined
}
};
return Vue.prototype.$request(axiosRequestConfig, success, failure);
return Vue.prototype.$request(axiosRequestConfig, success, failure);
}
}

View File

@ -43,6 +43,8 @@ export default {
user: 'User',
system: 'System',
personal_setting: 'Personal Setting',
api_keys: 'API Keys',
quota: 'Quota',
test_resource_pool: 'Resource Pool',
system_setting: 'Settings',
api: 'API',
@ -368,6 +370,7 @@ export default {
please_save_test: "Please Save Test First",
},
scenario: {
scenario: "Scenario",
dubbo: "Dubbo Config",
config: "Scenario Config",
input_name: "Please enter the scenario name",
@ -402,7 +405,8 @@ export default {
parameters_filter_tips: "Only support MockJs function result preview",
parameters_advance: "Advanced parameter settings",
parameters_preview: "Preview",
parameters_preview_warning: "Please enter the template first",
parameters_mock_filter_tips: "Please enter keywords to filter",
parameters_pre_request: "Pre-request extraction",
parameters_advance_mock: "Mock Data",
parameters_advance_add_func: "Add Function",
parameters_advance_add_func_limit: "Support up to 5 functions",
@ -779,4 +783,23 @@ export default {
no_qualifying_results: "No Qualifying Results",
}
},
quota: {
default: {
organization: "Organization Default Quota",
workspace: "Workspace Default Quota",
},
api: "Number of interface tests",
performance: "Number of performance tests",
resource_pool: "Available test resource pool",
max_threads: "Maximum Concurrency",
duration: "Stress test duration",
use_default: "Use default quota",
yes: "Yes",
no: "No",
edit: "Edit",
list: "Quota List",
modify: "Modify Quota",
edit_quota_title: "{0} quota",
workspace_quota_list: "Workspace quota list of {0}",
}
};

View File

@ -36,6 +36,8 @@ export default {
phone: '电话',
role: '角色',
personal_info: '个人信息',
api_keys: 'API Keys',
quota: '配额管理',
status: '状态',
show_all: '显示全部',
show: '显示',
@ -369,6 +371,7 @@ export default {
please_save_test: "请先保存测试",
},
scenario: {
scenario: "场景",
dubbo: "Dubbo配置",
config: "场景配置",
input_name: "请输入场景名称",
@ -405,7 +408,8 @@ export default {
parameters_filter_tips: "只支持 MockJs 函数结果预览",
parameters_advance: "高级参数设置",
parameters_preview: "预览",
parameters_preview_warning: "请先输入模版",
parameters_mock_filter_tips: "请输入关键字进行过滤",
parameters_pre_request: "前置请求提取",
parameters_advance_mock: "Mock 数据",
parameters_advance_add_func: "添加函数",
parameters_advance_add_func_limit: "最多支持5个函数",
@ -783,4 +787,23 @@ export default {
no_qualifying_results: "没有达到条件的结果",
}
},
quota: {
default: {
organization: "组织默认配额",
workspace: "工作空间默认配额",
},
api: "接口测试数量",
performance: "性能测试数量",
resource_pool: "可用测试资源池",
max_threads: "最大并发数",
duration: "压测时长",
use_default: "使用默认配额",
yes: "是",
no: "否",
edit: "编辑",
list: "配额列表",
modify: "修改配额",
edit_quota_title: "{0}的配额",
workspace_quota_list: "{0}的工作空间配额列表",
}
};

View File

@ -43,6 +43,8 @@ export default {
user: '用戶',
system: '系統',
personal_setting: '個人設置',
api_keys: 'API Keys',
quota: '配額管理',
test_resource_pool: '測試資源池',
system_setting: '系統設置',
api: '接口測試',
@ -367,6 +369,7 @@ export default {
please_save_test: "請先保存測試",
},
scenario: {
scenario: "場景",
dubbo: "Dubbo配寘",
creator: "創建人",
config: "場景配寘",
@ -402,7 +405,8 @@ export default {
parameters_filter_tips: "只支持MockJs函數結果預覽",
parameters_advance: "高級參數設置",
parameters_preview: "預覽",
parameters_preview_warning: "請先輸入模版",
parameters_mock_filter_tips: "請輸入關鍵字進行過濾",
parameters_pre_request: "前置請求提取",
parameters_advance_mock: "Mock 數據",
parameters_advance_add_func: "添加函數",
parameters_advance_add_func_limit: "最多支持5個函數",
@ -778,4 +782,23 @@ export default {
no_qualifying_results: "沒有達到條件的結果",
}
},
quota: {
default: {
organization: "組織默認配額",
workspace: "工作空間默認配額",
},
api: "接口測試數量",
performance: "性能測試數量",
resource_pool: "可用測試資源池",
max_threads: "最大並發數",
duration: "壓測時長",
use_default: "使用默認配額",
yes: "是",
no: "否",
edit: "編輯",
list: "配額列表",
modify: "修改配額",
edit_quota_title: "{0}的配額",
workspace_quota_list: "{0}的工作空間配額列表",
}
};