From f77a6160c4450bb35b7e72582c91daccb355807e Mon Sep 17 00:00:00 2001 From: ruanwenjun Date: Tue, 21 Jan 2025 20:02:51 +0800 Subject: [PATCH] [Fix-16903] Fix monitor page cannot display well --- .../alert/registry/AlertHeartbeatTask.java | 1 + .../api/controller/MonitorController.java | 2 +- .../meter/metrics/DefaultMetricsProvider.java | 6 ++ .../registry/api/RegistryConstants.java | 25 ++++++ .../plugin/registry/jdbc/JdbcRegistry.java | 41 +++++----- .../plugin/registry/jdbc/KeyUtils.java | 76 +++++++++++++++++++ .../jdbc/server/JdbcRegistryDataManager.java | 6 +- .../plugin/registry/jdbc/KeyUtilsTest.java | 41 ++++++++++ .../src/locales/en_US/monitor.ts | 6 +- .../src/locales/zh_CN/monitor.ts | 6 +- .../src/service/modules/monitor/types.ts | 4 +- .../servers/alert_server/index.module.scss | 5 -- .../monitor/servers/alert_server/index.tsx | 35 +++------ .../monitor/servers/master/index.module.scss | 5 -- .../views/monitor/servers/master/index.tsx | 35 +++------ .../monitor/servers/worker/index.module.scss | 5 -- .../views/monitor/servers/worker/index.tsx | 64 +++++----------- 17 files changed, 222 insertions(+), 141 deletions(-) create mode 100644 dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/RegistryConstants.java create mode 100644 dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java create mode 100644 dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/test/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtilsTest.java diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/registry/AlertHeartbeatTask.java b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/registry/AlertHeartbeatTask.java index 8b9775e6d808..95d26b155819 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/registry/AlertHeartbeatTask.java +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/registry/AlertHeartbeatTask.java @@ -75,6 +75,7 @@ public AlertServerHeartBeat getHeartBeat() { .cpuUsage(systemMetrics.getSystemCpuUsagePercentage()) .memoryUsage(systemMetrics.getSystemMemoryUsedPercentage()) .jvmMemoryUsage(systemMetrics.getJvmMemoryUsedPercentage()) + .diskUsage(systemMetrics.getDiskUsedPercentage()) .serverStatus(ServerStatus.NORMAL) .isActive(alertHAServer.isActive()) .host(NetUtils.getHost()) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java index 4bf952d00630..be714032ccc8 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java @@ -65,7 +65,7 @@ public class MonitorController extends BaseController { @ResponseStatus(HttpStatus.OK) @ApiException(LIST_MASTERS_ERROR) public Result> listServer(@PathVariable("nodeType") RegistryNodeType nodeType) { - List servers = monitorService.listServer(nodeType); + final List servers = monitorService.listServer(nodeType); return Result.success(servers); } diff --git a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/metrics/DefaultMetricsProvider.java b/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/metrics/DefaultMetricsProvider.java index d2276794463a..0db50ba95e88 100644 --- a/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/metrics/DefaultMetricsProvider.java +++ b/dolphinscheduler-meter/src/main/java/org/apache/dolphinscheduler/meter/metrics/DefaultMetricsProvider.java @@ -65,6 +65,9 @@ public SystemMetrics getSystemMetrics() { long totalSystemMemory = OSUtils.getTotalSystemMemory(); long systemMemoryAvailable = OSUtils.getSystemAvailableMemoryUsed(); + double diskToTalBytes = meterRegistry.get("disk.total").gauge().value(); + double diskFreeBytes = meterRegistry.get("disk.free").gauge().value(); + systemMetrics = SystemMetrics.builder() .systemCpuUsagePercentage(systemCpuUsage) .jvmCpuUsagePercentage(processCpuUsage) @@ -74,6 +77,9 @@ public SystemMetrics getSystemMetrics() { .systemMemoryUsed(totalSystemMemory - systemMemoryAvailable) .systemMemoryMax(totalSystemMemory) .systemMemoryUsedPercentage((double) (totalSystemMemory - systemMemoryAvailable) / totalSystemMemory) + .diskUsed(diskToTalBytes - diskFreeBytes) + .diskTotal(diskToTalBytes) + .diskUsedPercentage((diskToTalBytes - diskFreeBytes) / diskToTalBytes) .build(); lastRefreshTime = System.currentTimeMillis(); return systemMetrics; diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/RegistryConstants.java b/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/RegistryConstants.java new file mode 100644 index 000000000000..93d28576bd0c --- /dev/null +++ b/dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/RegistryConstants.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dolphinscheduler.registry.api; + +public class RegistryConstants { + + public static final String PATH_SEPARATOR = "/"; + public static final char PATH_SEPARATOR_CHAR = '/'; + +} diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java index bd468f58b792..37a301bcadf1 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java @@ -97,19 +97,19 @@ public void connectUntilTimeout(@NonNull Duration timeout) throws RegistryExcept } @Override - public void subscribe(String path, SubscribeListener listener) { - checkNotNull(path); + public void subscribe(String subscribePath, SubscribeListener listener) { + checkNotNull(subscribePath); checkNotNull(listener); jdbcRegistryClient.subscribeJdbcRegistryDataChange(new JdbcRegistryDataChangeListener() { @Override - public void onJdbcRegistryDataChanged(String key, String value) { - if (!key.startsWith(path)) { + public void onJdbcRegistryDataChanged(String eventPath, String value) { + if (!isPathMatch(subscribePath, eventPath)) { return; } - Event event = Event.builder() - .key(key) - .path(path) + final Event event = Event.builder() + .key(subscribePath) + .path(eventPath) .data(value) .type(Event.Type.UPDATE) .build(); @@ -117,31 +117,35 @@ public void onJdbcRegistryDataChanged(String key, String value) { } @Override - public void onJdbcRegistryDataDeleted(String key) { - if (!key.startsWith(path)) { + public void onJdbcRegistryDataDeleted(String eventPath) { + if (!isPathMatch(subscribePath, eventPath)) { return; } - Event event = Event.builder() - .key(key) - .path(key) + final Event event = Event.builder() + .key(subscribePath) + .path(eventPath) .type(Event.Type.REMOVE) .build(); listener.notify(event); } @Override - public void onJdbcRegistryDataAdded(String key, String value) { - if (!key.startsWith(path)) { + public void onJdbcRegistryDataAdded(String eventPath, String value) { + if (!isPathMatch(subscribePath, eventPath)) { return; } - Event event = Event.builder() - .key(key) - .path(key) + final Event event = Event.builder() + .key(subscribePath) + .path(eventPath) .data(value) .type(Event.Type.ADD) .build(); listener.notify(event); } + + private boolean isPathMatch(String subscribePath, String eventPath) { + return KeyUtils.isParent(subscribePath, eventPath) || KeyUtils.isSamePath(subscribePath, eventPath); + } }); } @@ -206,11 +210,10 @@ public void delete(String key) { @Override public Collection children(String key) { try { - List children = jdbcRegistryClient.listJdbcRegistryDataChildren(key); + final List children = jdbcRegistryClient.listJdbcRegistryDataChildren(key); return children .stream() .map(JdbcRegistryDataDTO::getDataKey) - .filter(fullPath -> fullPath.length() > key.length()) .map(fullPath -> StringUtils.substringBefore(fullPath.substring(key.length() + 1), "/")) .distinct() .collect(Collectors.toList()); diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java new file mode 100644 index 000000000000..84576243ca90 --- /dev/null +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dolphinscheduler.plugin.registry.jdbc; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.dolphinscheduler.registry.api.RegistryConstants; + +import org.apache.commons.lang3.StringUtils; + +import lombok.experimental.UtilityClass; + +@UtilityClass +public class KeyUtils { + + /** + * Whether the path is the parent path of the child + *

Only the parentPath is the parent path of the childPath, return true + *

If the parentPath is equal to the childPath, return false + */ + public static boolean isParent(final String parentPath, final String childPath) { + if (StringUtils.isEmpty(parentPath)) { + throw new IllegalArgumentException("Invalid parent path " + parentPath); + } + if (StringUtils.isEmpty(childPath)) { + throw new IllegalArgumentException("Invalid child path " + childPath); + } + final String[] parentSplit = parentPath.split(RegistryConstants.PATH_SEPARATOR); + final String[] childSplit = childPath.split(RegistryConstants.PATH_SEPARATOR); + if (parentSplit.length >= childSplit.length) { + return false; + } + for (int i = 0; i < parentSplit.length; i++) { + if (!parentSplit[i].equals(childSplit[i])) { + return false; + } + } + return true; + + } + + public static boolean isSamePath(final String path1, final String path2) { + return removeLastSlash(path1).equals(path2); + } + + private static String removeLastSlash(final String path) { + checkNotNull(path, "path is null"); + if (!path.startsWith(RegistryConstants.PATH_SEPARATOR)) { + throw new IllegalArgumentException("Invalid path " + path); + } + int length = path.length() - 1; + while (length >= 0 && path.charAt(length) == RegistryConstants.PATH_SEPARATOR_CHAR) { + length--; + } + if (length == -1) { + return RegistryConstants.PATH_SEPARATOR; + } + return path.substring(0, length + 1); + } + +} diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryDataManager.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryDataManager.java index e0f091bde7d9..b31780cf7fff 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryDataManager.java +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/server/JdbcRegistryDataManager.java @@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.plugin.registry.jdbc.JdbcRegistryProperties; import org.apache.dolphinscheduler.plugin.registry.jdbc.JdbcRegistryThreadFactory; +import org.apache.dolphinscheduler.plugin.registry.jdbc.KeyUtils; import org.apache.dolphinscheduler.plugin.registry.jdbc.model.DTO.DataType; import org.apache.dolphinscheduler.plugin.registry.jdbc.model.DTO.JdbcRegistryDataChanceEventDTO; import org.apache.dolphinscheduler.plugin.registry.jdbc.model.DTO.JdbcRegistryDataDTO; @@ -147,12 +148,11 @@ public Optional getRegistryDataByKey(String key) { } @Override - public List listJdbcRegistryDataChildren(String key) { + public List listJdbcRegistryDataChildren(final String key) { checkNotNull(key); return jdbcRegistryDataRepository.selectAll() .stream() - .filter(jdbcRegistryDataDTO -> jdbcRegistryDataDTO.getDataKey().startsWith(key) - && !jdbcRegistryDataDTO.getDataKey().equals(key)) + .filter(jdbcRegistryDataDTO -> KeyUtils.isParent(key, jdbcRegistryDataDTO.getDataKey())) .collect(Collectors.toList()); } diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/test/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtilsTest.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/test/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtilsTest.java new file mode 100644 index 000000000000..0a8c591dc2a9 --- /dev/null +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/test/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtilsTest.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dolphinscheduler.plugin.registry.jdbc; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class KeyUtilsTest { + + @Test + void isParent() { + assertFalse(KeyUtils.isParent("/a", "/b")); + assertFalse(KeyUtils.isParent("/a", "/a")); + assertFalse(KeyUtils.isParent("/b/c", "/b")); + assertFalse(KeyUtils.isParent("/b/c", "/b/")); + + assertTrue(KeyUtils.isParent("/", "/b")); + assertTrue(KeyUtils.isParent("/b/c", "/b/c/d")); + assertTrue(KeyUtils.isParent("/b", "/b/c/d")); + assertTrue(KeyUtils.isParent("/b/", "/b/c/d")); + + } + +} diff --git a/dolphinscheduler-ui/src/locales/en_US/monitor.ts b/dolphinscheduler-ui/src/locales/en_US/monitor.ts index 561b40d64bb3..54431534322f 100644 --- a/dolphinscheduler-ui/src/locales/en_US/monitor.ts +++ b/dolphinscheduler-ui/src/locales/en_US/monitor.ts @@ -19,8 +19,7 @@ export default { master: { cpu_usage: 'CPU Usage', memory_usage: 'Memory Usage', - disk_available: 'Disk Available', - load_average: 'Load Average', + disk_usage: 'Disk Usage', create_time: 'Create Time', last_heartbeat_time: 'Last Heartbeat Time', directory_detail: 'Directory Detail', @@ -33,8 +32,7 @@ export default { worker: { cpu_usage: 'CPU Usage', memory_usage: 'Memory Usage', - disk_available: 'Disk Available', - load_average: 'Load Average', + disk_usage: 'Disk Usage', thread_pool_usage: 'Thread Pool Usage', create_time: 'Create Time', last_heartbeat_time: 'Last Heartbeat Time', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/monitor.ts b/dolphinscheduler-ui/src/locales/zh_CN/monitor.ts index 2ef6a9c4609c..ef78068a61d9 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/monitor.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/monitor.ts @@ -19,8 +19,7 @@ export default { master: { cpu_usage: '处理器使用量', memory_usage: '内存使用量', - disk_available: '磁盘可用容量', - load_average: '平均负载量', + disk_usage: '磁盘使用量', create_time: '创建时间', last_heartbeat_time: '最后心跳时间', directory_detail: '目录详情', @@ -33,8 +32,7 @@ export default { worker: { cpu_usage: '处理器使用量', memory_usage: '内存使用量', - disk_available: '磁盘可用容量', - load_average: '平均负载量', + disk_usage: '磁盘使用量', thread_pool_usage: '线程池使用量', create_time: '创建时间', last_heartbeat_time: '最后心跳时间', diff --git a/dolphinscheduler-ui/src/service/modules/monitor/types.ts b/dolphinscheduler-ui/src/service/modules/monitor/types.ts index 0a689019ce03..11a707789aab 100644 --- a/dolphinscheduler-ui/src/service/modules/monitor/types.ts +++ b/dolphinscheduler-ui/src/service/modules/monitor/types.ts @@ -31,8 +31,8 @@ interface ServerNode { id: number host: string port: number - zkDirectory: string - resInfo: string + serverDirectory: string + heartBeatInfo: string createTime: string lastHeartbeatTime: string } diff --git a/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.module.scss b/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.module.scss index 7bde891f5b01..deedab61c054 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.module.scss +++ b/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.module.scss @@ -27,11 +27,6 @@ @include base; } -.load-average { - @include base; - color: var(--n-color-target); -} - .link-btn { color: var(--n-color-target); cursor: pointer; diff --git a/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.tsx b/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.tsx index a223fcb8a809..d9f876b8c678 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.tsx +++ b/dolphinscheduler-ui/src/views/monitor/servers/alert_server/index.tsx @@ -16,7 +16,7 @@ */ import { defineComponent, onMounted, ref, toRefs } from 'vue' -import { NGrid, NGi, NCard, NNumberAnimation, NSpace, NTag } from 'naive-ui' +import { NGrid, NGi, NCard, NSpace, NTag } from 'naive-ui' import { useI18n } from 'vue-i18n' import { useServerNode } from './use-server-node' import styles from './index.module.scss' @@ -64,7 +64,7 @@ const alertServer = defineComponent({ this const renderNodeServerStatusTag = (item: AlertNode) => { - const serverStatus = JSON.parse(item.resInfo)?.serverStatus + const serverStatus = JSON.parse(item.heartBeatInfo)?.serverStatus if (!serverStatus) return '' @@ -103,7 +103,7 @@ const alertServer = defineComponent({ }`} clickDetails(item.zkDirectory)} + onClick={() => clickDetails(item.serverDirectory)} > {t('monitor.master.directory_detail')} @@ -125,7 +125,7 @@ const alertServer = defineComponent({ {item && ( )} @@ -138,7 +138,7 @@ const alertServer = defineComponent({ {item && ( )} @@ -146,26 +146,13 @@ const alertServer = defineComponent({ - -

+ +
{item && ( - - )} -
-
- - - -
- {item && ( - )}
diff --git a/dolphinscheduler-ui/src/views/monitor/servers/master/index.module.scss b/dolphinscheduler-ui/src/views/monitor/servers/master/index.module.scss index 7bde891f5b01..deedab61c054 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/master/index.module.scss +++ b/dolphinscheduler-ui/src/views/monitor/servers/master/index.module.scss @@ -27,11 +27,6 @@ @include base; } -.load-average { - @include base; - color: var(--n-color-target); -} - .link-btn { color: var(--n-color-target); cursor: pointer; diff --git a/dolphinscheduler-ui/src/views/monitor/servers/master/index.tsx b/dolphinscheduler-ui/src/views/monitor/servers/master/index.tsx index cf29109c270b..0766681ddf3b 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/master/index.tsx +++ b/dolphinscheduler-ui/src/views/monitor/servers/master/index.tsx @@ -16,7 +16,7 @@ */ import { defineComponent, onMounted, ref, toRefs } from 'vue' -import { NGrid, NGi, NCard, NNumberAnimation, NSpace, NTag } from 'naive-ui' +import { NGrid, NGi, NCard, NSpace, NTag } from 'naive-ui' import { useI18n } from 'vue-i18n' import { useMaster } from './use-master' import styles from './index.module.scss' @@ -64,7 +64,7 @@ const master = defineComponent({ this const renderNodeServerStatusTag = (item: MasterNode) => { - const serverStatus = JSON.parse(item.resInfo)?.serverStatus + const serverStatus = JSON.parse(item.heartBeatInfo)?.serverStatus if (!serverStatus) return '' @@ -103,7 +103,7 @@ const master = defineComponent({ }`} clickDetails(item.zkDirectory)} + onClick={() => clickDetails(item.serverDirectory)} > {t('monitor.master.directory_detail')} @@ -125,7 +125,7 @@ const master = defineComponent({ {item && ( )} @@ -138,7 +138,7 @@ const master = defineComponent({ {item && ( )} @@ -146,26 +146,13 @@ const master = defineComponent({
- -
+ +
{item && ( - - )} -
-
- - - -
- {item && ( - )}
diff --git a/dolphinscheduler-ui/src/views/monitor/servers/worker/index.module.scss b/dolphinscheduler-ui/src/views/monitor/servers/worker/index.module.scss index f0a52382eeae..5f6a7c62d434 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/worker/index.module.scss +++ b/dolphinscheduler-ui/src/views/monitor/servers/worker/index.module.scss @@ -27,11 +27,6 @@ @include base; } -.load-average { - @include base; - color: var(--n-color-target); -} - .link-btn { color: var(--n-color-target); cursor: pointer; diff --git a/dolphinscheduler-ui/src/views/monitor/servers/worker/index.tsx b/dolphinscheduler-ui/src/views/monitor/servers/worker/index.tsx index 6971e78f1b5a..34ff4786acb5 100644 --- a/dolphinscheduler-ui/src/views/monitor/servers/worker/index.tsx +++ b/dolphinscheduler-ui/src/views/monitor/servers/worker/index.tsx @@ -16,7 +16,7 @@ */ import { defineComponent, onMounted, ref, toRefs } from 'vue' -import { NGrid, NGi, NCard, NNumberAnimation, NSpace, NTag } from 'naive-ui' +import { NGrid, NGi, NCard, NSpace, NTag } from 'naive-ui' import { useI18n } from 'vue-i18n' import { useWorker } from './use-worker' import styles from './index.module.scss' @@ -64,7 +64,7 @@ const worker = defineComponent({ this const renderNodeServerStatusTag = (item: WorkerNode) => { - const serverStatus = JSON.parse(item.resInfo)?.serverStatus + const serverStatus = JSON.parse(item.heartBeatInfo)?.serverStatus if (!serverStatus) return '' @@ -103,7 +103,7 @@ const worker = defineComponent({ }`} clickDetails(item.zkDirectory)} + onClick={() => clickDetails(item.serverDirectory)} > {t('monitor.worker.directory_detail')} @@ -118,14 +118,14 @@ const worker = defineComponent({ - +
{item && ( )} @@ -138,7 +138,7 @@ const worker = defineComponent({ {item && ( )} @@ -146,54 +146,28 @@ const worker = defineComponent({ - -
+ +
{item && ( - - )} -
-
- - - -
- {item && ( - )}
- -
+
{item && ( - <> - - / - - + )}