diff --git a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/OverviewController.java b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/OverviewController.java index 195f8a7..09b9609 100644 --- a/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/OverviewController.java +++ b/service-web/src/main/java/com/lanyuanxiaoyao/service/web/controller/OverviewController.java @@ -4,6 +4,7 @@ import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; import com.lanyuanxiaoyao.service.configuration.ExecutorProvider; import com.lanyuanxiaoyao.service.configuration.entity.AmisResponse; +import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue; import com.lanyuanxiaoyao.service.forest.service.InfoService; @@ -134,4 +135,21 @@ public class OverviewController extends BaseController { .withData("unReceive", Maps.immutable.of("normal", unReceiveNormalTableCount.get(), "focus", unReceiveFocusCount.get())) .withData("unSchedule", Maps.immutable.of("normal", unScheduledNormalTableCount.get(), "focus", unScheduledFocusTableCount.get())); } + + @GetMapping("version_detail") + public AmisResponse versionDetail(String target, String version) throws Exception { + ImmutableList jobIdAndAliases; + if (StrUtil.equals("unReceive_focus", target)) { + jobIdAndAliases = infoService.unReceiveVersionFocusTable(version); + } else if (StrUtil.equals("unScheduled_focus", target)) { + jobIdAndAliases = infoService.unScheduledFocusTable(version); + } else if (StrUtil.equals("unReceive_normal", target)) { + jobIdAndAliases = infoService.unReceiveVersionNormalTable(version); + } else if (StrUtil.equals("unScheduled_normal", target)) { + jobIdAndAliases = infoService.unScheduledNormalTable(version); + } else { + throw new Exception("Target not found " + target); + } + return responseCrudData(jobIdAndAliases); + } } diff --git a/web/components/overview-tab.js b/web/components/overview-tab.js index ed234af..d3447e9 100644 --- a/web/components/overview-tab.js +++ b/web/components/overview-tab.js @@ -9,6 +9,91 @@ function color(number) { return color } +function versionDetailDialog(variable, target) { + return { + disabledOn: `${variable} === 0`, + type: 'action', + label: '详情', + level: 'link', + size: 'sm', + actionType: 'dialog', + dialog: { + title: '详情', + actions: [], + size: 'md', + closeOnEsc: false, + closeOnOutside: false, + body: [ + { + type: 'service', + api: { + method: 'get', + url: '${base}/overview/version_detail', + data: { + target: `${target}`, + version: '${version}', + } + }, + body: [ + { + type: "table", + source: "${items}", + affixHeader: false, + columns: [ + { + label: 'Flink job id', + fixed: 'left', + type: 'wrapper', + size: 'none', + body: [ + { + type: 'tpl', + tpl: '${id}', + }, + { + type: 'action', + level: 'link', + label: '', + icon: 'fa fa-copy', + size: 'xs', + actionType: 'copy', + content: '${id}', + tooltip: '复制 ID', + } + ], + }, + { + label: '别名', + type: 'wrapper', + fixed: 'left', + size: 'none', + className: 'nowrap', + body: [ + { + type: 'tpl', + tpl: '${alias}', + }, + { + type: 'action', + level: 'link', + label: '', + icon: 'fa fa-copy', + size: 'xs', + actionType: 'copy', + content: '${alias}', + tooltip: '复制别名', + }, + ], + }, + ] + } + ] + } + ] + } + } +} + function overviewYarnJob(cluster, search, queue, yarnQueue) { return { className: 'font-mono', @@ -179,14 +264,28 @@ function overviewTab() { '重点表:', { type: 'tpl', - tpl: '${PADSTART(unReceive.focus, 3)}, ${PADSTART(unSchedule.focus, 3)}', + tpl: '${PADSTART(unReceive.focus, 3)}', }, + versionDetailDialog('unReceive.focus', 'unReceive_focus'), + ',', + { + type: 'tpl', + tpl: '${PADSTART(unSchedule.focus, 3)}', + }, + versionDetailDialog('unSchedule.focus', 'unScheduled_focus'), '
', '普通表:', { type: 'tpl', - tpl: '${PADSTART(unReceive.normal, 3)}, ${PADSTART(unSchedule.normal, 3)}', + tpl: '${PADSTART(unReceive.normal, 3)}', }, + versionDetailDialog('unReceive.normal', 'unReceive_normal'), + ',', + { + type: 'tpl', + tpl: '${PADSTART(unSchedule.normal, 3)}', + }, + versionDetailDialog('unSchedule.normal', 'unScheduled_normal'), ] } ]