feature(yarn-query,web): 新增 yarn 多集群查询

可以联合或单独查询 yarn 集群,并且聚合过滤排序等数据筛选内容
This commit is contained in:
2023-05-05 11:52:09 +08:00
parent 49a77a3795
commit 027fa10d50
24 changed files with 348 additions and 269 deletions

View File

@@ -20,7 +20,9 @@ function cloudTab() {
type: 'crud',
title: '服务列表',
api: '${base}/cloud/list',
source: '$items',
interval: 2000,
syncLocation: false,
silentPolling: true,
headerToolbar: ['reload'],
columns: [
{name: 'name', label: '名称'},

View File

@@ -11,7 +11,7 @@ function yarnCrudColumns() {
{
name: 'id',
label: 'ID',
width: 240,
width: 250,
fixed: 'left',
...copyField('id')
},
@@ -21,12 +21,19 @@ function yarnCrudColumns() {
fixed: 'left',
...copyField('name')
},
{
name: 'cluster',
label: '集群',
width: 50,
align: 'center',
},
{
label: '用户',
width: 80,
type: 'tooltip-wrapper',
body: '${TRUNCATE(user, 8)}',
content: '${user}',
align: 'center',
},
{
name: 'startedTime',
@@ -162,7 +169,7 @@ function yarnCrudColumns() {
]
}
function simpleYarnDialog(mode, title) {
function simpleYarnDialog(cluster, title, filterField) {
return {
title: title,
actions: [],
@@ -194,8 +201,9 @@ function simpleYarnDialog(mode, title) {
type: 'crud',
api: {
method: 'get',
url: `\${base}/${mode}_yarn/job_list`,
url: `\${base}/yarn/job_list`,
data: {
clusters: `${cluster}`,
page: '${page|default:undefined}',
count: '${perPage|default:undefined}',
order: '${orderBy|default:undefined}',
@@ -203,7 +211,7 @@ function simpleYarnDialog(mode, title) {
filter_state: '${state|default:undefined}',
filter_final_status: '${finalStatus|default:undefined}',
search_id: '${id|default:undefined}',
search_name: `\${${mode}JobName}`,
search_name: `\${${filterField}}`,
precise: true,
}
},
@@ -286,7 +294,7 @@ function flinkJobDialog() {
type: 'action',
label: '打开同步详情',
actionType: 'dialog',
dialog: simpleYarnDialog('sync', '同步详情')
dialog: simpleYarnDialog('b5-sync', '同步详情', 'syncJobName')
},
{type: 'divider'},
{
@@ -386,14 +394,14 @@ function tableMetaDialog() {
type: 'action',
icon: 'fa fa-arrows-rotate',
actionType: 'dialog',
dialog: simpleYarnDialog('sync', '同步详情')
dialog: simpleYarnDialog('b5-sync', '同步详情', 'syncJobName')
},
{
label: '压缩情况',
type: 'action',
icon: 'fa fa-minimize',
actionType: 'dialog',
dialog: simpleYarnDialog('compaction', '压缩详情')
dialog: simpleYarnDialog('b1', '压缩详情', 'compactionJobName')
},
{
type: 'button',

View File

@@ -1,29 +1,25 @@
function yarnTab(name, title, queueNames = 'default', searchName = undefined) {
function yarnTab(cluster, title, queueNames = 'default', searchName = undefined) {
return {
title: `${title} 集群`,
tab: [
{
id: `${name}-yarn-service`,
name: `${name}-yarn-service`,
id: `${cluster}-yarn-service`,
name: `${cluster}-yarn-service`,
type: 'service',
body: [
{
type: 'tpl',
tpl: '<span class="font-bold text-xl">集群资源</span>',
// className: 'mb-2 block',
},
{
type: 'crud',
api: {
method: 'get',
url: `\${base}/${name}_yarn/queue_list`,
url: '${base}/yarn/queue_list',
data: {
clusters: `${cluster}`,
names: '${queueName|default:undefined}'
},
responseData: {
'&': '$$',
clusterUsage: '${ROUND((cluster.usedCapacity * 100 / cluster.maxCapacity), 0)}'
},
},
defaultParams: {
queueName: queueNames,
@@ -33,10 +29,6 @@ function yarnTab(name, title, queueNames = 'default', searchName = undefined) {
silentPolling: true,
headerToolbar: [
"reload",
{
type: "tpl",
tpl: "集群总资源 <span class='ml-1 font-extrabold text-xl ${IF(clusterUsage > 0, IF(clusterUsage > 30, IF(clusterUsage > 90, 'text-danger', 'text-info'), 'text-info'), 'text-success')}'>${clusterUsage}%</span>"
},
],
columns: [
{
@@ -86,6 +78,7 @@ function yarnTab(name, title, queueNames = 'default', searchName = undefined) {
type: "button",
level: "link",
tooltip: '查看队列详情',
visibleOn: '${!root}',
actionType: 'dialog',
dialog: {
closeOnEsc: true,
@@ -141,8 +134,9 @@ function yarnTab(name, title, queueNames = 'default', searchName = undefined) {
type: 'crud',
api: {
method: 'get',
url: `\${base}/${name}_yarn/job_list`,
url: '${base}/yarn/job_list',
data: {
clusters: `${cluster}`,
page: '${page|default:undefined}',
count: '${perPage|default:undefined}',
order: '${orderBy|default:undefined}',