This commit is contained in:
Meliox 2025-01-06 14:43:54 +01:00
parent 8565bd05ee
commit d434ad9daf

View File

@ -188,16 +188,16 @@ function configure {
SENSORS_DETECTED=true SENSORS_DETECTED=true
fi fi
# Look for memory temps # Look for ram temps
msg "\nDetecting support for Memory temperature sensors..." msg "\nDetecting support for RAM temperature sensors..."
if (echo "$sensorsOutput" | grep -q '"SODIMM":'); then if (echo "$sensorsOutput" | grep -q '"SODIMM":'); then
msg "Detected Memory temperature sensors:\n$(echo "$sensorsOutput" | grep -o '"SODIMM[^"]*"' | sed 's/"//g')" msg "Detected RAM temperature sensors:\n$(echo "$sensorsOutput" | grep -o '"SODIMM[^"]*"' | sed 's/"//g')"
ENABLE_MEMORY_TEMP=true ENABLE_RAM_TEMP=true
SENSORS_DETECTED=true SENSORS_DETECTED=true
else else
warn "No Memory temperature sensors found." warn "No RAM temperature sensors found."
ENABLE_MEMORY_TEMP=false ENABLE_RAM_TEMP=false
fi fi
# Check if HDD/SSD data is installed # Check if HDD/SSD data is installed
@ -758,8 +758,8 @@ Ext.define('PVE.mod.TempHelper', {\n\
}" "$PVE_MANAGER_LIB_JS_FILE" }" "$PVE_MANAGER_LIB_JS_FILE"
fi fi
if [ $ENABLE_MEMORY_TEMP = true ]; then if [ $ENABLE_RAM_TEMP = true ]; then
# Add Memory temperature display # Add Ram temperature display
sed -i "/^Ext.define('PVE.node.StatusView',/ { sed -i "/^Ext.define('PVE.node.StatusView',/ {
:a; :a;
/items:/!{N;ba;} /items:/!{N;ba;}
@ -770,13 +770,13 @@ Ext.define('PVE.mod.TempHelper', {\n\
{\n\ {\n\
xtype: 'box',\n\ xtype: 'box',\n\
colspan: 2,\n\ colspan: 2,\n\
html: gettext('Cooling'),\n\ html: gettext('RAM'),\n\
},\n\ },\n\
{\n\ {\n\
itemId: 'thermalMemory',\n\ itemId: 'thermalRam',\n\
colspan: 2,\n\ colspan: 2,\n\
printBar: false,\n\ printBar: false,\n\
title: gettext('Memory Thermal State'),\n\ title: gettext('Ram Thermal State'),\n\
iconCls: 'fa fa-fw fa-thermometer-half',\n\ iconCls: 'fa fa-fw fa-thermometer-half',\n\
textField: 'sensorsOutput',\n\ textField: 'sensorsOutput',\n\
renderer: function(value) {\n\ renderer: function(value) {\n\
@ -806,42 +806,42 @@ Ext.define('PVE.mod.TempHelper', {\n\
objValue = {};\n\ objValue = {};\n\
}\n\ }\n\
\n\ \n\
// Recursive function to find memory keys and values\n\ // Recursive function to find ram keys and values\n\
function findMemoryKeys(obj, memoryKeys, parentKey = null) {\n\ function findRamKeys(obj, ramKeys, parentKey = null) {\n\
Object.keys(obj).forEach(key => {\n\ Object.keys(obj).forEach(key => {\n\
const value = obj[key];\n\ const value = obj[key];\n\
if (typeof value === 'object' && value !== null) {\n\ if (typeof value === 'object' && value !== null) {\n\
// If the value is an object, recursively call the function\n\ // If the value is an object, recursively call the function\n\
findMemoryKeys(value, memoryKeys, key);\n\ findRamKeys(value, ramKeys, key);\n\
} else if (/^temp\\\d+_input$/.test(key) && parentKey && parentKey.startsWith(\"SODIMM\")) {\n\ } else if (/^temp\\\d+_input$/.test(key) && parentKey && parentKey.startsWith(\"SODIMM\")) {\n\
if (value !== 0) {\n\ if (value !== 0) {\n\
memoryKeys.push({ key: parentKey, value: value});\n\ ramKeys.push({ key: parentKey, value: value});\n\
}\n\ }\n\
}\n\ }\n\
});\n\ });\n\
}\n\ }\n\
\n\ \n\
let memoryTemps = [];\n\ let ramTemps = [];\n\
// Loop through the parent keys\n\ // Loop through the parent keys\n\
Object.keys(objValue).forEach(parentKey => {\n\ Object.keys(objValue).forEach(parentKey => {\n\
const parentObj = objValue[parentKey];\n\ const parentObj = objValue[parentKey];\n\
// Array to store memory keys and values\n\ // Array to store ram keys and values\n\
const memoryKeys = [];\n\ const ramKeys = [];\n\
// Call the recursive function to find memory keys and values\n\ // Call the recursive function to find ram keys and values\n\
findMemoryKeys(parentObj, memoryKeys);\n\ findRamKeys(parentObj, ramKeys);\n\
// Sort the memoryKeys keys\n\ // Sort the ramKeys keys\n\
memoryKeys.sort();\n\ ramKeys.sort();\n\
// Process each memory key and value\n\ // Process each ram key and value\n\
memoryKeys.forEach(({ key: memoryKey, value: memoryTemp }) => {\n\ ramKeys.forEach(({ key: ramKey, value: ramTemp }) => {\n\
try {\n\ try {\n\
memory = memoryKey.replace('SODIMM', 'SODIMM ');\n\ ram = ramKey.replace('SODIMM', 'SODIMM ');\n\
memoryTemps.push(\`\${memory}:&nbsp\${memoryTemp}\${cpuTempHelper.getUnit()}\`);\n\ ramTemps.push(\`\${ram}:&nbsp\${ramTemp}\${cpuTempHelper.getUnit()}\`);\n\
} catch(e) {\n\ } catch(e) {\n\
console.error(\`Error retrieving Memory Temp for \${memoryTemps} in \${parentKey}:\`, e); // Debug: Log specific error\n\ console.error(\`Error retrieving Ram Temp for \${ramTemps} in \${parentKey}:\`, e); // Debug: Log specific error\n\
}\n\ }\n\
});\n\ });\n\
});\n\ });\n\
return '<div style=\"text-align: left; margin-left: 28px;\">' + (memoryTemps.length > 0 ? memoryTemps.join(' | ') : 'N/A') + '</div>';\n\ return '<div style=\"text-align: left; margin-left: 28px;\">' + (ramTemps.length > 0 ? ramTemps.join(' | ') : 'N/A') + '</div>';\n\
}\n\ }\n\
}, },
}" "$PVE_MANAGER_LIB_JS_FILE" }" "$PVE_MANAGER_LIB_JS_FILE"