feat(web): 集群信息改为统一配置
This commit is contained in:
@@ -1,17 +1,32 @@
|
|||||||
function commonInfo() {
|
const commonInfo = {
|
||||||
return {
|
// baseUrl: 'http://132.126.207.131:35690/hudi_services/service_web',
|
||||||
// baseUrl: 'http://132.126.207.131:35690/hudi_services/service_web',
|
baseUrl: '/hudi_services/service_web',
|
||||||
baseUrl: '/hudi_services/service_web',
|
clusters: {
|
||||||
loki: {
|
sync: {
|
||||||
grafanaUrl: 'http://132.126.207.34:35700',
|
'b12': 'default',
|
||||||
hudi: {
|
|
||||||
datasource: 'e2477661-3c3d-4e3d-a3f7-1d398a5b4b7b',
|
|
||||||
},
|
|
||||||
service: {
|
|
||||||
datasource: 'fbbc4d0c-16d1-45a3-8ceb-4039b1b9a353',
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
sync_names() {
|
||||||
|
return Object.keys(this.sync)
|
||||||
|
},
|
||||||
|
compaction: {
|
||||||
|
'b12': 'default',
|
||||||
|
'b1': 'datalake',
|
||||||
|
'b5': 'ten_iap.datalake',
|
||||||
|
'a4': 'ten_iap.datalake',
|
||||||
|
},
|
||||||
|
compaction_names() {
|
||||||
|
return Object.keys(this.sync)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
loki: {
|
||||||
|
grafanaUrl: 'http://132.126.207.34:35700',
|
||||||
|
hudi: {
|
||||||
|
datasource: 'e2477661-3c3d-4e3d-a3f7-1d398a5b4b7b',
|
||||||
|
},
|
||||||
|
service: {
|
||||||
|
datasource: 'fbbc4d0c-16d1-45a3-8ceb-4039b1b9a353',
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,11 +82,11 @@ function generateLokiUrl(baseUrl, queries) {
|
|||||||
|
|
||||||
function targetHudiSyncLokiUrlByAlias(flinkJobId) {
|
function targetHudiSyncLokiUrlByAlias(flinkJobId) {
|
||||||
return generateLokiUrl(
|
return generateLokiUrl(
|
||||||
commonInfo().loki.grafanaUrl,
|
commonInfo.loki.grafanaUrl,
|
||||||
[
|
[
|
||||||
generateQuery(
|
generateQuery(
|
||||||
"Hudi 运行日志",
|
"Hudi 运行日志",
|
||||||
commonInfo().loki.hudi.datasource,
|
commonInfo.loki.hudi.datasource,
|
||||||
{"flink_job_id": flinkJobId}
|
{"flink_job_id": flinkJobId}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -80,11 +95,11 @@ function targetHudiSyncLokiUrlByAlias(flinkJobId) {
|
|||||||
|
|
||||||
function targetHudiCompactionLokiUrlByAlias(alias) {
|
function targetHudiCompactionLokiUrlByAlias(alias) {
|
||||||
return generateLokiUrl(
|
return generateLokiUrl(
|
||||||
commonInfo().loki.grafanaUrl,
|
commonInfo.loki.grafanaUrl,
|
||||||
[
|
[
|
||||||
generateQuery(
|
generateQuery(
|
||||||
"Hudi 运行日志",
|
"Hudi 运行日志",
|
||||||
commonInfo().loki.hudi.datasource,
|
commonInfo.loki.hudi.datasource,
|
||||||
{"alias": alias}
|
{"alias": alias}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -93,11 +108,11 @@ function targetHudiCompactionLokiUrlByAlias(alias) {
|
|||||||
|
|
||||||
function targetYarnApplicationLokiUrlByAppId(applicationId) {
|
function targetYarnApplicationLokiUrlByAppId(applicationId) {
|
||||||
return generateLokiUrl(
|
return generateLokiUrl(
|
||||||
commonInfo().loki.grafanaUrl,
|
commonInfo.loki.grafanaUrl,
|
||||||
[
|
[
|
||||||
generateQuery(
|
generateQuery(
|
||||||
"Hudi 运行日志",
|
"Hudi 运行日志",
|
||||||
commonInfo().loki.hudi.datasource,
|
commonInfo.loki.hudi.datasource,
|
||||||
{"app_id": applicationId}
|
{"app_id": applicationId}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -106,11 +121,11 @@ function targetYarnApplicationLokiUrlByAppId(applicationId) {
|
|||||||
|
|
||||||
function serviceLogByAppName(name) {
|
function serviceLogByAppName(name) {
|
||||||
return generateLokiUrl(
|
return generateLokiUrl(
|
||||||
commonInfo().loki.grafanaUrl,
|
commonInfo.loki.grafanaUrl,
|
||||||
[
|
[
|
||||||
generateQuery(
|
generateQuery(
|
||||||
"Service 运行日志",
|
"Service 运行日志",
|
||||||
commonInfo().loki.service.datasource,
|
commonInfo.loki.service.datasource,
|
||||||
{"app": name}
|
{"app": name}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -119,11 +134,11 @@ function serviceLogByAppName(name) {
|
|||||||
|
|
||||||
function serviceLogByAppNameAndHost(name, host) {
|
function serviceLogByAppNameAndHost(name, host) {
|
||||||
return generateLokiUrl(
|
return generateLokiUrl(
|
||||||
commonInfo().loki.grafanaUrl,
|
commonInfo.loki.grafanaUrl,
|
||||||
[
|
[
|
||||||
generateQuery(
|
generateQuery(
|
||||||
"Service 运行日志",
|
"Service 运行日志",
|
||||||
commonInfo().loki.service.datasource,
|
commonInfo.loki.service.datasource,
|
||||||
{"app": name, "host": host}
|
{"app": name, "host": host}
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ function flinkJobDialog() {
|
|||||||
type: 'action',
|
type: 'action',
|
||||||
label: '打开同步详情',
|
label: '打开同步详情',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: simpleYarnDialog('b12', '同步详情', 'syncJobName')
|
dialog: simpleYarnDialog(commonInfo.clusters.sync_names(), '同步详情', 'syncJobName')
|
||||||
},
|
},
|
||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
{
|
{
|
||||||
@@ -1179,14 +1179,14 @@ function tableMetaDialog() {
|
|||||||
type: 'button',
|
type: 'button',
|
||||||
icon: 'fa fa-arrows-rotate',
|
icon: 'fa fa-arrows-rotate',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: simpleYarnDialog('b12', '同步详情', 'syncJobName')
|
dialog: simpleYarnDialog(commonInfo.clusters.sync_names(), '同步详情', 'syncJobName')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '压缩情况',
|
label: '压缩情况',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
icon: 'fa fa-minimize',
|
icon: 'fa fa-minimize',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: simpleYarnDialog('b12,b1,b5,a4', '压缩详情', 'compactionJobName')
|
dialog: simpleYarnDialog(commonInfo.clusters.compaction_names(), '压缩详情', 'compactionJobName')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '历史压缩',
|
label: '历史压缩',
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ function overviewTab() {
|
|||||||
},
|
},
|
||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
'<span class="italic text-gray-500 my-2">集群 (集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)</span>',
|
'<span class="italic text-gray-500 my-2">集群 (集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)</span>',
|
||||||
overviewYarnJob('b9', 'Sync', undefined, 'default'),
|
overviewYarnJob(commonInfo.clusters.sync_names(), 'Sync', undefined, 'default'),
|
||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
{
|
{
|
||||||
className: 'my-2',
|
className: 'my-2',
|
||||||
@@ -346,7 +346,7 @@ function overviewTab() {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
'<span class="italic text-gray-500 my-2">集群 压缩队列任务数(集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)</span>',
|
'<span class="italic text-gray-500 my-2">集群 压缩队列任务数(集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)</span>',
|
||||||
overviewYarnJob('b9', 'Compaction', 'compaction-queue-b9', 'default'),
|
overviewYarnJob(commonInfo.clusters.compaction_names(), 'Compaction', 'compaction-queue-b9', 'default'),
|
||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
{
|
{
|
||||||
type: 'service',
|
type: 'service',
|
||||||
|
|||||||
@@ -62,19 +62,17 @@ function queueCrud(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function queueTab() {
|
function queueTab() {
|
||||||
|
let items = []
|
||||||
|
for (let name of Object.keys(commonInfo.clusters.compaction)) {
|
||||||
|
items.push(yarnQueueCrud(name, commonInfo.clusters.compaction[name]))
|
||||||
|
items.push(queueCrud(`compaction-queue-${name}`))
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
title: '压缩队列',
|
title: '压缩队列',
|
||||||
icon: 'fa fa-van-shuttle',
|
icon: 'fa fa-van-shuttle',
|
||||||
tab: [
|
tab: [
|
||||||
queueCrud('compaction-queue-pre'),
|
queueCrud('compaction-queue-pre'),
|
||||||
yarnQueueCrud('b12', 'default'),
|
...items
|
||||||
queueCrud('compaction-queue-b12'),
|
|
||||||
yarnQueueCrud('b1', 'datalake'),
|
|
||||||
queueCrud('compaction-queue-b1'),
|
|
||||||
yarnQueueCrud('b5', 'ten_iap.datalake'),
|
|
||||||
queueCrud('compaction-queue-b5'),
|
|
||||||
yarnQueueCrud('a4', 'ten_iap.datalake'),
|
|
||||||
queueCrud('compaction-queue-a4'),
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ function taskTab() {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
url: `\${base}/yarn/job_list`,
|
url: `\${base}/yarn/job_list`,
|
||||||
data: {
|
data: {
|
||||||
clusters: `b12`,
|
clusters: commonInfo.clusters.sync_names(),
|
||||||
page: '${page|default:undefined}',
|
page: '${page|default:undefined}',
|
||||||
count: '${perPage|default:undefined}',
|
count: '${perPage|default:undefined}',
|
||||||
order: '${orderBy|default:undefined}',
|
order: '${orderBy|default:undefined}',
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ function toolTab() {
|
|||||||
title: '日志',
|
title: '日志',
|
||||||
...readOnlyDialogOptions(),
|
...readOnlyDialogOptions(),
|
||||||
size: 'lg',
|
size: 'lg',
|
||||||
body: {
|
body: {}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -171,10 +169,10 @@ function toolTab() {
|
|||||||
selectFirst: true,
|
selectFirst: true,
|
||||||
options: [
|
options: [
|
||||||
{label: '无', value: 'undefined'},
|
{label: '无', value: 'undefined'},
|
||||||
{label: 'b12', value: 'b12'},
|
...Object.keys(commonInfo.clusters.compaction)
|
||||||
{label: 'b1', value: 'b1'},
|
.map(name => {
|
||||||
{label: 'b5', value: 'b5'},
|
return {label: name, value: name}
|
||||||
{label: 'a4', value: 'a4'},
|
}),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -184,10 +182,10 @@ function toolTab() {
|
|||||||
selectFirst: true,
|
selectFirst: true,
|
||||||
options: [
|
options: [
|
||||||
{label: '无', value: 'undefined'},
|
{label: '无', value: 'undefined'},
|
||||||
{label: 'b12', value: 'b12'},
|
...Object.keys(commonInfo.clusters.compaction)
|
||||||
{label: 'b1', value: 'b1'},
|
.map(name => {
|
||||||
{label: 'b5', value: 'b5'},
|
return {label: name, value: name}
|
||||||
{label: 'a4', value: 'a4'},
|
}),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ function yarnClusterTab() {
|
|||||||
{
|
{
|
||||||
title: '总体情况',
|
title: '总体情况',
|
||||||
tab: [
|
tab: [
|
||||||
yarnQueueCrud('b9')
|
...Object.keys(commonInfo.clusters.compaction).map(name => yarnQueueCrud(name))
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
yarnTab('b9', 'b9'),
|
...Object.keys(commonInfo.clusters.compaction).map(name => yarnTab(name, name)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -62,8 +62,8 @@
|
|||||||
tableTab(),
|
tableTab(),
|
||||||
queueTab(),
|
queueTab(),
|
||||||
versionTab(),
|
versionTab(),
|
||||||
yarnTab('b9', '同步', undefined, 'Sync'),
|
yarnTab(commonInfo.clusters.sync_names(), '同步', undefined, 'Sync'),
|
||||||
yarnTab('b9', '压缩', 'default', 'Compaction'),
|
yarnTab(commonInfo.clusters.compaction_names(), '压缩', 'default', 'Compaction'),
|
||||||
cloudTab(),
|
cloudTab(),
|
||||||
yarnClusterTab(),
|
yarnClusterTab(),
|
||||||
toolTab(),
|
toolTab(),
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
amisJSON,
|
amisJSON,
|
||||||
{
|
{
|
||||||
data: {
|
data: {
|
||||||
base: commonInfo().baseUrl
|
base: commonInfo.baseUrl
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,8 +62,8 @@
|
|||||||
tableTab(),
|
tableTab(),
|
||||||
queueTab(),
|
queueTab(),
|
||||||
versionTab(),
|
versionTab(),
|
||||||
yarnTab('b9', '同步', undefined, 'Sync'),
|
yarnTab(commonInfo.clusters.sync_names(), '同步', undefined, 'Sync'),
|
||||||
yarnTab('b9', '压缩', 'default', 'Compaction')
|
yarnTab(commonInfo.clusters.compaction_names(), '压缩', 'default', 'Compaction')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
amisJSON,
|
amisJSON,
|
||||||
{
|
{
|
||||||
data: {
|
data: {
|
||||||
base: commonInfo().baseUrl
|
base: commonInfo.baseUrl
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user