Skip to content

Commit

Permalink
[FEATURE] add kanban in linkisweb (#5089)
Browse files Browse the repository at this point in the history
* Add new features to the Kanban view

* Add new features to the Kanban view

* Add query parameters to the interface

* Add code to the front-end section of the Kanban view

* 1. 增加筛选项目
2. 拆分mysql/pgsql

* 1. 修复resultMap重复的bug
2. 去除无用字段

* 1. 优化mapper sql

* 1. 调整显示格式

* 1. formatted code

* 1. fix error name

* 1. formatted code

* fotmatted code

* matted code
  • Loading branch information
sjgllgh authored Mar 13, 2024
1 parent 8b06144 commit c8f9537
Show file tree
Hide file tree
Showing 23 changed files with 2,410 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,26 @@ List<JobHistory> selectFailoverJobHistory(
@Param("statusList") List<String> statusList,
@Param("startTimestamp") Long startTimestamp,
@Param("limit") Integer limit);

List<JobHistory> taskDurationTopN(
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("umUser") String username,
@Param("engineType") String engineType);

List<JobHistory> taskDurationTopNWithUserCreator(
@Param("umUser") String username,
@Param("userCreatorKey") String userCreatorKey,
@Param("userCreatorValue") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);

List<JobHistory> taskDurationTopNWithCreatorOnly(
@Param("umUser") String username,
@Param("userCreatorKey") String userCreatorKey,
@Param("creator") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.
*/

package org.apache.linkis.jobhistory.dao;

import org.apache.linkis.jobhistory.entity.JobStatistics;

import org.apache.ibatis.annotations.Param;

import java.util.Date;

public interface JobStatisticsMapper {

JobStatistics taskExecutionStatistics(
@Param("umUser") String username,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);

JobStatistics taskExecutionStatisticsWithUserCreator(
@Param("umUser") String username,
@Param("userCreatorKey") String userCreatorKey,
@Param("userCreatorValue") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);

JobStatistics taskExecutionStatisticsWithCreatorOnly(
@Param("umUser") String username,
@Param("userCreatorKey") String userCreatorKey,
@Param("creator") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);

JobStatistics engineExecutionStatisticsWithUserCreator(
@Param("umUser") String username,
@Param("userCreatorValue") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);

JobStatistics engineExecutionStatistics(
@Param("umUser") String username,
@Param("creator") String userCreator,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("engineType") String engineType);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* 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.
*/

package org.apache.linkis.jobhistory.entity;

public class JobStatistics {

private Long id;

private Integer sumCount;

private Integer succeedCount;

private Integer failedCount;

private Integer cancelledCount;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Integer getSumCount() {
return sumCount;
}

public void setSumCount(Integer sumCount) {
this.sumCount = sumCount;
}

public Integer getSucceedCount() {
return succeedCount;
}

public void setSucceedCount(Integer succeedCount) {
this.succeedCount = succeedCount;
}

public Integer getFailedCount() {
return failedCount;
}

public void setFailedCount(Integer failedCount) {
this.failedCount = failedCount;
}

public Integer getCancelledCount() {
return cancelledCount;
}

public void setCancelledCount(Integer cancelledCount) {
this.cancelledCount = cancelledCount;
}

@Override
public String toString() {
return "JobHistory{" + "id=" + id + '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,93 @@ public Message listundone(

return Message.ok().data(JobRequestConstants.TOTAL_PAGE(), total);
}

/** Method list should not contain subjob, which may cause performance problems. */
@ApiOperation(value = "listDurationTop", notes = "listDurationTop", response = Message.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "startDate", dataType = "long", example = "1658937600001"),
@ApiImplicitParam(name = "endDate", dataType = "long", example = "1658937600000"),
@ApiImplicitParam(name = "executeApplicationName", dataType = "String"),
@ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator"),
@ApiImplicitParam(
name = "proxyUser",
required = false,
dataType = "String",
value = "proxyUser"),
@ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"),
@ApiImplicitParam(name = "pageSize", dataType = "Integer"),
})
@RequestMapping(path = "/listDurationTop", method = RequestMethod.GET)
public Message listDurationTop(
HttpServletRequest req,
@RequestParam(value = "startDate", required = false) Long startDate,
@RequestParam(value = "endDate", required = false) Long endDate,
@RequestParam(value = "executeApplicationName", required = false)
String executeApplicationName,
@RequestParam(value = "creator", required = false) String creator,
@RequestParam(value = "proxyUser", required = false) String proxyUser,
@RequestParam(value = "pageNow", required = false) Integer pageNow,
@RequestParam(value = "pageSize", required = false) Integer pageSize)
throws QueryException {
if (StringUtils.isEmpty(pageNow)) {
pageNow = 1;
}
if (StringUtils.isEmpty(pageSize)) {
pageSize = 20;
}
if (StringUtils.isEmpty(proxyUser)) {
proxyUser = null;
} else {
if (!QueryUtils.checkNameValid(proxyUser)) {
return Message.error("Invalid proxyUser : " + proxyUser);
}
}
if (StringUtils.isEmpty(creator)) {
creator = null;
} else {
if (!QueryUtils.checkNameValid(creator)) {
return Message.error("Invalid creator : " + creator);
}
}
if (!StringUtils.isEmpty(executeApplicationName)) {
if (!QueryUtils.checkNameValid(executeApplicationName)) {
return Message.error("Invalid applicationName : " + executeApplicationName);
}
} else {
executeApplicationName = null;
}

if (endDate == null) {
endDate = System.currentTimeMillis();
}
if (startDate == null) {
startDate = 0L;
}

Date sDate = new Date(startDate);
Date eDate = new Date(endDate);
if (sDate.getTime() == eDate.getTime()) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(endDate);
calendar.add(Calendar.DAY_OF_MONTH, 1);
eDate = new Date(calendar.getTime().getTime()); // todo check
}
List<JobHistory> queryTasks = null;
PageHelper.startPage(pageNow, pageSize);
try {
queryTasks =
jobHistoryQueryService.taskDurationTopN(
sDate, eDate, proxyUser, creator, executeApplicationName);
} finally {
PageHelper.clearPage();
}

List<QueryTaskVO> vos = new ArrayList<>();
for (JobHistory jobHistory : queryTasks) {
QueryUtils.exchangeExecutionCode(jobHistory);
QueryTaskVO taskVO = TaskConversions.jobHistory2TaskVO(jobHistory, null);
vos.add(taskVO);
}
return Message.ok().data(TaskConstant.TASKS, vos);
}
}
Loading

0 comments on commit c8f9537

Please sign in to comment.