From 4dd52a8c8e9f03199c304b5753d145a238bd18d8 Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Fri, 17 May 2024 14:43:43 +0800 Subject: [PATCH] perf: reduce warnings caused by network connection failures (#252) --- .../src/components/content_value/ContentServerStatus.vue | 8 +++++--- frontend/src/stores/browser.js | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/content_value/ContentServerStatus.vue b/frontend/src/components/content_value/ContentServerStatus.vue index 68c06a9..b05dff6 100644 --- a/frontend/src/components/content_value/ContentServerStatus.vue +++ b/frontend/src/components/content_value/ContentServerStatus.vue @@ -80,9 +80,11 @@ const refreshInfo = async (force) => { } if (!isEmpty(props.server) && browserStore.isConnected(props.server)) { try { - const info = await browserStore.getServerInfo(props.server) - serverInfo.value = info - _updateChart(info) + const info = await browserStore.getServerInfo(props.server, true) + if (!isEmpty(info)) { + serverInfo.value = info + _updateChart(info) + } } finally { pageState.loading = false pageState.autoLoading = false diff --git a/frontend/src/stores/browser.js b/frontend/src/stores/browser.js index 837d112..59afe13 100644 --- a/frontend/src/stores/browser.js +++ b/frontend/src/stores/browser.js @@ -343,10 +343,11 @@ const useBrowserStore = defineStore('browser', { /** * - * @param server + * @param {string} server + * @param {boolean} mute * @returns {Promise<{}>} */ - async getServerInfo(server) { + async getServerInfo(server, mute) { try { const { success, data, msg } = await ServerInfo(server) if (success) { @@ -356,7 +357,7 @@ const useBrowserStore = defineStore('browser', { serverInst.stats = data } return data - } else if (!isEmpty(msg)) { + } else if (!isEmpty(msg) && mute !== true) { $message.warning(msg) } } finally {