feature(web): 增加一个直接通过 zookeeper 查询运行时信息的页面

This commit is contained in:
2023-05-23 15:54:11 +08:00
parent 5e191a176d
commit f29cccf9dd
8 changed files with 336 additions and 6 deletions

View File

@@ -1,9 +1,9 @@
function timeAndFrom(field, fromNow, emptyText) {
if (!emptyText) {
emptyText = '未停止'
function timeAndFrom(field, fromNow, emptyText = '未停止', showSource = true) {
let tpl = "<span class='font-bold'>${" + fromNow + "}</span>"
if (showSource) {
tpl = tpl + "<br> ${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE('(',DATETOSTR(DATE(" + field + ")),')'))}"
}
// language=TEXT
return "<span class='font-bold'>${" + fromNow + "}</span><br> ${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE('(',DATETOSTR(DATE(" + field + ")),')'))}"
return tpl
}
function yarnCrudColumns() {

View File

@@ -0,0 +1,57 @@
function runningTable(name) {
return {
type: 'table',
title: `${name}`,
itemAction: {
type: 'button',
actionType: 'dialog',
dialog: {
title: 'Path',
body: '${path}',
actions: [],
}
},
columns: [
{name: 'label', label: '名称'},
{
name: 'createTime',
label: '创建时间',
type: 'tpl',
tpl: timeAndFrom('createTime', 'createTimeFromNow', undefined, false),
align: 'center',
width: 70,
},
]
}
}
function runningTab() {
return {
title: '运行中',
tab: [
{
type: 'grid',
columns: [
{
body: [
{
type: 'service',
api: '${base}/running/sync',
body: runningTable('同步')
}
]
},
{
body: [
{
type: 'service',
api: '${base}/running/compaction',
body: runningTable('压缩')
}
]
}
]
}
],
}
}

View File

@@ -39,6 +39,7 @@
<script src="components/yarn-tab.js"></script>
<script src="components/cloud-tab.js"></script>
<script src="components/queue-tab.js"></script>
<script src="components/running-tab.js"></script>
<script type="text/javascript">
(function () {
let amis = amisRequire('amis/embed')
@@ -52,6 +53,7 @@
unmountOnExit: true,
tabsMode: 'strong',
tabs: [
// runningTab(),
tableTab(),
queueTab(),
yarnTab('b5-sync', '同步 b5', undefined, 'Sync'),