diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiTagController.java b/backend/src/main/java/io/metersphere/api/controller/ApiTagController.java deleted file mode 100644 index 7d404df2d9..0000000000 --- a/backend/src/main/java/io/metersphere/api/controller/ApiTagController.java +++ /dev/null @@ -1,56 +0,0 @@ -package io.metersphere.api.controller; - -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import io.metersphere.api.dto.automation.ApiTagRequest; -import io.metersphere.api.dto.automation.SaveApiTagRequest; -import io.metersphere.api.service.ApiTagService; -import io.metersphere.base.domain.ApiTag; -import io.metersphere.commons.constants.RoleConstants; -import io.metersphere.commons.utils.PageUtils; -import io.metersphere.commons.utils.Pager; -import io.metersphere.commons.utils.SessionUtils; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresRoles; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -@RestController -@RequestMapping(value = "/api/tag") -@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR) -public class ApiTagController { - - @Resource - ApiTagService apiTagService; - - @PostMapping("/list") - public List list(@RequestBody ApiTagRequest request) { - return apiTagService.list(request); - } - - @PostMapping("/getTgas/{goPage}/{pageSize}") - public Pager> getTgas(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTagRequest request) { - Page page = PageHelper.startPage(goPage, pageSize, true); - request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return PageUtils.setPageInfo(page, apiTagService.getTgas(request)); - } - - @PostMapping(value = "/create") - public void create(@RequestBody SaveApiTagRequest request) { - apiTagService.create(request); - } - - @PostMapping(value = "/update") - public void update(@RequestBody SaveApiTagRequest request) { - apiTagService.update(request); - } - - @GetMapping("/delete/{id}") - public void delete(@PathVariable String id) { - apiTagService.delete(id); - } - -} - diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java index 1256a3c350..92f8843220 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java @@ -13,7 +13,7 @@ public class SaveApiScenarioRequest { private String projectId; - private String tagId; + private String tags; private String userId; diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index ff8b40415f..792ba9d87b 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.api.dto.definition.RunDefinitionRequest; @@ -13,9 +12,11 @@ import io.metersphere.api.dto.definition.request.*; import io.metersphere.api.dto.scenario.KeyValue; import io.metersphere.api.dto.scenario.environment.EnvironmentConfig; import io.metersphere.api.jmeter.JMeterService; -import io.metersphere.base.domain.*; +import io.metersphere.base.domain.ApiScenario; +import io.metersphere.base.domain.ApiScenarioExample; +import io.metersphere.base.domain.ApiScenarioWithBLOBs; +import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; import io.metersphere.base.mapper.ApiScenarioMapper; -import io.metersphere.base.mapper.ApiTagMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioMapper; import io.metersphere.base.mapper.ext.ExtTestPlanMapper; import io.metersphere.commons.constants.APITestStatus; @@ -54,8 +55,6 @@ public class ApiAutomationService { @Resource private ExtApiScenarioMapper extApiScenarioMapper; @Resource - private ApiTagMapper apiTagMapper; - @Resource private JMeterService jMeterService; @Resource private ApiTestEnvironmentService environmentService; @@ -70,29 +69,7 @@ public class ApiAutomationService { public List list(ApiScenarioRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); - List list = extApiScenarioMapper.list(request); - ApiTagExample example = new ApiTagExample(); - example.createCriteria().andProjectIdEqualTo(request.getProjectId()); - List tags = apiTagMapper.selectByExample(example); - Map tagMap = tags.stream().collect(Collectors.toMap(ApiTag::getId, ApiTag::getName)); - Gson gs = new Gson(); - list.forEach(item -> { - if (item.getTagId() != null) { - StringBuilder buf = new StringBuilder(); - gs.fromJson(item.getTagId(), List.class).forEach(t -> { - buf.append(tagMap.get(t)); - buf.append(","); - }); - if (buf != null && buf.length() > 0) { - String tagNames = buf.toString().substring(0, buf.toString().length() - 1); - List tagList = Arrays.asList(tagNames.split(",")); - item.setTagNames(tagList); - } else { - item.setTagNames(new ArrayList<>()); - } - } - }); - return list; + return extApiScenarioMapper.list(request); } public void deleteByIds(List nodeIds) { @@ -109,7 +86,7 @@ public class ApiAutomationService { scenario.setId(request.getId()); scenario.setName(request.getName()); scenario.setProjectId(request.getProjectId()); - scenario.setTagId(request.getTagId()); + scenario.setTags(request.getTags()); scenario.setApiScenarioModuleId(request.getApiScenarioModuleId()); scenario.setModulePath(request.getModulePath()); scenario.setLevel(request.getLevel()); @@ -146,7 +123,7 @@ public class ApiAutomationService { scenario.setId(request.getId()); scenario.setName(request.getName()); scenario.setProjectId(request.getProjectId()); - scenario.setTagId(request.getTagId()); + scenario.setTags(request.getTags()); scenario.setApiScenarioModuleId(request.getApiScenarioModuleId()); scenario.setModulePath(request.getModulePath()); scenario.setLevel(request.getLevel()); @@ -207,19 +184,6 @@ public class ApiAutomationService { return new ArrayList<>(); } - public void deleteTag(String id) { - List list = extApiScenarioMapper.selectByTagId(id); - if (!list.isEmpty()) { - Gson gs = new Gson(); - list.forEach(item -> { - List tagIds = gs.fromJson(item.getTagId(), List.class); - tagIds.remove(id); - item.setTagId(JSON.toJSONString(tagIds)); - apiScenarioMapper.updateByPrimaryKeySelective(item); - }); - } - } - private void createAPIScenarioReportResult(String id, String triggerMode, String execType, String projectId) { APIScenarioReportResult report = new APIScenarioReportResult(); report.setId(id); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTagService.java b/backend/src/main/java/io/metersphere/api/service/ApiTagService.java deleted file mode 100644 index 94ae8b3691..0000000000 --- a/backend/src/main/java/io/metersphere/api/service/ApiTagService.java +++ /dev/null @@ -1,77 +0,0 @@ -package io.metersphere.api.service; - -import io.metersphere.api.dto.automation.ApiTagRequest; -import io.metersphere.api.dto.automation.SaveApiTagRequest; -import io.metersphere.base.domain.ApiTag; -import io.metersphere.base.domain.ApiTagExample; -import io.metersphere.base.mapper.ApiTagMapper; -import io.metersphere.base.mapper.ext.ExtApiTagMapper; -import io.metersphere.commons.exception.MSException; -import io.metersphere.commons.utils.SessionUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.List; - -@Service -@Transactional(rollbackFor = Exception.class) -public class ApiTagService { - @Resource - private ApiTagMapper apiTagMapper; - @Resource - private ExtApiTagMapper extApiTagMapper; - @Resource - private ApiAutomationService apiAutomationService; - - public List list(ApiTagRequest request) { - ApiTagExample example = new ApiTagExample(); - example.createCriteria().andProjectIdEqualTo(request.getProjectId()); - return apiTagMapper.selectByExample(example); - } - - public List getTgas(ApiTagRequest request) { - return extApiTagMapper.list(request); - } - - public void create(SaveApiTagRequest request) { - checkNameExist(request); - final ApiTag apiTag = new ApiTag(); - apiTag.setId(request.getId()); - apiTag.setName(request.getName()); - apiTag.setProjectId(request.getProjectId()); - apiTag.setCreateTime(System.currentTimeMillis()); - apiTag.setUpdateTime(System.currentTimeMillis()); - if (request.getUserId() == null) { - apiTag.setUserId(SessionUtils.getUserId()); - } else { - apiTag.setUserId(request.getUserId()); - } - apiTagMapper.insert(apiTag); - } - - public void update(SaveApiTagRequest request) { - checkNameExist(request); - final ApiTag apiTag = new ApiTag(); - apiTag.setId(request.getId()); - apiTag.setName(request.getName()); - apiTag.setProjectId(request.getProjectId()); - apiTag.setUpdateTime(System.currentTimeMillis()); - apiTag.setUserId(request.getUserId()); - apiTagMapper.updateByPrimaryKeySelective(apiTag); - } - - public void delete(String id) { - apiTagMapper.deleteByPrimaryKey(id); - apiAutomationService.deleteTag(id); - } - - private void checkNameExist(SaveApiTagRequest request) { - ApiTagExample example = new ApiTagExample(); - example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()) - .andIdNotEqualTo(request.getId()); - if (apiTagMapper.countByExample(example) > 0) { - MSException.throwException("名称不能重复"); - } - } -} diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java index 61680351e2..56d3050e07 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenario.java @@ -9,7 +9,7 @@ public class ApiScenario implements Serializable { private String projectId; - private String tagId; + private String tags; private String userId; diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java index 6d369644a3..c668f1a2fe 100644 --- a/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/ApiScenarioExample.java @@ -244,73 +244,73 @@ public class ApiScenarioExample { return (Criteria) this; } - public Criteria andTagIdIsNull() { - addCriterion("tag_id is null"); + public Criteria andTagsIsNull() { + addCriterion("tags is null"); return (Criteria) this; } - public Criteria andTagIdIsNotNull() { - addCriterion("tag_id is not null"); + public Criteria andTagsIsNotNull() { + addCriterion("tags is not null"); return (Criteria) this; } - public Criteria andTagIdEqualTo(String value) { - addCriterion("tag_id =", value, "tagId"); + public Criteria andTagsEqualTo(String value) { + addCriterion("tags =", value, "tags"); return (Criteria) this; } - public Criteria andTagIdNotEqualTo(String value) { - addCriterion("tag_id <>", value, "tagId"); + public Criteria andTagsNotEqualTo(String value) { + addCriterion("tags <>", value, "tags"); return (Criteria) this; } - public Criteria andTagIdGreaterThan(String value) { - addCriterion("tag_id >", value, "tagId"); + public Criteria andTagsGreaterThan(String value) { + addCriterion("tags >", value, "tags"); return (Criteria) this; } - public Criteria andTagIdGreaterThanOrEqualTo(String value) { - addCriterion("tag_id >=", value, "tagId"); + public Criteria andTagsGreaterThanOrEqualTo(String value) { + addCriterion("tags >=", value, "tags"); return (Criteria) this; } - public Criteria andTagIdLessThan(String value) { - addCriterion("tag_id <", value, "tagId"); + public Criteria andTagsLessThan(String value) { + addCriterion("tags <", value, "tags"); return (Criteria) this; } - public Criteria andTagIdLessThanOrEqualTo(String value) { - addCriterion("tag_id <=", value, "tagId"); + public Criteria andTagsLessThanOrEqualTo(String value) { + addCriterion("tags <=", value, "tags"); return (Criteria) this; } - public Criteria andTagIdLike(String value) { - addCriterion("tag_id like", value, "tagId"); + public Criteria andTagsLike(String value) { + addCriterion("tags like", value, "tags"); return (Criteria) this; } - public Criteria andTagIdNotLike(String value) { - addCriterion("tag_id not like", value, "tagId"); + public Criteria andTagsNotLike(String value) { + addCriterion("tags not like", value, "tags"); return (Criteria) this; } - public Criteria andTagIdIn(List values) { - addCriterion("tag_id in", values, "tagId"); + public Criteria andTagsIn(List values) { + addCriterion("tags in", values, "tags"); return (Criteria) this; } - public Criteria andTagIdNotIn(List values) { - addCriterion("tag_id not in", values, "tagId"); + public Criteria andTagsNotIn(List values) { + addCriterion("tags not in", values, "tags"); return (Criteria) this; } - public Criteria andTagIdBetween(String value1, String value2) { - addCriterion("tag_id between", value1, value2, "tagId"); + public Criteria andTagsBetween(String value1, String value2) { + addCriterion("tags between", value1, value2, "tags"); return (Criteria) this; } - public Criteria andTagIdNotBetween(String value1, String value2) { - addCriterion("tag_id not between", value1, value2, "tagId"); + public Criteria andTagsNotBetween(String value1, String value2) { + addCriterion("tags not between", value1, value2, "tags"); return (Criteria) this; } diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTag.java b/backend/src/main/java/io/metersphere/base/domain/ApiTag.java deleted file mode 100644 index 2d19531caa..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTag.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.metersphere.base.domain; - -import java.io.Serializable; -import lombok.Data; - -@Data -public class ApiTag implements Serializable { - private String id; - - private String projectId; - - private String name; - - private String userId; - - private Long createTime; - - private Long updateTime; - - private static final long serialVersionUID = 1L; -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/ApiTagExample.java b/backend/src/main/java/io/metersphere/base/domain/ApiTagExample.java deleted file mode 100644 index 10e1714222..0000000000 --- a/backend/src/main/java/io/metersphere/base/domain/ApiTagExample.java +++ /dev/null @@ -1,600 +0,0 @@ -package io.metersphere.base.domain; - -import java.util.ArrayList; -import java.util.List; - -public class ApiTagExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public ApiTagExample() { - oredCriteria = new ArrayList(); - } - - 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 andProjectIdIsNull() { - addCriterion("project_id is null"); - return (Criteria) this; - } - - public Criteria andProjectIdIsNotNull() { - addCriterion("project_id is not null"); - return (Criteria) this; - } - - public Criteria andProjectIdEqualTo(String value) { - addCriterion("project_id =", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdNotEqualTo(String value) { - addCriterion("project_id <>", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdGreaterThan(String value) { - addCriterion("project_id >", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdGreaterThanOrEqualTo(String value) { - addCriterion("project_id >=", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdLessThan(String value) { - addCriterion("project_id <", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdLessThanOrEqualTo(String value) { - addCriterion("project_id <=", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdLike(String value) { - addCriterion("project_id like", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdNotLike(String value) { - addCriterion("project_id not like", value, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdIn(List values) { - addCriterion("project_id in", values, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdNotIn(List values) { - addCriterion("project_id not in", values, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdBetween(String value1, String value2) { - addCriterion("project_id between", value1, value2, "projectId"); - return (Criteria) this; - } - - public Criteria andProjectIdNotBetween(String value1, String value2) { - addCriterion("project_id not between", value1, value2, "projectId"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("`name` is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("`name` is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("`name` =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("`name` <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("`name` >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("`name` >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("`name` <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("`name` <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("`name` like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("`name` not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("`name` in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("`name` not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("`name` between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("`name` not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andUserIdIsNull() { - addCriterion("user_id is null"); - return (Criteria) this; - } - - public Criteria andUserIdIsNotNull() { - addCriterion("user_id is not null"); - return (Criteria) this; - } - - public Criteria andUserIdEqualTo(String value) { - addCriterion("user_id =", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotEqualTo(String value) { - addCriterion("user_id <>", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThan(String value) { - addCriterion("user_id >", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThanOrEqualTo(String value) { - addCriterion("user_id >=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThan(String value) { - addCriterion("user_id <", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThanOrEqualTo(String value) { - addCriterion("user_id <=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLike(String value) { - addCriterion("user_id like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotLike(String value) { - addCriterion("user_id not like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdIn(List values) { - addCriterion("user_id in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotIn(List values) { - addCriterion("user_id not in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdBetween(String value1, String value2) { - addCriterion("user_id between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotBetween(String value1, String value2) { - addCriterion("user_id not between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNull() { - addCriterion("create_time is null"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNotNull() { - addCriterion("create_time is not null"); - return (Criteria) this; - } - - public Criteria andCreateTimeEqualTo(Long value) { - addCriterion("create_time =", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotEqualTo(Long value) { - addCriterion("create_time <>", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThan(Long value) { - addCriterion("create_time >", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { - addCriterion("create_time >=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThan(Long value) { - addCriterion("create_time <", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThanOrEqualTo(Long value) { - addCriterion("create_time <=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeIn(List values) { - addCriterion("create_time in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotIn(List values) { - addCriterion("create_time not in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeBetween(Long value1, Long value2) { - addCriterion("create_time between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotBetween(Long value1, Long value2) { - addCriterion("create_time not between", value1, value2, "createTime"); - 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 values) { - addCriterion("update_time in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioMapper.xml index 9961e13b12..5e4082cd5e 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ApiScenarioMapper.xml @@ -4,7 +4,7 @@ - + @@ -84,7 +84,7 @@ - id, project_id, tag_id, user_id, api_scenario_module_id, module_path, `name`, `level`, + id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`, `status`, principal, step_total, follow_people, schedule, create_time, update_time, pass_rate, last_result, report_id @@ -140,7 +140,7 @@ - insert into api_scenario (id, project_id, tag_id, + insert into api_scenario (id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`, `status`, principal, step_total, follow_people, @@ -148,7 +148,7 @@ pass_rate, last_result, report_id, scenario_definition, description ) - values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tagId,jdbcType=VARCHAR}, + values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR}, @@ -166,8 +166,8 @@ project_id, - - tag_id, + + tags, user_id, @@ -228,8 +228,8 @@ #{projectId,jdbcType=VARCHAR}, - - #{tagId,jdbcType=VARCHAR}, + + #{tags,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, @@ -299,8 +299,8 @@ project_id = #{record.projectId,jdbcType=VARCHAR}, - - tag_id = #{record.tagId,jdbcType=VARCHAR}, + + tags = #{record.tags,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR}, @@ -362,7 +362,7 @@ update api_scenario set id = #{record.id,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR}, - tag_id = #{record.tagId,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR}, api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR}, @@ -388,7 +388,7 @@ update api_scenario set id = #{record.id,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR}, - tag_id = #{record.tagId,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR}, api_scenario_module_id = #{record.apiScenarioModuleId,jdbcType=VARCHAR}, module_path = #{record.modulePath,jdbcType=VARCHAR}, @@ -414,8 +414,8 @@ project_id = #{projectId,jdbcType=VARCHAR}, - - tag_id = #{tagId,jdbcType=VARCHAR}, + + tags = #{tags,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR}, @@ -474,7 +474,7 @@ update api_scenario set project_id = #{projectId,jdbcType=VARCHAR}, - tag_id = #{tagId,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR}, api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR}, @@ -497,7 +497,7 @@ update api_scenario set project_id = #{projectId,jdbcType=VARCHAR}, - tag_id = #{tagId,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR}, api_scenario_module_id = #{apiScenarioModuleId,jdbcType=VARCHAR}, module_path = #{modulePath,jdbcType=VARCHAR}, diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.java deleted file mode 100644 index 8795a292f5..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.metersphere.base.mapper; - -import io.metersphere.base.domain.ApiTag; -import io.metersphere.base.domain.ApiTagExample; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -public interface ApiTagMapper { - long countByExample(ApiTagExample example); - - int deleteByExample(ApiTagExample example); - - int deleteByPrimaryKey(String id); - - int insert(ApiTag record); - - int insertSelective(ApiTag record); - - List selectByExample(ApiTagExample example); - - ApiTag selectByPrimaryKey(String id); - - int updateByExampleSelective(@Param("record") ApiTag record, @Param("example") ApiTagExample example); - - int updateByExample(@Param("record") ApiTag record, @Param("example") ApiTagExample example); - - int updateByPrimaryKeySelective(ApiTag record); - - int updateByPrimaryKey(ApiTag record); -} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.xml deleted file mode 100644 index 044be8cc4a..0000000000 --- a/backend/src/main/java/io/metersphere/base/mapper/ApiTagMapper.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, project_id, `name`, user_id, create_time, update_time - - - - - delete from api_tag - where id = #{id,jdbcType=VARCHAR} - - - delete from api_tag - - - - - - insert into api_tag (id, project_id, `name`, - user_id, create_time, update_time - ) - values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, - #{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} - ) - - - insert into api_tag - - - id, - - - project_id, - - - `name`, - - - user_id, - - - create_time, - - - update_time, - - - - - #{id,jdbcType=VARCHAR}, - - - #{projectId,jdbcType=VARCHAR}, - - - #{name,jdbcType=VARCHAR}, - - - #{userId,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=BIGINT}, - - - - - - update api_tag - - - id = #{record.id,jdbcType=VARCHAR}, - - - project_id = #{record.projectId,jdbcType=VARCHAR}, - - - `name` = #{record.name,jdbcType=VARCHAR}, - - - user_id = #{record.userId,jdbcType=VARCHAR}, - - - create_time = #{record.createTime,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=BIGINT}, - - - - - - - - update api_tag - set id = #{record.id,jdbcType=VARCHAR}, - project_id = #{record.projectId,jdbcType=VARCHAR}, - `name` = #{record.name,jdbcType=VARCHAR}, - user_id = #{record.userId,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT} - - - - - - update api_tag - - - project_id = #{projectId,jdbcType=VARCHAR}, - - - `name` = #{name,jdbcType=VARCHAR}, - - - user_id = #{userId,jdbcType=VARCHAR}, - - - create_time = #{createTime,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=VARCHAR} - - - update api_tag - set project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - user_id = #{userId,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT} - where id = #{id,jdbcType=VARCHAR} - - \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 2ca3a5ccf3..6a5e80574d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -9,7 +9,7 @@ - select * from api_tag - - - and api_tag.name like CONCAT('%', #{request.name},'%') - - - AND api_tag.project_id = #{request.projectId} - - - AND api_tag.id = #{request.id} - - - AND api_tag.user_id = #{request.userId} - - - - \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V50__api_scenario.sql b/backend/src/main/resources/db/migration/V50__api_scenario.sql index b682f0c220..7afc0d42ac 100644 --- a/backend/src/main/resources/db/migration/V50__api_scenario.sql +++ b/backend/src/main/resources/db/migration/V50__api_scenario.sql @@ -58,14 +58,4 @@ CREATE TABLE `api_scenario_report_detail` ( `project_id` varchar(64) NOT NULL COMMENT 'scenario ID', `content` longblob COMMENT 'Report Content', PRIMARY KEY (`report_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - -CREATE TABLE `api_tag` ( - `id` varchar(50) NOT NULL COMMENT 'Test ID', - `project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to', - `name` varchar(200) NOT NULL COMMENT 'api tag', - `user_id` varchar(64) DEFAULT NULL COMMENT 'User ID', - `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', - `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', - PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql b/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql new file mode 100644 index 0000000000..ee6a7c1c3c --- /dev/null +++ b/backend/src/main/resources/db/migration/V53__modify_api_scenario.sql @@ -0,0 +1 @@ +ALTER TABLE api_scenario CHANGE tag_id tags varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT 'tag list'; \ No newline at end of file diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 639a4263f4..8e314a92d4 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,7 +64,7 @@ - +
diff --git a/frontend/package.json b/frontend/package.json index cc05d4c0c6..8f2fc5b9ee 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -17,29 +17,30 @@ "@fortawesome/vue-fontawesome": "^0.1.9", "axios": "^0.19.0", "core-js": "^3.4.3", + "diffable-html": "^4.0.0", "echarts": "^4.6.0", + "el-table-infinite-scroll": "^1.0.10", "element-ui": "^2.13.0", + "html2canvas": "^1.0.0-rc.7", + "js-base64": "^3.4.4", + "json-bigint": "^1.0.0", + "jsoneditor": "^9.1.2", + "jspdf": "^2.1.1", + "md5": "^2.3.0", + "mockjs": "^1.1.0", + "nprogress": "^0.2.0", + "sha.js": "^2.4.11", "vue": "^2.6.10", + "vue-calendar-heatmap": "^0.8.4", "vue-echarts": "^4.1.0", "vue-i18n": "^8.15.3", + "vue-input-tag": "^2.0.7", + "vue-pdf": "^4.2.0", "vue-router": "^3.1.3", "vuedraggable": "^2.23.2", "vuex": "^3.1.2", - "vue-calendar-heatmap": "^0.8.4", - "mockjs": "^1.1.0", - "md5": "^2.3.0", - "sha.js": "^2.4.11", - "js-base64": "^3.4.4", - "json-bigint": "^1.0.0", - "html2canvas": "^1.0.0-rc.7", - "jspdf": "^2.1.1", - "yan-progress": "^1.0.3", - "nprogress": "^0.2.0", - "el-table-infinite-scroll": "^1.0.10", - "vue-pdf": "^4.2.0", - "diffable-html": "^4.0.0", "xml-js": "^1.6.11", - "jsoneditor": "^9.1.2" + "yan-progress": "^1.0.3" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/api/automation/scenario/AddTag.vue b/frontend/src/business/components/api/automation/scenario/AddTag.vue deleted file mode 100644 index f9c073820e..0000000000 --- a/frontend/src/business/components/api/automation/scenario/AddTag.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 1e1bea9afc..bf94769711 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -25,9 +25,9 @@ - + @@ -167,6 +167,11 @@ let data = response.data; this.total = data.itemCount; this.tableData = data.listObject; + this.tableData.forEach(item => { + if (item.tags && item.tags.length > 0) { + item.tags = JSON.parse(item.tags); + } + }) this.loading = false; }); }, diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 5df9e6e1f0..5b629ca447 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -79,25 +79,8 @@ - - - - - {{ $t('api_test.automation.create_tag') }} - - - - + + @@ -259,8 +242,6 @@ - - @@ -293,13 +274,14 @@ import MsApiCustomize from "./ApiCustomize"; import {getUUID, getCurrentProjectID} from "@/common/js/utils"; import ApiEnvironmentConfig from "../../definition/components/environment/ApiEnvironmentConfig"; - import MsAddTag from "./AddTag"; + import MsInputTag from "./MsInputTag"; import MsRun from "./DebugRun"; import MsImportApiScenario from "./ImportApiScenario"; import MsApiScenarioComponent from "./ApiScenarioComponent"; import MsApiReportDetail from "../report/ApiReportDetail"; import MsScenarioParameters from "./ScenarioParameters"; import ApiImport from "../../definition/components/import/ApiImport"; + import InputTag from 'vue-input-tag' export default { name: "EditApiScenario", @@ -311,7 +293,7 @@ ApiEnvironmentConfig, MsScenarioParameters, MsApiReportDetail, - MsAddTag, MsRun, + MsInputTag, MsRun, MsApiScenarioComponent, MsImportApiScenario, MsJsr233Processor, @@ -323,6 +305,7 @@ MsApiComponent, MsApiCustomize, ApiImport, + InputTag, }, data() { return { @@ -341,7 +324,6 @@ principal: [{required: true, message: this.$t('api_test.definition.request.responsible'), trigger: 'change'}], }, environments: [], - tags: [], currentEnvironmentId: "", maintainerOptions: [], value: API_STATUS[0].id, @@ -366,7 +348,8 @@ visibleRef: "", enableCookieShare: false, } - }, + } + , created() { if (!this.currentScenario.apiScenarioModuleId) { this.currentScenario.apiScenarioModuleId = ""; @@ -374,11 +357,12 @@ this.projectId = getCurrentProjectID(); this.operatingElements = ELEMENTS.get("ALL"); this.getMaintainerOptions(); - this.refreshTags(); this.getApiScenario(); this.getEnvironments(); - }, - watch: {}, + } + , + watch: {} + , methods: { addComponent(type) { switch (type) { @@ -423,7 +407,8 @@ } this.sort(); this.reload(); - }, + } + , nodeClick(e) { if (e.referenced != 'REF' && e.referenced != 'Deleted') { this.operatingElements = ELEMENTS.get(e.type); @@ -431,16 +416,19 @@ this.operatingElements = []; } this.selectedTreeNode = e; - }, + } + , showAll() { this.operatingElements = ELEMENTS.get("ALL"); this.selectedTreeNode = undefined; this.reload(); - }, + } + , apiListImport() { this.visibleRef = getUUID(); this.apiListVisible = true; - }, + } + , recursiveSorting(arr) { for (let i in arr) { arr[i].index = Number(i) + 1; @@ -448,7 +436,8 @@ this.recursiveSorting(arr[i].hashTree); } } - }, + } + , sort() { for (let i in this.scenarioDefinition) { this.scenarioDefinition[i].index = Number(i) + 1; @@ -456,7 +445,8 @@ this.recursiveSorting(this.scenarioDefinition[i].hashTree); } } - }, + } + , addCustomizeApi(request) { this.customizeVisible = false; request.enable === undefined ? request.enable = true : request.enable; @@ -468,7 +458,8 @@ this.customizeRequest = {}; this.sort(); this.reload(); - }, + } + , addScenario(arr) { if (arr && arr.length > 0) { arr.forEach(item => { @@ -483,7 +474,8 @@ this.sort(); this.reload(); this.scenarioVisible = false; - }, + } + , setApiParameter(item, refType, referenced) { let request = {}; if (Object.prototype.toString.call(item.request).indexOf("String") > 0) { @@ -512,7 +504,8 @@ } else { this.scenarioDefinition.push(request); } - }, + } + , pushApiOrCase(referenced) { if (this.currentRow.cases.length === 0 && this.currentRow.apis.length === 0) { this.$warning(this.$t('api_test.automation.reference_info')); @@ -529,13 +522,15 @@ this.currentRow.apis = []; this.sort(); this.reload(); - }, + } + , getMaintainerOptions() { let workspaceId = localStorage.getItem(WORKSPACE_ID); this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => { this.maintainerOptions = response.data; }); - }, + } + , openTagConfig() { if (!this.projectId) { this.$error(this.$t('api_test.select_project')); @@ -543,20 +538,6 @@ } this.$refs.tag.open(); }, - refreshTags() { - let obj = {projectId: this.projectId}; - let tagIds = []; - this.$post('/api/tag/list', obj, response => { - this.tags = response.data; - this.tags.forEach(item => { - tagIds.push(item.id); - }) - if (this.currentScenario.tagId != undefined && this.currentScenario.tagId.length > 0) { - this.currentScenario.tagId = this.currentScenario.tagId.filter(id => tagIds.indexOf(id) != -1); - } - }); - - }, remove(row, node) { const parent = node.parent const hashTree = parent.data.hashTree || parent.data; @@ -564,7 +545,8 @@ hashTree.splice(index, 1); this.sort(); this.reload(); - }, + } + , copyRow(row, node) { const parent = node.parent const hashTree = parent.data.hashTree || parent.data; @@ -574,13 +556,15 @@ hashTree.push(obj); this.sort(); this.reload(); - }, + } + , reload() { this.loading = true this.$nextTick(() => { this.loading = false }) - }, + } + , runDebug() { /*触发执行操作*/ if (!this.currentEnvironmentId) { @@ -593,7 +577,8 @@ environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition }; this.reportId = getUUID().substring(0, 8); - }, + } + , getEnvironments() { if (this.projectId) { this.$get('/api/environment/list/' + this.projectId, response => { @@ -603,17 +588,20 @@ }); }); } - }, + } + , openEnvironmentConfig() { if (!this.projectId) { this.$error(this.$t('api_test.select_project')); return; } this.$refs.environmentConfig.open(this.projectId); - }, + } + , environmentConfigClose() { this.getEnvironments(); - }, + } + , allowDrop(draggingNode, dropNode, dropType) { if (dropType != "inner") { return true; @@ -622,21 +610,25 @@ return true; } return false; - }, + } + , allowDrag(draggingNode, dropNode, dropType) { this.sort(); this.reload(); - }, + } + , nodeExpand(data) { if (data.resourceId) { this.expandedNode.push(data.resourceId); } - }, + } + , nodeCollapse(data) { if (data.resourceId) { this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1); } - }, + } + , getPath(id) { if (id === null) { return null; @@ -645,7 +637,8 @@ return item.id === id ? item.path : ""; }); return path[0].path; - }, + } + , setFiles(item, bodyUploadFiles, obj) { if (item.body) { if (item.body.kvs) { @@ -683,7 +676,8 @@ }); } } - }, + } + , recursiveFile(arr, bodyUploadFiles, obj) { arr.forEach(item => { this.setFiles(item, bodyUploadFiles, obj); @@ -691,7 +685,8 @@ this.recursiveFile(item.hashTree, bodyUploadFiles, obj); } }); - }, + } + , getBodyUploadFiles(obj) { let bodyUploadFiles = []; obj.bodyUploadIds = []; @@ -702,7 +697,8 @@ } }) return bodyUploadFiles; - }, + } + , editScenario() { this.$refs['currentScenario'].validate((valid) => { if (valid) { @@ -714,15 +710,18 @@ if (response.data) { this.currentScenario.id = response.data.id; } - this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId); + if (this.currentScenario.tags instanceof String) { + this.currentScenario.tags = JSON.parse(this.currentScenario.tags); + } this.$emit('refresh'); }) } }) - }, + } + , getApiScenario() { - if (this.currentScenario.tagId != undefined && !(this.currentScenario.tagId instanceof Array)) { - this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId); + if (this.currentScenario.tags != undefined && !(this.currentScenario.tags instanceof Array)) { + this.currentScenario.tags = JSON.parse(this.currentScenario.tags); } if (this.currentScenario.id) { this.result = this.$get("/api/automation/getApiScenario/" + this.currentScenario.id, response => { @@ -743,7 +742,8 @@ } }) } - }, + } + , setParameter() { this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.projectId = getCurrentProjectID(); @@ -754,26 +754,30 @@ type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition }; this.currentScenario.scenarioDefinition = scenario; - if (this.currentScenario.tagId instanceof Array) { - this.currentScenario.tagId = JSON.stringify(this.currentScenario.tagId); + if (this.currentScenario.tags instanceof Array) { + this.currentScenario.tags = JSON.stringify(this.currentScenario.tags); } if (this.currentModule != null) { this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null; this.currentScenario.apiScenarioModuleId = this.currentModule.id; } this.currentScenario.projectId = this.projectId; - }, + } + , runRefresh() { this.debugVisible = true; this.loading = false; - }, + } + , showScenarioParameters() { this.$refs.scenarioParameters.open(this.currentScenario.variables); - }, + } + , addParameters(data) { this.currentScenario.variables = data; this.reload(); - }, + } + , apiImport(importData) { if (importData && importData.data) { importData.data.forEach(item => { @@ -939,4 +943,9 @@ font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif; font-size: 13px; } + + /deep/ .el-form-item__content { + line-height: 100%; + } + diff --git a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue new file mode 100644 index 0000000000..f9f5c26ff6 --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue b/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue index 117b735ac9..f11174fbf2 100644 --- a/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue +++ b/frontend/src/business/components/performance/head/PerformanceHeaderMenus.vue @@ -2,7 +2,7 @@