feat(web): 增加调度时间点展示

This commit is contained in:
2024-01-15 15:45:17 +08:00
parent 26e65f2a81
commit 2b829519d1
6 changed files with 242 additions and 168 deletions

View File

@@ -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);

View File

@@ -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 + '\'' +
'}';
}
}

View File

@@ -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\')}'
}
}
]
}
]
}