From 0e898a822742dd32f3b34ef931d76151f3ed87a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Mon, 25 Mar 2024 16:01:54 -0300 Subject: [PATCH] core: frontend: components: SystemCondition: Improve temperature code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API can return CPU or cpu_thermal temp1. To avoid that we are just going to match with cpu. Signed-off-by: Patrick José Pereira --- .../components/system-information/SystemCondition.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/frontend/src/components/system-information/SystemCondition.vue b/core/frontend/src/components/system-information/SystemCondition.vue index 36bb3bbc3..f2c490286 100644 --- a/core/frontend/src/components/system-information/SystemCondition.vue +++ b/core/frontend/src/components/system-information/SystemCondition.vue @@ -107,17 +107,17 @@ export default Vue.extend({ } }, temperature(): Record { - // Temperature data const temperature_sensors = system_information.system?.temperature - const main_sensor = temperature_sensors?.find((sensor) => sensor.name === 'CPU') - const main_temperature = main_sensor ? main_sensor.temperature.toFixed(1) : 'Loading..' - const temperature_text = temperature_sensors ? temperature_sensors.map( + const main_sensor = temperature_sensors?.find((sensor) => sensor.name.toLowerCase().includes('cpu')) + const main_temperature = main_sensor?.temperature.toFixed(1) ?? 'Loading..' + console.log(`main_temperature: ${main_temperature}`) + const temperature_text = temperature_sensors?.map( (sensor) => { const critical_temp = sensor.critical_temperature || 0 return `${sensor.name} ${sensor.temperature.toFixed(1)}ºC` + `, Max: ${sensor.maximum_temperature.toFixed(1)}ºC, Crit: ${critical_temp.toFixed(1)}ºC` }, - ).join('
') : 'Loading..' + ).join('
') ?? 'Loading..' return { name: 'Temperature',