feat(web): 增加调度时间点展示
This commit is contained in:
@@ -15,6 +15,8 @@ import com.lanyuanxiaoyao.service.web.controller.base.AmisMapResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
||||
import com.lanyuanxiaoyao.service.web.entity.JobIdAndAliasVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.ScheduleTimeVO;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -149,6 +151,21 @@ public class OverviewController extends BaseController {
|
||||
return AmisResponse.responseCrudData(scheduleService.scheduleJobs());
|
||||
}
|
||||
|
||||
@GetMapping("schedule_times")
|
||||
public AmisCrudResponse scheduleTimes() {
|
||||
long now = Instant.now().toEpochMilli();
|
||||
return AmisCrudResponse.responseCrudData(
|
||||
scheduleService.scheduleJobTimes()
|
||||
.collect(time -> {
|
||||
if (time < now) {
|
||||
return new ScheduleTimeVO("inactive", time);
|
||||
} else {
|
||||
return new ScheduleTimeVO("active", time);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("sync_running_status")
|
||||
public AmisMapResponse syncRunningStatus() {
|
||||
ImmutableList<String> locks = zookeeperService.getChildren(NameHelper.ZK_SYNC_RUNNING_LOCK_PATH).collect(ZookeeperNode::getPath);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @date 2024-01-15
|
||||
*/
|
||||
public class ScheduleTimeVO {
|
||||
private final String color;
|
||||
private final Long time;
|
||||
|
||||
public ScheduleTimeVO(String color, Long time) {
|
||||
this.color = color;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScheduleTimeVO{" +
|
||||
"color='" + color + '\'' +
|
||||
", time='" + time + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -409,6 +409,26 @@ function overviewTab() {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{type: 'divider'},
|
||||
{
|
||||
type: 'service',
|
||||
api: '${base}/overview/schedule_times',
|
||||
interval: 60000,
|
||||
silentPolling: true,
|
||||
body: [
|
||||
'调度时间点',
|
||||
{
|
||||
type: 'each',
|
||||
name: 'items',
|
||||
className: 'grid',
|
||||
items: {
|
||||
type: 'tag',
|
||||
color: '${color}',
|
||||
label: '${DATETOSTR(TIMESTAMP(time, \'x\'), \'HH:mm:ss\')}'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user