diff --git a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/QueueController.java b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/QueueController.java new file mode 100644 index 0000000..0b34da1 --- /dev/null +++ b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/QueueController.java @@ -0,0 +1,37 @@ +package com.lanyuanxiaoyao.service.web.controller; + +import com.eshore.odcp.hudi.connector.entity.compaction.ScheduleJob; +import com.lanyuanxiaoyao.micro.service.entity.queue.QueueItem; +import com.lanyuanxiaoyao.service.configuration.entity.AmisResponse; +import com.lanyuanxiaoyao.service.forest.service.QueueService; +import java.util.Comparator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * 队列接口 + * + * @author lanyuanxiaoyao + * @date 2023-05-07 + */ +@RestController +@RequestMapping("queue") +public class QueueController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(QueueController.class); + + private final QueueService queueService; + + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + public QueueController(QueueService queueService) { + this.queueService = queueService; + } + + @GetMapping("all") + public AmisResponse all(@RequestParam("name") String name) { + return responseCrudData(queueService.all(name).toSortedList(QueueItem::compareTo)); + } +} diff --git a/service-web/src/main/resources/static/components/queue-tab.js b/service-web/src/main/resources/static/components/queue-tab.js new file mode 100644 index 0000000..b3b60e0 --- /dev/null +++ b/service-web/src/main/resources/static/components/queue-tab.js @@ -0,0 +1,38 @@ +function queueCrud(name) { + return { + type: 'crud', + title: name, + api: `\${base}/queue/all?name=${name}`, + interval: 10000, + syncLocation: false, + silentPolling: true, + headerToolbar: ['reload'], + loadDataOnce: true, + affixHeader: false, + perPage: 100, + columns: [ + {name: 'id', label: 'ID'}, + { + name: 'priority', + label: '优先级', + align: 'center', + }, + { + name: 'createTime', + label: '启动时间', + ...time('createTime'), + align: 'center', + width: 140, + }, + ] + } +} + +function queueTab() { + return { + title: '压缩队列', + tab: [ + queueCrud('compaction-queue') + ], + } +} \ No newline at end of file diff --git a/service-web/src/main/resources/static/index.html b/service-web/src/main/resources/static/index.html index 85edb00..4e15f67 100644 --- a/service-web/src/main/resources/static/index.html +++ b/service-web/src/main/resources/static/index.html @@ -38,6 +38,7 @@ +