diff --git a/service-web/src/main/resources/static/common/info.js b/service-web/src/main/resources/static/common/info.js index 473da46..4f3c628 100644 --- a/service-web/src/main/resources/static/common/info.js +++ b/service-web/src/main/resources/static/common/info.js @@ -1,17 +1,32 @@ -function commonInfo() { - return { - // baseUrl: 'http://132.126.207.131:35690/hudi_services/service_web', - baseUrl: '/hudi_services/service_web', - loki: { - grafanaUrl: 'http://132.126.207.34:35700', - hudi: { - datasource: 'e2477661-3c3d-4e3d-a3f7-1d398a5b4b7b', - }, - service: { - datasource: 'fbbc4d0c-16d1-45a3-8ceb-4039b1b9a353', - } +const commonInfo = { + // baseUrl: 'http://132.126.207.131:35690/hudi_services/service_web', + baseUrl: '/hudi_services/service_web', + clusters: { + sync: { + 'b12': 'default', }, - } + 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) { return generateLokiUrl( - commonInfo().loki.grafanaUrl, + commonInfo.loki.grafanaUrl, [ generateQuery( "Hudi 运行日志", - commonInfo().loki.hudi.datasource, + commonInfo.loki.hudi.datasource, {"flink_job_id": flinkJobId} ) ] @@ -80,11 +95,11 @@ function targetHudiSyncLokiUrlByAlias(flinkJobId) { function targetHudiCompactionLokiUrlByAlias(alias) { return generateLokiUrl( - commonInfo().loki.grafanaUrl, + commonInfo.loki.grafanaUrl, [ generateQuery( "Hudi 运行日志", - commonInfo().loki.hudi.datasource, + commonInfo.loki.hudi.datasource, {"alias": alias} ) ] @@ -93,11 +108,11 @@ function targetHudiCompactionLokiUrlByAlias(alias) { function targetYarnApplicationLokiUrlByAppId(applicationId) { return generateLokiUrl( - commonInfo().loki.grafanaUrl, + commonInfo.loki.grafanaUrl, [ generateQuery( "Hudi 运行日志", - commonInfo().loki.hudi.datasource, + commonInfo.loki.hudi.datasource, {"app_id": applicationId} ) ] @@ -106,11 +121,11 @@ function targetYarnApplicationLokiUrlByAppId(applicationId) { function serviceLogByAppName(name) { return generateLokiUrl( - commonInfo().loki.grafanaUrl, + commonInfo.loki.grafanaUrl, [ generateQuery( "Service 运行日志", - commonInfo().loki.service.datasource, + commonInfo.loki.service.datasource, {"app": name} ) ] @@ -119,11 +134,11 @@ function serviceLogByAppName(name) { function serviceLogByAppNameAndHost(name, host) { return generateLokiUrl( - commonInfo().loki.grafanaUrl, + commonInfo.loki.grafanaUrl, [ generateQuery( "Service 运行日志", - commonInfo().loki.service.datasource, + commonInfo.loki.service.datasource, {"app": name, "host": host} ) ] diff --git a/service-web/src/main/resources/static/components/common.js b/service-web/src/main/resources/static/components/common.js index 7435ef2..72543d2 100644 --- a/service-web/src/main/resources/static/components/common.js +++ b/service-web/src/main/resources/static/components/common.js @@ -746,7 +746,7 @@ function flinkJobDialog() { type: 'action', label: '打开同步详情', actionType: 'dialog', - dialog: simpleYarnDialog('b12', '同步详情', 'syncJobName') + dialog: simpleYarnDialog(commonInfo.clusters.sync_names(), '同步详情', 'syncJobName') }, {type: 'divider'}, { @@ -1179,14 +1179,14 @@ function tableMetaDialog() { type: 'button', icon: 'fa fa-arrows-rotate', actionType: 'dialog', - dialog: simpleYarnDialog('b12', '同步详情', 'syncJobName') + dialog: simpleYarnDialog(commonInfo.clusters.sync_names(), '同步详情', 'syncJobName') }, { label: '压缩情况', type: 'action', icon: 'fa fa-minimize', actionType: 'dialog', - dialog: simpleYarnDialog('b12,b1,b5,a4', '压缩详情', 'compactionJobName') + dialog: simpleYarnDialog(commonInfo.clusters.compaction_names(), '压缩详情', 'compactionJobName') }, { label: '历史压缩', diff --git a/service-web/src/main/resources/static/components/overview-tab.js b/service-web/src/main/resources/static/components/overview-tab.js index b364395..0045425 100644 --- a/service-web/src/main/resources/static/components/overview-tab.js +++ b/service-web/src/main/resources/static/components/overview-tab.js @@ -330,7 +330,7 @@ function overviewTab() { }, {type: 'divider'}, '集群 (集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)', - overviewYarnJob('b9', 'Sync', undefined, 'default'), + overviewYarnJob(commonInfo.clusters.sync_names(), 'Sync', undefined, 'default'), {type: 'divider'}, { className: 'my-2', @@ -346,7 +346,7 @@ function overviewTab() { ] }, '集群 压缩队列任务数(集群总资源使用,队列资源使用)(调度中任务数,运行中任务数)', - overviewYarnJob('b9', 'Compaction', 'compaction-queue-b9', 'default'), + overviewYarnJob(commonInfo.clusters.compaction_names(), 'Compaction', 'compaction-queue-b9', 'default'), {type: 'divider'}, { type: 'service', diff --git a/service-web/src/main/resources/static/components/queue-tab.js b/service-web/src/main/resources/static/components/queue-tab.js index 41a485a..290ae4d 100644 --- a/service-web/src/main/resources/static/components/queue-tab.js +++ b/service-web/src/main/resources/static/components/queue-tab.js @@ -62,19 +62,17 @@ function queueCrud(name) { } 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 { title: '压缩队列', icon: 'fa fa-van-shuttle', tab: [ queueCrud('compaction-queue-pre'), - yarnQueueCrud('b12', 'default'), - 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'), + ...items ], } } \ No newline at end of file diff --git a/service-web/src/main/resources/static/components/task-tab.js b/service-web/src/main/resources/static/components/task-tab.js index b61ab75..9918871 100644 --- a/service-web/src/main/resources/static/components/task-tab.js +++ b/service-web/src/main/resources/static/components/task-tab.js @@ -119,7 +119,7 @@ function taskTab() { method: 'get', url: `\${base}/yarn/job_list`, data: { - clusters: `b12`, + clusters: commonInfo.clusters.sync_names(), page: '${page|default:undefined}', count: '${perPage|default:undefined}', order: '${orderBy|default:undefined}', diff --git a/service-web/src/main/resources/static/components/tool-tab.js b/service-web/src/main/resources/static/components/tool-tab.js index 7cdd86a..3bbe827 100644 --- a/service-web/src/main/resources/static/components/tool-tab.js +++ b/service-web/src/main/resources/static/components/tool-tab.js @@ -50,9 +50,7 @@ function toolTab() { title: '日志', ...readOnlyDialogOptions(), size: 'lg', - body: { - - } + body: {} } } ] @@ -171,10 +169,10 @@ function toolTab() { selectFirst: true, options: [ {label: '无', value: 'undefined'}, - {label: 'b12', value: 'b12'}, - {label: 'b1', value: 'b1'}, - {label: 'b5', value: 'b5'}, - {label: 'a4', value: 'a4'}, + ...Object.keys(commonInfo.clusters.compaction) + .map(name => { + return {label: name, value: name} + }), ] }, { @@ -184,10 +182,10 @@ function toolTab() { selectFirst: true, options: [ {label: '无', value: 'undefined'}, - {label: 'b12', value: 'b12'}, - {label: 'b1', value: 'b1'}, - {label: 'b5', value: 'b5'}, - {label: 'a4', value: 'a4'}, + ...Object.keys(commonInfo.clusters.compaction) + .map(name => { + return {label: name, value: name} + }), ] }, ] diff --git a/service-web/src/main/resources/static/components/yarn-cluster-tab.js b/service-web/src/main/resources/static/components/yarn-cluster-tab.js index e36d48a..381d72c 100644 --- a/service-web/src/main/resources/static/components/yarn-cluster-tab.js +++ b/service-web/src/main/resources/static/components/yarn-cluster-tab.js @@ -12,10 +12,10 @@ function yarnClusterTab() { { title: '总体情况', 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)), ] } ] diff --git a/service-web/src/main/resources/static/extra.html b/service-web/src/main/resources/static/extra.html index 9059c64..6c9a13e 100644 --- a/service-web/src/main/resources/static/extra.html +++ b/service-web/src/main/resources/static/extra.html @@ -62,8 +62,8 @@ tableTab(), queueTab(), versionTab(), - yarnTab('b9', '同步', undefined, 'Sync'), - yarnTab('b9', '压缩', 'default', 'Compaction'), + yarnTab(commonInfo.clusters.sync_names(), '同步', undefined, 'Sync'), + yarnTab(commonInfo.clusters.compaction_names(), '压缩', 'default', 'Compaction'), cloudTab(), yarnClusterTab(), toolTab(), @@ -77,7 +77,7 @@ amisJSON, { data: { - base: commonInfo().baseUrl + base: commonInfo.baseUrl }, }, { diff --git a/service-web/src/main/resources/static/index.html b/service-web/src/main/resources/static/index.html index 6bc4fc4..2ffad8c 100644 --- a/service-web/src/main/resources/static/index.html +++ b/service-web/src/main/resources/static/index.html @@ -62,8 +62,8 @@ tableTab(), queueTab(), versionTab(), - yarnTab('b9', '同步', undefined, 'Sync'), - yarnTab('b9', '压缩', 'default', 'Compaction') + yarnTab(commonInfo.clusters.sync_names(), '同步', undefined, 'Sync'), + yarnTab(commonInfo.clusters.compaction_names(), '压缩', 'default', 'Compaction') ] } } @@ -73,7 +73,7 @@ amisJSON, { data: { - base: commonInfo().baseUrl + base: commonInfo.baseUrl }, }, {