feat(任务中心): 任务中心定时任务增加测试计划展示
This commit is contained in:
parent
0f2ba1d329
commit
d30cf886f2
|
@ -3,8 +3,6 @@ package io.metersphere.sdk.constants;
|
|||
public enum ScheduleResourceType {
|
||||
API_IMPORT,
|
||||
API_SCENARIO,
|
||||
UI_SCENARIO,
|
||||
LOAD_TEST,
|
||||
TEST_PLAN,
|
||||
CLEAN_REPORT,
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ public class Swagger3Parser<T> extends ApiImportAbstractParser<ApiDefinitionImpo
|
|||
body.setBodyType(Body.BodyType.JSON.name());
|
||||
JsonBody jsonBody = new JsonBody();
|
||||
jsonBody.setJsonSchema(jsonSchemaItem);
|
||||
jsonBody.setEnableJsonSchema(true);
|
||||
jsonBody.setEnableJsonSchema(false);
|
||||
if (ObjectUtils.isNotEmpty(value.getExample())) {
|
||||
jsonBody.setJsonValue(ApiDataUtils.toJSONString(value.getExample()));
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void deleteOrg(@PathVariable String moduleType, @PathVariable String id) {
|
||||
hasPermission(ORG, moduleType);
|
||||
taskCenterService.delete(id, moduleType,SessionUtils.getUserId(), "/task/center/org/schedule/delete/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
taskCenterService.delete(id, moduleType, SessionUtils.getUserId(), "/task/center/org/schedule/delete/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
}
|
||||
|
||||
@GetMapping("/project/schedule/delete/{moduleType}/{id}")
|
||||
|
@ -82,7 +82,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void deleteProject(@PathVariable String moduleType, @PathVariable String id) {
|
||||
hasPermission(PROJECT, moduleType);
|
||||
taskCenterService.delete(id, moduleType,SessionUtils.getUserId(), "/task/center/project/schedule/delete/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
taskCenterService.delete(id, moduleType, SessionUtils.getUserId(), "/task/center/project/schedule/delete/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
}
|
||||
|
||||
@GetMapping("/system/schedule/switch/{moduleType}/{id}")
|
||||
|
@ -90,7 +90,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void enable(@PathVariable String moduleType, @PathVariable String id) {
|
||||
hasPermission(SYSTEM, moduleType);
|
||||
taskCenterService.enable(id, moduleType,SessionUtils.getUserId(), "/task/center/system/schedule/switch/", OperationLogModule.SETTING_SYSTEM_TASK_CENTER);
|
||||
taskCenterService.enable(id, moduleType, SessionUtils.getUserId(), "/task/center/system/schedule/switch/", OperationLogModule.SETTING_SYSTEM_TASK_CENTER);
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void enableOrg(@PathVariable String moduleType, @PathVariable String id) {
|
||||
hasPermission(ORG, moduleType);
|
||||
taskCenterService.enable(id, moduleType,SessionUtils.getUserId(), "/task/center/org/schedule/switch/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
taskCenterService.enable(id, moduleType, SessionUtils.getUserId(), "/task/center/org/schedule/switch/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
}
|
||||
|
||||
@GetMapping("/project/schedule/switch/{moduleType}/{id}")
|
||||
|
@ -107,7 +107,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void enableProject(@PathVariable String moduleType, @PathVariable String id) {
|
||||
hasPermission(PROJECT, moduleType);
|
||||
taskCenterService.enable(id, moduleType,SessionUtils.getUserId(), "/task/center/project/schedule/switch/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
taskCenterService.enable(id, moduleType, SessionUtils.getUserId(), "/task/center/project/schedule/switch/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
}
|
||||
|
||||
@PostMapping("/system/schedule/update/{moduleType}/{id}")
|
||||
|
@ -115,7 +115,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void update(@PathVariable String moduleType, @PathVariable String id, @RequestBody Object cron) {
|
||||
hasPermission(SYSTEM, moduleType);
|
||||
taskCenterService.update(id, moduleType,cron.toString(), SessionUtils.getUserId(), "/task/center/system/schedule/update/", OperationLogModule.SETTING_SYSTEM_TASK_CENTER);
|
||||
taskCenterService.update(id, moduleType, cron.toString(), SessionUtils.getUserId(), "/task/center/system/schedule/update/", OperationLogModule.SETTING_SYSTEM_TASK_CENTER);
|
||||
}
|
||||
|
||||
@PostMapping("/org/schedule/update/{moduleType}/{id}")
|
||||
|
@ -123,7 +123,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void updateOrg(@PathVariable String moduleType, @PathVariable String id, @RequestBody Object cron) {
|
||||
hasPermission(ORG, moduleType);
|
||||
taskCenterService.update(id, moduleType,cron.toString(), SessionUtils.getUserId(), "/task/center/org/schedule/update/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
taskCenterService.update(id, moduleType, cron.toString(), SessionUtils.getUserId(), "/task/center/org/schedule/update/", OperationLogModule.SETTING_ORGANIZATION_TASK_CENTER);
|
||||
}
|
||||
|
||||
@PostMapping("/project/schedule/update/{moduleType}/{id}")
|
||||
|
@ -131,7 +131,7 @@ public class TaskCenterController {
|
|||
@CheckOwner(resourceId = "#id", resourceType = "schedule")
|
||||
public void updateProject(@PathVariable String moduleType, @PathVariable String id, @RequestBody Object cron) {
|
||||
hasPermission(PROJECT, moduleType);
|
||||
taskCenterService.update(id, moduleType,cron.toString(), SessionUtils.getUserId(), "/task/center/project/schedule/update/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
taskCenterService.update(id, moduleType, cron.toString(), SessionUtils.getUserId(), "/task/center/project/schedule/update/", OperationLogModule.PROJECT_MANAGEMENT_TASK_CENTER);
|
||||
}
|
||||
|
||||
@PostMapping("/system/schedule/batch-enable")
|
||||
|
@ -180,12 +180,15 @@ public class TaskCenterController {
|
|||
Map<String, List<String>> projectPermission = new HashMap<>(2);
|
||||
projectPermission.put(ScheduleTagType.API_IMPORT.toString(), List.of(PermissionConstants.PROJECT_API_DEFINITION_IMPORT));
|
||||
projectPermission.put(TaskCenterResourceType.API_SCENARIO.toString(), List.of(PermissionConstants.PROJECT_API_SCENARIO_EXECUTE));
|
||||
projectPermission.put(TaskCenterResourceType.TEST_PLAN.toString(), List.of(PermissionConstants.TEST_PLAN_READ_EXECUTE));
|
||||
Map<String, List<String>> orgPermission = new HashMap<>(2);
|
||||
orgPermission.put(ScheduleTagType.API_IMPORT.toString(), List.of(PermissionConstants.ORGANIZATION_TASK_CENTER_READ_STOP, PermissionConstants.PROJECT_API_DEFINITION_IMPORT));
|
||||
orgPermission.put(TaskCenterResourceType.API_SCENARIO.toString(), List.of(PermissionConstants.ORGANIZATION_TASK_CENTER_READ_STOP, PermissionConstants.PROJECT_API_SCENARIO_EXECUTE));
|
||||
orgPermission.put(TaskCenterResourceType.TEST_PLAN.toString(), List.of(PermissionConstants.ORGANIZATION_TASK_CENTER_READ_STOP, PermissionConstants.TEST_PLAN_READ_EXECUTE));
|
||||
Map<String, List<String>> systemPermission = new HashMap<>(2);
|
||||
systemPermission.put(ScheduleTagType.API_IMPORT.toString(), List.of(PermissionConstants.SYSTEM_TASK_CENTER_READ_STOP, PermissionConstants.PROJECT_API_DEFINITION_IMPORT));
|
||||
systemPermission.put(TaskCenterResourceType.API_SCENARIO.toString(), List.of(PermissionConstants.SYSTEM_TASK_CENTER_READ_STOP, PermissionConstants.PROJECT_API_SCENARIO_EXECUTE));
|
||||
systemPermission.put(TaskCenterResourceType.TEST_PLAN.toString(), List.of(PermissionConstants.SYSTEM_TASK_CENTER_READ_STOP, PermissionConstants.TEST_PLAN_READ_EXECUTE));
|
||||
|
||||
boolean hasPermission = switch (type) {
|
||||
case ORG ->
|
||||
|
|
|
@ -59,7 +59,8 @@ public class TaskCenterScheduleDTO implements Serializable {
|
|||
private Long createTime;
|
||||
@Schema(description = "swaggerUrl")
|
||||
private String swaggerUrl;
|
||||
|
||||
@Schema(description = "任务类型 测试计划组 GROUP 测试计划 TEST_PLAN")
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,25 @@
|
|||
inner join api_scenario on schedule.resource_id = api_scenario.id
|
||||
</if>
|
||||
|
||||
<if test="request.scheduleTagType == 'TEST_PLAN'">
|
||||
SELECT
|
||||
schedule.id,
|
||||
schedule.name as taskname,
|
||||
schedule.project_id,
|
||||
resource_type,
|
||||
test_plan.num as resource_num,
|
||||
test_plan.name as resource_name,
|
||||
test_plan.id as resource_id,
|
||||
schedule.value,
|
||||
schedule.enable,
|
||||
schedule.create_user AS createUserName,
|
||||
schedule.create_time,
|
||||
test_plan.type
|
||||
FROM
|
||||
schedule
|
||||
inner join test_plan on schedule.resource_id = test_plan.id
|
||||
</if>
|
||||
|
||||
) task left join project on task.project_id = project.id
|
||||
left join QRTZ_TRIGGERS on task.resource_id = QRTZ_TRIGGERS.TRIGGER_NAME
|
||||
where
|
||||
|
@ -85,6 +104,12 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='type'">
|
||||
and task.type in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
@ -171,6 +196,16 @@
|
|||
schedule
|
||||
inner join api_scenario on schedule.resource_id = api_scenario.id
|
||||
</if>
|
||||
<if test="request.scheduleTagType == 'TEST_PLAN'">
|
||||
SELECT
|
||||
schedule.*,
|
||||
test_plan.type,
|
||||
test_plan.num as resource_num,
|
||||
test_plan.name as resource_name
|
||||
FROM
|
||||
schedule
|
||||
inner join test_plan on schedule.resource_id = test_plan.id
|
||||
</if>
|
||||
|
||||
) task left join project on task.project_id = project.id
|
||||
where
|
||||
|
|
|
@ -75,6 +75,7 @@ public class CommonProjectService {
|
|||
private TestResourcePoolService testResourcePoolService;
|
||||
public static final Integer DEFAULT_REMAIN_DAY_COUNT = 30;
|
||||
public static final String API_TEST = "apiTest";
|
||||
public static final String TEST_PLAN = "testPlan";
|
||||
|
||||
@Autowired
|
||||
public CommonProjectService(ProjectServiceInvoker serviceInvoker) {
|
||||
|
@ -645,7 +646,7 @@ public class CommonProjectService {
|
|||
//这里需要获取项目开启的模块 判断资源池开启的使用范围的模块是否在项目开启的模块中
|
||||
List<String> moduleIds = request.getModulesIds();
|
||||
testResourcePools.forEach(pool -> {
|
||||
if (moduleIds.contains(API_TEST)) {
|
||||
if (moduleIds.contains(API_TEST) || moduleIds.contains(TEST_PLAN)) {
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
optionDTO.setId(pool.getId());
|
||||
optionDTO.setName(pool.getName());
|
||||
|
|
|
@ -40,7 +40,10 @@ import org.quartz.TriggerKey;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -189,7 +192,7 @@ public class TaskCenterService {
|
|||
return organization;
|
||||
}
|
||||
|
||||
public void delete(String id,String moduleType, String userId, String path, String module) {
|
||||
public void delete(String id, String moduleType, String userId, String path, String module) {
|
||||
Schedule schedule = checkScheduleExit(id);
|
||||
String logModule = getLogModule(moduleType, module);
|
||||
if (StringUtils.equals(schedule.getResourceType(), ScheduleTagType.API_IMPORT.name())) {
|
||||
|
@ -203,6 +206,7 @@ public class TaskCenterService {
|
|||
return switch (ScheduleTagType.valueOf(moduleType)) {
|
||||
case ScheduleTagType.API_IMPORT -> StringUtils.join(module, "_TIME_API_IMPORT");
|
||||
case ScheduleTagType.API_SCENARIO -> StringUtils.join(module, "_TIME_API_SCENARIO");
|
||||
case ScheduleTagType.TEST_PLAN -> StringUtils.join(module, "_TIME_TEST_PLAN");
|
||||
default -> throw new MSException(Translator.get("module_type_error"));
|
||||
};
|
||||
}
|
||||
|
@ -215,7 +219,7 @@ public class TaskCenterService {
|
|||
return schedule;
|
||||
}
|
||||
|
||||
public void enable(String id,String moduleType, String userId, String path, String module) {
|
||||
public void enable(String id, String moduleType, String userId, String path, String module) {
|
||||
Schedule schedule = checkScheduleExit(id);
|
||||
schedule.setEnable(!schedule.getEnable());
|
||||
scheduleService.editSchedule(schedule);
|
||||
|
@ -226,7 +230,7 @@ public class TaskCenterService {
|
|||
saveLog(List.of(schedule), userId, path, HttpMethodConstants.GET.name(), logModule, OperationLogType.UPDATE.name());
|
||||
}
|
||||
|
||||
public void update(String id,String moduleType, String cron, String userId, String path, String module) {
|
||||
public void update(String id, String moduleType, String cron, String userId, String path, String module) {
|
||||
Schedule schedule = checkScheduleExit(id);
|
||||
schedule.setValue(cron);
|
||||
scheduleService.editSchedule(schedule);
|
||||
|
|
|
@ -11,7 +11,6 @@ import io.metersphere.system.domain.Schedule;
|
|||
import io.metersphere.system.dto.taskcenter.enums.ScheduleTagType;
|
||||
import io.metersphere.system.dto.taskcenter.request.TaskCenterScheduleBatchRequest;
|
||||
import io.metersphere.system.dto.taskcenter.request.TaskCenterSchedulePageRequest;
|
||||
import io.metersphere.system.mapper.ExtSwaggerMapper;
|
||||
import io.metersphere.system.mapper.ScheduleMapper;
|
||||
import io.metersphere.system.schedule.ScheduleService;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
|
@ -35,7 +34,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
|
||||
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
@AutoConfigureMockMvc
|
||||
class TaskCenterScheduleControllerTests extends BaseTest {
|
||||
|
@ -44,20 +43,17 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
private final static String SCHEDULED_PROJECT_PAGE = BASE_PATH + "project/schedule/page";
|
||||
private final static String SCHEDULED_ORG_PAGE = BASE_PATH + "org/schedule/page";
|
||||
private final static String SCHEDULED_SYSTEM_PAGE = BASE_PATH + "system/schedule/page";
|
||||
private final static String SCHEDULED_DELETE = BASE_PATH + "schedule/delete/";
|
||||
|
||||
|
||||
private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError();
|
||||
|
||||
@Resource
|
||||
ScheduleMapper scheduleMapper;
|
||||
|
||||
@Resource
|
||||
ExtSwaggerMapper extSwaggerMapper;
|
||||
@Resource
|
||||
ScheduleService scheduleService;
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
@Order(9)
|
||||
@Sql(scripts = {"/dml/init_task_center.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
||||
|
@ -75,6 +71,13 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
doTaskCenterSchedulePage("FILTER", SCHEDULED_ORG_PAGE, ScheduleTagType.API_SCENARIO.toString());
|
||||
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.API_SCENARIO.toString());
|
||||
doTaskCenterSchedulePage("FILTER", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.API_SCENARIO.toString());
|
||||
|
||||
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_PROJECT_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
doTaskCenterSchedulePage("FILTER", SCHEDULED_PROJECT_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_ORG_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
doTaskCenterSchedulePage("FILTER", SCHEDULED_ORG_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
doTaskCenterSchedulePage("KEYWORD", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
doTaskCenterSchedulePage("FILTER", SCHEDULED_SYSTEM_PAGE, ScheduleTagType.TEST_PLAN.toString());
|
||||
}
|
||||
|
||||
private void doTaskCenterSchedulePage(String search, String url, String scheduleTagType) throws Exception {
|
||||
|
@ -87,7 +90,8 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
switch (search) {
|
||||
case "KEYWORD" -> configureKeywordSearch(request);
|
||||
case "FILTER" -> configureFilterSearch(request);
|
||||
default -> {}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
|
||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post(url)
|
||||
|
@ -115,7 +119,7 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
|
||||
}
|
||||
|
||||
private void doTaskCenterSchedulePageError( String url, String scheduleTagType) throws Exception {
|
||||
private void doTaskCenterSchedulePageError(String url, String scheduleTagType) throws Exception {
|
||||
TaskCenterSchedulePageRequest request = new TaskCenterSchedulePageRequest();
|
||||
request.setScheduleTagType(scheduleTagType);
|
||||
request.setCurrent(1);
|
||||
|
@ -172,7 +176,7 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
@Test
|
||||
@Order(13)
|
||||
void testEnable() throws Exception {
|
||||
//先导入数据
|
||||
//先导入数据
|
||||
Schedule schedule = new Schedule();
|
||||
schedule.setName("test-schedule-switch");
|
||||
schedule.setResourceId("test-schedule-switch");
|
||||
|
@ -190,12 +194,12 @@ class TaskCenterScheduleControllerTests extends BaseTest {
|
|||
scheduleService.getSchedule(schedule.getId());
|
||||
scheduleService.editSchedule(schedule);
|
||||
scheduleService.getScheduleByResource(schedule.getResourceId(), schedule.getJob());
|
||||
this.requestGet("/task/center/system/schedule/switch/" +"API_IMPORT/"+ "test-schedule-switch");
|
||||
this.requestGet("/task/center/org/schedule/switch/" +"API_IMPORT/"+ "test-schedule-switch");
|
||||
this.requestGet("/task/center/project/schedule/switch/" +"API_IMPORT/"+ "test-schedule-switch");
|
||||
this.requestPost("/task/center/system/schedule/update/" + "API_IMPORT/"+ "test-schedule-switch" ,"/0 0/2 * * * ?");
|
||||
this.requestPost("/task/center/org/schedule/update/" + "API_IMPORT/"+ "test-schedule-switch" ,"/0 0/2 * * * ?");
|
||||
this.requestPost("/task/center/project/schedule/update/" + "API_IMPORT/"+ "test-schedule-switch" ,"/0 0/2 * * * ?");
|
||||
this.requestGet("/task/center/system/schedule/switch/" + "API_IMPORT/" + "test-schedule-switch");
|
||||
this.requestGet("/task/center/org/schedule/switch/" + "API_IMPORT/" + "test-schedule-switch");
|
||||
this.requestGet("/task/center/project/schedule/switch/" + "API_IMPORT/" + "test-schedule-switch");
|
||||
this.requestPost("/task/center/system/schedule/update/" + "API_IMPORT/" + "test-schedule-switch", "/0 0/2 * * * ?");
|
||||
this.requestPost("/task/center/org/schedule/update/" + "API_IMPORT/" + "test-schedule-switch", "/0 0/2 * * * ?");
|
||||
this.requestPost("/task/center/project/schedule/update/" + "API_IMPORT/" + "test-schedule-switch", "/0 0/2 * * * ?");
|
||||
|
||||
//批量操作
|
||||
TaskCenterScheduleBatchRequest request = new TaskCenterScheduleBatchRequest();
|
||||
|
|
|
@ -42,3 +42,11 @@ INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `e
|
|||
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('17', 'key_17', 'cron', '59 46 16 01 06 ?', 'JobClass17', 'UI_SCENARIO', b'1', 'ui_scenario_17', 'admin', 1640777600000, 1640778600000, '100001100001', 'Schedule 17', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('24', 'key_24', 'cron', '19 22 11 20 05 ?', 'JobClass24', 'UI_SCENARIO', b'0', 'ui_scenario_24', 'admin', 1640778300000, 1640779300000, '100001100001', 'Schedule 24', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('3', 'key_3', 'cron', '50 50 16 01 06 ?', 'JobClass3', 'UI_SCENARIO', b'0', 'ui_scenario_3', 'admin', 1640776200000, 1640777200000, '100001100001', 'Schedule 3', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||
|
||||
INSERT INTO `test_plan`(`id`, `num`, `project_id`, `group_id`, `module_id`, `name`, `status`, `type`, `tags`, `create_time`, `create_user`, `update_time`, `update_user`, `planned_start_time`, `planned_end_time`, `actual_start_time`, `actual_end_time`, `description`)
|
||||
VALUES
|
||||
('test_plan_1', 5000, '100001100001', 'NONE', '1', 'qwe', 'PREPARED', 'TEST_PLAN', NULL, 1714980158000, 'WX', 1714980158000, 'WX', 1714980158000, 1714980158000, 1714980158000, 1714980158000, '11'),
|
||||
('test_plan_2', 10000, '100001100001', 'NONE', '1', 'eeew', 'PREPARED', 'TEST_PLAN', NULL, 1714980158000, 'WX', 1714980158000, 'WX', 1714980158000, 1714980158000, 1714980158000, 1714980158000, '11');
|
||||
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('test_plan1', 'test_plan1', 'cron', '50 50 16 01 06 ?', 'JobClass3', 'TEST_PLAN', b'0', 'test_plan_1', 'admin', 1640776200000, 1640777200000, '100001100001', 'Schedule 3', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||
INSERT INTO `schedule` (`id`, `key`, `type`, `value`, `job`, `resource_type`, `enable`, `resource_id`, `create_user`, `create_time`, `update_time`, `project_id`, `name`, `config`) VALUES ('test_plan2', 'test_plan2', 'cron', '50 50 16 01 06 ?', 'JobClass3', 'TEST_PLAN', b'0', 'test_plan_2', 'admin', 1640776200000, 1640777200000, '100001100001', 'Schedule 3', '{\"param1\": \"value1\", \"param2\": \"value2\"}');
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ export enum TableOpenDetailModeEnum {
|
|||
DRAWER = 'drawer',
|
||||
NEW_WINDOW = 'new_window',
|
||||
}
|
||||
|
||||
export enum TableModuleEnum {
|
||||
USERGROUPINDEX = 'userGroupIndex',
|
||||
}
|
||||
|
@ -80,6 +81,9 @@ export enum TableKeyEnum {
|
|||
TASK_SCHEDULE_TASK_API_SCENARIO_ORGANIZATION = 'taskCenterScheduleApiScenarioOrganization',
|
||||
TASK_SCHEDULE_TASK_API_IMPORT_PROJECT = 'taskCenterScheduleApiImportProject',
|
||||
TASK_SCHEDULE_TASK_API_SCENARIO_PROJECT = 'taskCenterScheduleApiScenarioProject',
|
||||
TASK_SCHEDULE_TASK_TEST_PLAN_SYSTEM = 'taskCenterScheduleTestPlanSystem',
|
||||
TASK_SCHEDULE_TASK_TEST_PLAN_ORGANIZATION = 'taskCenterScheduleTestPlanOrganization',
|
||||
TASK_SCHEDULE_TASK_TEST_PLAN_PROJECT = 'taskCenterScheduleTestPlanProject',
|
||||
}
|
||||
|
||||
// 具有特殊功能的列
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
<template>
|
||||
<div class="p-4 pt-0">
|
||||
<a-radio-group
|
||||
v-if="props.moduleType === 'TEST_PLAN'"
|
||||
v-model:model-value="showType"
|
||||
type="button"
|
||||
class="file-show-type"
|
||||
@change="changeShowType"
|
||||
>
|
||||
<a-radio value="All">{{ t('report.all') }}</a-radio>
|
||||
<a-radio value="TEST_PLAN">{{ t('project.taskCenter.plan') }}</a-radio>
|
||||
<a-radio value="GROUP">{{ t('project.taskCenter.planGroup') }}</a-radio>
|
||||
</a-radio-group>
|
||||
<div class="mb-4 flex items-center justify-end">
|
||||
<!-- TODO这个版本不上 -->
|
||||
<!-- <a-button type="primary">
|
||||
|
@ -165,7 +176,8 @@
|
|||
}>();
|
||||
|
||||
const keyword = ref<string>('');
|
||||
|
||||
type ReportShowType = 'All' | 'TEST_PLAN' | 'GROUP';
|
||||
const showType = ref<ReportShowType>('All');
|
||||
const syncFrequencyOptions = [
|
||||
{ label: t('apiTestManagement.timeTaskHour'), value: '0 0 0/1 * * ?' },
|
||||
{ label: t('apiTestManagement.timeTaskSixHour'), value: '0 0 0/6 * * ?' },
|
||||
|
@ -209,6 +221,10 @@
|
|||
edit: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_API_SCENARIO:READ+EXECUTE'],
|
||||
jump: ['PROJECT_API_SCENARIO:READ'],
|
||||
},
|
||||
TEST_CASE: {
|
||||
edit: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
},
|
||||
},
|
||||
system: {
|
||||
API_IMPORT: {
|
||||
|
@ -218,6 +234,10 @@
|
|||
edit: ['SYSTEM_TASK_CENTER:READ+STOP', 'PROJECT_API_SCENARIO:READ+EXECUTE'],
|
||||
jump: ['PROJECT_API_SCENARIO:READ'],
|
||||
},
|
||||
TEST_CASE: {
|
||||
edit: ['SYSTEM_TASK_CENTER:READ+STOP', 'PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
},
|
||||
},
|
||||
project: {
|
||||
API_IMPORT: {
|
||||
|
@ -227,6 +247,10 @@
|
|||
edit: ['PROJECT_API_SCENARIO:READ+EXECUTE'],
|
||||
jump: ['PROJECT_API_SCENARIO:READ'],
|
||||
},
|
||||
TEST_CASE: {
|
||||
edit: ['PROJECT_TEST_PLAN:READ+EXECUTE'],
|
||||
jump: ['PROJECT_TEST_PLAN:READ'],
|
||||
},
|
||||
},
|
||||
};
|
||||
const hasOperationPermission = computed(() =>
|
||||
|
@ -324,14 +348,17 @@
|
|||
system: {
|
||||
API_IMPORT: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_SYSTEM,
|
||||
API_SCENARIO: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_SYSTEM,
|
||||
TEST_PLAN: TableKeyEnum.TASK_SCHEDULE_TASK_TEST_PLAN_SYSTEM,
|
||||
},
|
||||
organization: {
|
||||
API_IMPORT: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_ORGANIZATION,
|
||||
API_SCENARIO: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_ORGANIZATION,
|
||||
TEST_PLAN: TableKeyEnum.TASK_SCHEDULE_TASK_TEST_PLAN_ORGANIZATION,
|
||||
},
|
||||
project: {
|
||||
API_IMPORT: TableKeyEnum.TASK_SCHEDULE_TASK_API_IMPORT_PROJECT,
|
||||
API_SCENARIO: TableKeyEnum.TASK_SCHEDULE_TASK_API_SCENARIO_PROJECT,
|
||||
TEST_PLAN: TableKeyEnum.TASK_SCHEDULE_TASK_TEST_PLAN_PROJECT,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -351,6 +378,12 @@
|
|||
...resourceColumns,
|
||||
...staticColumns,
|
||||
],
|
||||
TEST_PLAN: [
|
||||
getOrgColumns(),
|
||||
getProjectColumns(tableKeyMap[props.group][props.moduleType]),
|
||||
...resourceColumns,
|
||||
...staticColumns,
|
||||
],
|
||||
},
|
||||
organization: {
|
||||
API_IMPORT: [
|
||||
|
@ -364,61 +397,98 @@
|
|||
...resourceColumns,
|
||||
...staticColumns,
|
||||
],
|
||||
TEST_PLAN: [getProjectColumns(tableKeyMap[props.group][props.moduleType]), ...resourceColumns, ...staticColumns],
|
||||
},
|
||||
project: {
|
||||
API_IMPORT: [...resourceColumns, ...swaggerUrlColumn, ...staticColumns],
|
||||
API_SCENARIO: [...resourceColumns, ...staticColumns],
|
||||
TEST_PLAN: [...resourceColumns, ...staticColumns],
|
||||
},
|
||||
};
|
||||
const orgApiCaseFilter = ref([]);
|
||||
const orgApiScenarioFilter = ref([]);
|
||||
const orgTestPlanFilter = ref([]);
|
||||
|
||||
const orgFiltersMap = ref<Record<string, string[]>>({
|
||||
API_IMPORT: orgApiCaseFilter.value,
|
||||
API_SCENARIO: orgApiScenarioFilter.value,
|
||||
TEST_PLAN: orgTestPlanFilter.value,
|
||||
});
|
||||
|
||||
const projectApiCaseFilter = ref([]);
|
||||
const projectApiScenarioFilter = ref([]);
|
||||
const projectTestPlanFilter = ref([]);
|
||||
const projectFiltersMap = ref<Record<string, string[]>>({
|
||||
API_CASE: projectApiCaseFilter.value,
|
||||
API_SCENARIO: projectApiScenarioFilter.value,
|
||||
TEST_PLAN: projectTestPlanFilter.value,
|
||||
});
|
||||
const typeFilter = computed(() => {
|
||||
if (showType.value === 'All') {
|
||||
return [];
|
||||
}
|
||||
return [showType.value];
|
||||
});
|
||||
|
||||
const hasJumpPermission = computed(() => hasAnyPermission(permissionsMap[props.group][props.moduleType].jump));
|
||||
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, resetFilterParams } = useTable(
|
||||
loadRealMap.value[props.group].list,
|
||||
{
|
||||
tableKey: tableKeyMap[props.group][props.moduleType],
|
||||
scroll: {
|
||||
x: 1200,
|
||||
const { propsRes, propsEvent, loadList, setLoadListParams, setPagination, resetSelector, resetFilterParams } =
|
||||
useTable(
|
||||
loadRealMap.value[props.group].list,
|
||||
{
|
||||
tableKey: tableKeyMap[props.group][props.moduleType],
|
||||
scroll: {
|
||||
x: 1200,
|
||||
},
|
||||
showSetting: true,
|
||||
selectable: hasOperationPermission.value,
|
||||
heightUsed: 300,
|
||||
enableDrag: false,
|
||||
showSelectorAll: true,
|
||||
},
|
||||
showSetting: true,
|
||||
selectable: hasOperationPermission.value,
|
||||
heightUsed: 300,
|
||||
enableDrag: false,
|
||||
showSelectorAll: true,
|
||||
},
|
||||
// eslint-disable-next-line no-return-assign
|
||||
(item) => ({
|
||||
...item,
|
||||
nextTime: item.nextTime ? dayjs(item.nextTime).format('YYYY-MM-DD HH:mm:ss') : null,
|
||||
})
|
||||
);
|
||||
// eslint-disable-next-line no-return-assign
|
||||
(item) => ({
|
||||
...item,
|
||||
nextTime: item.nextTime ? dayjs(item.nextTime).format('YYYY-MM-DD HH:mm:ss') : null,
|
||||
})
|
||||
);
|
||||
|
||||
function initData() {
|
||||
const filterParams = {
|
||||
...propsRes.value.filter,
|
||||
};
|
||||
|
||||
setLoadListParams({
|
||||
keyword: keyword.value,
|
||||
scheduleTagType: props.moduleType,
|
||||
filter: {
|
||||
...(props.moduleType === 'TEST_PLAN'
|
||||
? {
|
||||
type: typeFilter.value,
|
||||
...filterParams,
|
||||
}
|
||||
: { ...filterParams }),
|
||||
},
|
||||
});
|
||||
loadList();
|
||||
}
|
||||
|
||||
function changeShowType(val: string | number | boolean) {
|
||||
showType.value = val as ReportShowType;
|
||||
resetFilterParams();
|
||||
resetSelector();
|
||||
// 重置分页
|
||||
setPagination({
|
||||
current: 1,
|
||||
});
|
||||
initData();
|
||||
}
|
||||
|
||||
function searchList() {
|
||||
resetSelector();
|
||||
initData();
|
||||
}
|
||||
|
||||
const tableBatchActions = {
|
||||
baseAction: [
|
||||
{
|
||||
|
@ -530,6 +600,7 @@
|
|||
onBeforeOk: async () => {
|
||||
try {
|
||||
const { selectIds, selectAll, excludeIds } = batchParams.value;
|
||||
|
||||
await loadRealMap.value[props.group].batchEnable({
|
||||
selectIds: selectIds || [],
|
||||
selectAll: !!selectAll,
|
||||
|
@ -537,7 +608,14 @@
|
|||
excludeIds,
|
||||
condition: {
|
||||
keyword: keyword.value,
|
||||
filter: propsRes.value.filter,
|
||||
filter: {
|
||||
...(props.moduleType === 'TEST_PLAN'
|
||||
? {
|
||||
type: typeFilter.value,
|
||||
...propsRes.value.filter,
|
||||
}
|
||||
: { ...propsRes.value.filter }),
|
||||
},
|
||||
},
|
||||
});
|
||||
resetSelector();
|
||||
|
@ -573,8 +651,9 @@
|
|||
condition: {
|
||||
keyword: keyword.value,
|
||||
filter: {
|
||||
organizationIds: orgFiltersMap.value[props.moduleType],
|
||||
projectIds: projectFiltersMap.value[props.moduleType],
|
||||
...(props.moduleType === 'TEST_PLAN'
|
||||
? { type: typeFilter.value, ...propsRes.value.filter }
|
||||
: { ...propsRes.value.filter }),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -598,6 +677,7 @@
|
|||
batchDisableTask();
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
initData();
|
||||
});
|
||||
|
@ -635,12 +715,15 @@
|
|||
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
|
||||
&:not(:hover) {
|
||||
border-color: transparent !important;
|
||||
|
||||
.arco-input::placeholder {
|
||||
@apply invisible;
|
||||
}
|
||||
|
||||
.arco-select-view-icon {
|
||||
@apply invisible;
|
||||
}
|
||||
|
||||
.arco-select-view-value {
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
|
|
@ -75,6 +75,10 @@
|
|||
value: TaskCenterEnum.API_IMPORT,
|
||||
label: t('project.taskCenter.apiImport'),
|
||||
},
|
||||
{
|
||||
value: TaskCenterEnum.TEST_PLAN,
|
||||
label: t('project.taskCenter.testPlan'),
|
||||
}
|
||||
]);
|
||||
|
||||
const activeTask = ref(route.query.tab || 'real');
|
||||
|
|
|
@ -59,4 +59,6 @@ export default {
|
|||
'project.taskCenter.filterPlaceholderText': 'Please select a project',
|
||||
'project.taskCenter.filterOrgPlaceholderText': 'Please select an organization',
|
||||
'project.executionHistory.cleared': 'Execution result has been cleared',
|
||||
'project.taskCenter.plan': 'Plan',
|
||||
'project.taskCenter.planGroup': 'Plan group',
|
||||
};
|
||||
|
|
|
@ -57,4 +57,6 @@ export default {
|
|||
'project.taskCenter.filterProPlaceholderText': '请选择所属项目',
|
||||
'project.taskCenter.filterOrgPlaceholderText': '请选择所属组织',
|
||||
'project.executionHistory.cleared': '执行结果被清理',
|
||||
'project.taskCenter.plan': '计划',
|
||||
'project.taskCenter.planGroup': '计划组',
|
||||
};
|
||||
|
|
|
@ -188,7 +188,7 @@
|
|||
|
||||
const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest', 'testPlan'];
|
||||
|
||||
const showPoolModuleIds = ['apiTest'];
|
||||
const showPoolModuleIds = ['apiTest', 'testPlan'];
|
||||
|
||||
const form = reactive<CreateOrUpdateSystemProjectParams>({
|
||||
name: '',
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
|
||||
const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest', 'testPlan'];
|
||||
|
||||
const showPoolModuleIds = ['apiTest'];
|
||||
const showPoolModuleIds = ['apiTest', 'testPlan'];
|
||||
|
||||
const form = reactive<CreateOrUpdateSystemProjectParams>({
|
||||
name: '',
|
||||
|
|
Loading…
Reference in New Issue