From 3e1b6c2ff661c8a2bc512b8bfba927828cc5ac41 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 23 Mar 2024 01:49:43 -0700 Subject: [PATCH] Revert non-fix changes --- docs/widgets/services/glances.md | 1 - src/utils/config/service-helpers.js | 2 - src/widgets/glances/metrics/cpu.jsx | 65 +--------------------------- src/widgets/glances/metrics/info.jsx | 10 ++--- 4 files changed, 6 insertions(+), 72 deletions(-) diff --git a/docs/widgets/services/glances.md b/docs/widgets/services/glances.md index 69676bc65..176892931 100644 --- a/docs/widgets/services/glances.md +++ b/docs/widgets/services/glances.md @@ -19,7 +19,6 @@ widget: password: pass # optional if auth enabled in Glances metric: cpu diskUnits: bytes # optional, bytes (default) or bbytes. Only applies to disk - tempUnits: imperial # optional, metric (default) or imperial. Only applies to cpu refreshInterval: 5000 # optional - in milliseconds, defaults to 1000 or more, depending on the metric pointsLimit: 15 # optional, defaults to 15 ``` diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 9fa733ba0..c4ca2a65b 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -398,7 +398,6 @@ export function cleanServiceGroups(groups) { metric, pointsLimit, diskUnits, - tempUnits, // glances, customapi, iframe refreshInterval, @@ -538,7 +537,6 @@ export function cleanServiceGroups(groups) { if (refreshInterval) cleanedService.widget.refreshInterval = refreshInterval; if (pointsLimit) cleanedService.widget.pointsLimit = pointsLimit; if (diskUnits) cleanedService.widget.diskUnits = diskUnits; - if (tempUnits) cleanedService.widget.tempUnits = tempUnits; } if (type === "mjpeg") { if (stream) cleanedService.widget.stream = stream; diff --git a/src/widgets/glances/metrics/cpu.jsx b/src/widgets/glances/metrics/cpu.jsx index 3e98efe0b..1f2824d3f 100644 --- a/src/widgets/glances/metrics/cpu.jsx +++ b/src/widgets/glances/metrics/cpu.jsx @@ -12,61 +12,6 @@ const Chart = dynamic(() => import("../components/chart"), { ssr: false }); const defaultPointsLimit = 15; const defaultInterval = 1000; -const cpuSensorLabels = ["cpu_thermal", "Core", "Tctl"]; - -function convertToFahrenheit(t) { - return (t * 9) / 5 + 32; -} - -function TEMP({ sensorData, tempUnits = "metric" }) { - const { t } = useTranslation(); - const unit = tempUnits === "imperial" ? "fahrenheit" : "celsius"; - let mainTemp = 0; - let maxTemp = 80; - const cpuSensors = sensorData?.filter( - (s) => cpuSensorLabels.some((label) => s.label.startsWith(label)) && s.type === "temperature_core", - ); - - if (cpuSensors) { - try { - mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length; - maxTemp = Math.max( - cpuSensors.reduce((acc, s) => acc + (s.warning > 0 ? s.warning : 0), 0) / cpuSensors.length, - maxTemp, - ); - if (unit === "fahrenheit") { - mainTemp = convertToFahrenheit(mainTemp); - maxTemp = convertToFahrenheit(maxTemp); - } - } catch (e) { - // cpu sensor retrieval failed - } - } - - return ( - mainTemp > 0 && ( -