From 8c1967bdf0e73e55dbf82128146f20241e085aba Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sun, 7 May 2023 23:52:24 +0800 Subject: [PATCH] =?UTF-8?q?feature(web):=20=E5=A2=9E=E5=8A=A0=E9=98=9F?= =?UTF-8?q?=E5=88=97=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/QueueController.java | 37 ++++++++++++++++++ .../resources/static/components/queue-tab.js | 38 +++++++++++++++++++ .../src/main/resources/static/index.html | 2 + 3 files changed, 77 insertions(+) create mode 100644 service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/QueueController.java create mode 100644 service-web/src/main/resources/static/components/queue-tab.js 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 @@ +