[Improvement-3767][api] Task instance supports query by process instance name (#3825)
* Task instance supports query by process instance name. * add test code checkstyle. * add test param. * resolve the sonar duplication check. * solve logger single-line string exceeds 200 characters. * resolve the sonar check. * Resolve code conflicts. Co-authored-by: zhuangchong <zhuangchong8@163.com>dailidong-patch-2
parent
fe3026627f
commit
1eecbb1ef7
|
|
@ -14,8 +14,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.controller;
|
||||
|
||||
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TASK_LIST_PAGING_ERROR;
|
||||
|
||||
import org.apache.dolphinscheduler.api.exceptions.ApiException;
|
||||
import org.apache.dolphinscheduler.api.service.TaskInstanceService;
|
||||
|
|
@ -23,19 +25,30 @@ import org.apache.dolphinscheduler.api.utils.Result;
|
|||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
|
||||
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
|
||||
import org.apache.dolphinscheduler.common.utils.StringUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TASK_LIST_PAGING_ERROR;
|
||||
|
||||
/**
|
||||
* task instance controller
|
||||
*/
|
||||
|
|
@ -69,6 +82,7 @@ public class TaskInstanceController extends BaseController {
|
|||
@ApiOperation(value = "queryTaskListPaging", notes = "QUERY_TASK_INSTANCE_LIST_PAGING_NOTES")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = false, dataType = "Int", example = "100"),
|
||||
@ApiImplicitParam(name = "processInstanceName", value = "PROCESS_INSTANCE_NAME", required = false, type = "String"),
|
||||
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"),
|
||||
@ApiImplicitParam(name = "taskName", value = "TASK_NAME", type = "String"),
|
||||
@ApiImplicitParam(name = "executorName", value = "EXECUTOR_NAME", type = "String"),
|
||||
|
|
@ -85,6 +99,7 @@ public class TaskInstanceController extends BaseController {
|
|||
public Result queryTaskListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
|
||||
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
|
||||
@RequestParam(value = "processInstanceId", required = false, defaultValue = "0") Integer processInstanceId,
|
||||
@RequestParam(value = "processInstanceName", required = false) String processInstanceName,
|
||||
@RequestParam(value = "searchVal", required = false) String searchVal,
|
||||
@RequestParam(value = "taskName", required = false) String taskName,
|
||||
@RequestParam(value = "executorName", required = false) String executorName,
|
||||
|
|
@ -95,11 +110,20 @@ public class TaskInstanceController extends BaseController {
|
|||
@RequestParam("pageNo") Integer pageNo,
|
||||
@RequestParam("pageSize") Integer pageSize) {
|
||||
|
||||
logger.info("query task instance list, project name:{},process instance:{}, search value:{},task name:{}, executor name: {},state type:{}, host:{}, start:{}, end:{}",
|
||||
projectName, processInstanceId, searchVal, taskName, executorName, stateType, host, startTime, endTime);
|
||||
logger.info("query task instance list, projectName:{}, processInstanceId:{}, processInstanceName:{}, search value:{}, taskName:{}, executorName: {}, stateType:{}, host:{}, start:{}, end:{}",
|
||||
StringUtils.replaceNRTtoUnderline(projectName),
|
||||
processInstanceId,
|
||||
StringUtils.replaceNRTtoUnderline(processInstanceName),
|
||||
StringUtils.replaceNRTtoUnderline(searchVal),
|
||||
StringUtils.replaceNRTtoUnderline(taskName),
|
||||
StringUtils.replaceNRTtoUnderline(executorName),
|
||||
stateType,
|
||||
StringUtils.replaceNRTtoUnderline(host),
|
||||
StringUtils.replaceNRTtoUnderline(startTime),
|
||||
StringUtils.replaceNRTtoUnderline(endTime));
|
||||
searchVal = ParameterUtils.handleEscapes(searchVal);
|
||||
Map<String, Object> result = taskInstanceService.queryTaskListPaging(
|
||||
loginUser, projectName, processInstanceId, taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize);
|
||||
loginUser, projectName, processInstanceId, processInstanceName, taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize);
|
||||
return returnDataListPaging(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
|
|
@ -69,7 +69,6 @@ public class TaskInstanceService extends BaseService {
|
|||
@Autowired
|
||||
UsersService usersService;
|
||||
|
||||
|
||||
/**
|
||||
* query task list by project, process instance, task name, task start time, task end time, task status, keyword paging
|
||||
*
|
||||
|
|
@ -87,7 +86,7 @@ public class TaskInstanceService extends BaseService {
|
|||
* @return task list page
|
||||
*/
|
||||
public Map<String, Object> queryTaskListPaging(User loginUser, String projectName,
|
||||
Integer processInstanceId, String taskName, String executorName, String startDate,
|
||||
Integer processInstanceId, String processInstanceName, String taskName, String executorName, String startDate,
|
||||
String endDate, String searchVal, ExecutionStatus stateType, String host,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
|
@ -124,7 +123,7 @@ public class TaskInstanceService extends BaseService {
|
|||
int executorId = usersService.getUserIdByName(executorName);
|
||||
|
||||
IPage<TaskInstance> taskInstanceIPage = taskInstanceMapper.queryTaskInstanceListPaging(
|
||||
page, project.getId(), processInstanceId, searchVal, taskName, executorId, statusArray, host, start, end
|
||||
page, project.getId(), processInstanceId, processInstanceName, searchVal, taskName, executorId, statusArray, host, start, end
|
||||
);
|
||||
Set<String> exclusionSet = new HashSet<>();
|
||||
exclusionSet.add(Constants.CLASS);
|
||||
|
|
|
|||
|
|
@ -14,52 +14,60 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.controller;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.service.TaskInstanceService;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
import org.apache.dolphinscheduler.api.utils.Result;
|
||||
import org.apache.dolphinscheduler.common.utils.*;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
|
||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
* task instance controller test
|
||||
*/
|
||||
public class TaskInstanceControllerTest extends AbstractControllerTest{
|
||||
private static Logger logger = LoggerFactory.getLogger(TaskInstanceControllerTest.class);
|
||||
@RunWith(MockitoJUnitRunner.Silent.class)
|
||||
public class TaskInstanceControllerTest {
|
||||
|
||||
@InjectMocks
|
||||
private TaskInstanceController taskInstanceController;
|
||||
|
||||
@Mock
|
||||
private TaskInstanceService taskInstanceService;
|
||||
|
||||
@Test
|
||||
public void testQueryTaskListPaging() throws Exception {
|
||||
public void testQueryTaskListPaging() {
|
||||
|
||||
MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
|
||||
//paramsMap.add("processInstanceId","1380");
|
||||
paramsMap.add("searchVal","");
|
||||
paramsMap.add("taskName","");
|
||||
//paramsMap.add("stateType","");
|
||||
paramsMap.add("startDate","2019-02-26 19:48:00");
|
||||
paramsMap.add("endDate","2019-02-26 19:48:22");
|
||||
paramsMap.add("pageNo","1");
|
||||
paramsMap.add("pageSize","20");
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
Integer pageNo = 1;
|
||||
Integer pageSize = 20;
|
||||
PageInfo pageInfo = new PageInfo<TaskInstance>(pageNo, pageSize);
|
||||
result.put(Constants.DATA_LIST, pageInfo);
|
||||
result.put(Constants.STATUS, Status.SUCCESS);
|
||||
|
||||
MvcResult mvcResult = mockMvc.perform(get("/projects/{projectName}/task-instance/list-paging","cxc_1113")
|
||||
.header(SESSION_ID, sessionId)
|
||||
.params(paramsMap))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||
.andReturn();
|
||||
when(taskInstanceService.queryTaskListPaging(any(), eq(""), eq(1), eq(""), eq(""), eq(""),any(), any(),
|
||||
eq(""), Mockito.any(), eq("192.168.xx.xx"), any(), any())).thenReturn(result);
|
||||
Result taskResult = taskInstanceController.queryTaskListPaging(null, "", 1, "", "",
|
||||
"", "", ExecutionStatus.SUCCESS,"192.168.xx.xx", "2020-01-01 00:00:00", "2020-01-02 00:00:00",pageNo, pageSize);
|
||||
Assert.assertEquals(Integer.valueOf(Status.SUCCESS.getCode()), taskResult.getCode());
|
||||
|
||||
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class);
|
||||
Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue());
|
||||
logger.info(mvcResult.getResponse().getContentAsString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
|
|
@ -88,7 +89,7 @@ public class TaskInstanceServiceTest {
|
|||
//project auth fail
|
||||
when(projectMapper.queryByName(projectName)).thenReturn(null);
|
||||
when(projectService.checkProjectAndAuth(loginUser, null, projectName)).thenReturn(result);
|
||||
Map<String, Object> proejctAuthFailRes = taskInstanceService.queryTaskListPaging(loginUser, "project_test1", 0, "",
|
||||
Map<String, Object> proejctAuthFailRes = taskInstanceService.queryTaskListPaging(loginUser, "project_test1", 0, "", "",
|
||||
"test_user", "2019-02-26 19:48:00", "2019-02-26 19:48:22", "", null, "", 1, 20);
|
||||
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS));
|
||||
|
||||
|
|
@ -107,43 +108,43 @@ public class TaskInstanceServiceTest {
|
|||
when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
|
||||
when(usersService.queryUser(loginUser.getId())).thenReturn(loginUser);
|
||||
when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(loginUser.getId());
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""),
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""), eq(""),
|
||||
eq(0), Mockito.any(), eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn);
|
||||
when(usersService.queryUser(processInstance.getExecutorId())).thenReturn(loginUser);
|
||||
when(processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId())).thenReturn(processInstance);
|
||||
|
||||
Map<String, Object> successRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> successRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"test_user", "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
|
||||
|
||||
//executor name empty
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""),
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""), eq(""),
|
||||
eq(0), Mockito.any(), eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn);
|
||||
Map<String, Object> executorEmptyRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> executorEmptyRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"", "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.SUCCESS, executorEmptyRes.get(Constants.STATUS));
|
||||
|
||||
//executor null
|
||||
when(usersService.queryUser(loginUser.getId())).thenReturn(null);
|
||||
when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(-1);
|
||||
Map<String, Object> executorNullRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> executorNullRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"test_user", "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.SUCCESS, executorNullRes.get(Constants.STATUS));
|
||||
|
||||
//start/end date null
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""),
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""), eq(""),
|
||||
eq(0), Mockito.any(), eq("192.168.xx.xx"), any(), any())).thenReturn(pageReturn);
|
||||
Map<String, Object> executorNullDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> executorNullDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"", null, null, "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.SUCCESS, executorNullDateRes.get(Constants.STATUS));
|
||||
|
||||
//start date error format
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""),
|
||||
when(taskInstanceMapper.queryTaskInstanceListPaging(Mockito.any(Page.class), eq(project.getId()), eq(1), eq(""), eq(""), eq(""),
|
||||
eq(0), Mockito.any(), eq("192.168.xx.xx"), any(), any())).thenReturn(pageReturn);
|
||||
Map<String, Object> executorErrorStartDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> executorErrorStartDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"", "error date", null, "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, executorErrorStartDateRes.get(Constants.STATUS));
|
||||
Map<String, Object> executorErrorEndDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "",
|
||||
Map<String, Object> executorErrorEndDateRes = taskInstanceService.queryTaskListPaging(loginUser, projectName, 1, "", "",
|
||||
"", null, "error date", "", ExecutionStatus.SUCCESS, "192.168.xx.xx", 1, 20);
|
||||
Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, executorErrorEndDateRes.get(Constants.STATUS));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,25 +14,27 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
|
||||
import org.apache.dolphinscheduler.common.enums.Flag;
|
||||
import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount;
|
||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
/**
|
||||
* task instance mapper interface
|
||||
*/
|
||||
public interface TaskInstanceMapper extends BaseMapper<TaskInstance> {
|
||||
|
||||
|
||||
List<Integer> queryTaskByProcessIdAndState(@Param("processInstanceId") Integer processInstanceId,
|
||||
@Param("state") Integer state);
|
||||
|
||||
|
|
@ -61,6 +63,7 @@ public interface TaskInstanceMapper extends BaseMapper<TaskInstance> {
|
|||
IPage<TaskInstance> queryTaskInstanceListPaging(IPage<TaskInstance> page,
|
||||
@Param("projectId") int projectId,
|
||||
@Param("processInstanceId") Integer processInstanceId,
|
||||
@Param("processInstanceName") String processInstanceName,
|
||||
@Param("searchVal") String searchVal,
|
||||
@Param("taskName") String taskName,
|
||||
@Param("executorId") int executorId,
|
||||
|
|
|
|||
|
|
@ -128,6 +128,9 @@
|
|||
<if test="executorId != 0">
|
||||
and instance.executor_id = #{executorId}
|
||||
</if>
|
||||
<if test="processInstanceName != null and processInstanceName != ''">
|
||||
and process.name like concat('%', #{processInstanceName}, '%')
|
||||
</if>
|
||||
order by instance.start_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ public class TaskInstanceMapperTest {
|
|||
task.getProcessInstanceId(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
new int[0],
|
||||
"",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'projects-conditions-index'
|
||||
}
|
||||
</script>
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
import { stateType } from './common'
|
||||
import mConditions from '@/module/components/conditions/conditions'
|
||||
export default {
|
||||
name: 'instance-conditions',
|
||||
name: 'process-instance-conditions',
|
||||
data () {
|
||||
return {
|
||||
// state(list)
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
<template>
|
||||
<m-conditions>
|
||||
<template slot="search-group">
|
||||
<div class="list">
|
||||
<x-button type="ghost" size="small" @click="_ckQuery" icon="ans-icon-search"></x-button>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-datepicker
|
||||
ref="datepicker"
|
||||
@on-change="_onChangeStartStop"
|
||||
type="daterange"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
placement="bottom-end"
|
||||
:value="[searchParams.startDate,searchParams.endDate]"
|
||||
:panelNum="2">
|
||||
<x-input slot="input" readonly slot-scope="{value}" :value="value" style="width: 310px;" size="small" :placeholder="$t('Select date range')">
|
||||
<em slot="suffix"
|
||||
@click.stop="_dateEmpty()"
|
||||
class="ans-icon-fail-solid"
|
||||
v-show="value"
|
||||
style="font-size: 13px;cursor: pointer;margin-top: 1px;">
|
||||
</em>
|
||||
</x-input>
|
||||
</x-datepicker>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-select style="width: 140px;" @on-change="_onChangeState" :value="searchParams.stateType" >
|
||||
<x-input slot="trigger" readonly :value="selectedModel ? selectedModel.label : ''" slot-scope="{ selectedModel }" style="width: 140px;" size="small" :placeholder="$t('State')" suffix-icon="ans-icon-arrow-down">
|
||||
</x-input>
|
||||
<x-option
|
||||
v-for="city in stateTypeList"
|
||||
:key="city.label"
|
||||
:value="city.code"
|
||||
:label="city.label">
|
||||
</x-option>
|
||||
</x-select>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-input v-model.trim="searchParams.host" @on-enterkey="_ckQuery" style="width: 140px;" size="small" :placeholder="$t('host')"></x-input>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-input v-model.trim="searchParams.executorName" @on-enterkey="_ckQuery" style="width: 140px;" size="small" :placeholder="$t('Executor')"></x-input>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-input v-model.trim="searchParams.processInstanceName" @on-enterkey="_ckQuery" style="width: 160px;" size="small" :placeholder="$t('Process Instance')"></x-input>
|
||||
</div>
|
||||
<div class="list">
|
||||
<x-input v-model.trim="searchParams.searchVal" @on-enterkey="_ckQuery" style="width: 160px;" size="small" :placeholder="$t('name')"></x-input>
|
||||
</div>
|
||||
</template>
|
||||
</m-conditions>
|
||||
</template>
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import { stateType } from './common'
|
||||
import mConditions from '@/module/components/conditions/conditions'
|
||||
export default {
|
||||
name: 'task-instance-conditions',
|
||||
data () {
|
||||
return {
|
||||
// state(list)
|
||||
stateTypeList: stateType,
|
||||
searchParams: {
|
||||
// state
|
||||
stateType: '',
|
||||
// start date
|
||||
startDate: '',
|
||||
// end date
|
||||
endDate: '',
|
||||
// search value
|
||||
searchVal: '',
|
||||
// host
|
||||
host: '',
|
||||
// executor name
|
||||
executorName: '',
|
||||
processInstanceName: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {},
|
||||
methods: {
|
||||
_ckQuery () {
|
||||
this.$emit('on-query', this.searchParams)
|
||||
},
|
||||
/**
|
||||
* change times
|
||||
*/
|
||||
_onChangeStartStop (val) {
|
||||
this.searchParams.startDate = val[0]
|
||||
this.searchParams.endDate = val[1]
|
||||
},
|
||||
/**
|
||||
* change state
|
||||
*/
|
||||
_onChangeState (val) {
|
||||
this.searchParams.stateType = val.value
|
||||
},
|
||||
/**
|
||||
* empty date
|
||||
*/
|
||||
_dateEmpty () {
|
||||
this.searchParams.startDate = ''
|
||||
this.searchParams.endDate = ''
|
||||
this.$refs.datepicker.empty()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
created () {
|
||||
// Routing parameter merging
|
||||
if (!_.isEmpty(this.$route.query)) {
|
||||
this.searchParams = _.assign(this.searchParams, this.$route.query)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
components: { mConditions }
|
||||
}
|
||||
</script>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
import echarts from 'echarts'
|
||||
import store from '@/conf/home/store'
|
||||
import mNoData from '@/module/components/noData/noData'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/instanceConditions/common'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/conditions/instance/common'
|
||||
export default {
|
||||
name: 'process-state-count',
|
||||
data () {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
import echarts from 'echarts'
|
||||
import store from '@/conf/home/store'
|
||||
import mNoData from '@/module/components/noData/noData'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/instanceConditions/common'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/conditions/instance/common'
|
||||
|
||||
export default {
|
||||
name: 'task-ctatus-count',
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
import { pie } from './chartConfig'
|
||||
import Chart from '@/module/ana-charts'
|
||||
import mNoData from '@/module/components/noData/noData'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/instanceConditions/common'
|
||||
import { stateType } from '@/conf/home/pages/projects/pages/_source/conditions/instance/common'
|
||||
|
||||
export default {
|
||||
name: 'task-status-count',
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
import mNoData from '@/module/components/noData/noData'
|
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
|
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction'
|
||||
import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/instanceConditions'
|
||||
import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/conditions/instance/processInstance'
|
||||
|
||||
export default {
|
||||
name: 'instance-list-index',
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<template slot="conditions">
|
||||
<m-instance-conditions @on-query="_onQuery"></m-instance-conditions>
|
||||
</template>
|
||||
|
||||
<template slot="content">
|
||||
<template v-if="taskInstanceList.length">
|
||||
<m-list :task-instance-list="taskInstanceList" :page-no="searchParams.pageNo" :page-size="searchParams.pageSize">
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle'
|
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu'
|
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction'
|
||||
import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/instanceConditions'
|
||||
import mInstanceConditions from '@/conf/home/pages/projects/pages/_source/conditions/instance/taskInstance'
|
||||
|
||||
export default {
|
||||
name: 'task-instance-list-index',
|
||||
|
|
@ -72,7 +73,8 @@
|
|||
// end date
|
||||
endDate: '',
|
||||
// Exectuor Name
|
||||
executorName: ''
|
||||
executorName: '',
|
||||
processInstanceName: ''
|
||||
},
|
||||
isLeft: true
|
||||
}
|
||||
|
|
|
|||
1
pom.xml
1
pom.xml
|
|
@ -746,6 +746,7 @@
|
|||
<include>**/api/service/WorkerGroupServiceTest.java</include>
|
||||
<include>**/api/service/WorkFlowLineageServiceTest.java</include>
|
||||
<include>**/api/controller/ProcessDefinitionControllerTest.java</include>
|
||||
<include>**/api/controller/TaskInstanceControllerTest.java</include>
|
||||
<include>**/api/controller/WorkFlowLineageControllerTest.java</include>
|
||||
<include>**/api/utils/exportprocess/DataSourceParamTest.java</include>
|
||||
<include>**/api/utils/exportprocess/DependentParamTest.java</include>
|
||||
|
|
|
|||
Loading…
Reference in New Issue