first
This commit is contained in:
parent
678ae1081d
commit
34075feb96
@ -188,6 +188,18 @@ function configure {
|
|||||||
SENSORS_DETECTED=true
|
SENSORS_DETECTED=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Look for ram temps
|
||||||
|
msg "\nDetecting support for Ram temperature sensors..."
|
||||||
|
if (echo "$sensorsOutput" | grep -q '"SODIMM":'); then
|
||||||
|
msg "Detected Ram temperature sensors:\n$(echo "$sensorsOutput" | grep -o '"SODIMM[^"]*"' | sed 's/"//g')"
|
||||||
|
ENABLE_RAM_TEMP=true
|
||||||
|
SENSORS_DETECTED=true
|
||||||
|
|
||||||
|
else
|
||||||
|
warn "No Ram temperature sensors found."
|
||||||
|
ENABLE_RAM_TEMP=false
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if HDD/SSD data is installed
|
# Check if HDD/SSD data is installed
|
||||||
msg "\nDetecting support for HDD/SDD temperature sensors..."
|
msg "\nDetecting support for HDD/SDD temperature sensors..."
|
||||||
if (lsmod | grep -wq "drivetemp"); then
|
if (lsmod | grep -wq "drivetemp"); then
|
||||||
@ -746,6 +758,95 @@ Ext.define('PVE.mod.TempHelper', {\n\
|
|||||||
}" "$PVE_MANAGER_LIB_JS_FILE"
|
}" "$PVE_MANAGER_LIB_JS_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $ENABLE_RAM_TEMP = true ]; then
|
||||||
|
# Add Ram temperature display
|
||||||
|
sed -i "/^Ext.define('PVE.node.StatusView',/ {
|
||||||
|
:a;
|
||||||
|
/items:/!{N;ba;}
|
||||||
|
:b;
|
||||||
|
/'thermal.*},/!{N;bb;}
|
||||||
|
a\
|
||||||
|
\\
|
||||||
|
{\n\
|
||||||
|
xtype: 'box',\n\
|
||||||
|
colspan: 2,\n\
|
||||||
|
html: gettext('Cooling'),\n\
|
||||||
|
},\n\
|
||||||
|
{\n\
|
||||||
|
itemId: 'thermalMemory',\n\
|
||||||
|
colspan: 2,\n\
|
||||||
|
printBar: false,\n\
|
||||||
|
title: gettext('Memory Thermal State'),\n\
|
||||||
|
iconCls: 'fa fa-fw fa-thermometer-half',\n\
|
||||||
|
textField: 'sensorsOutput',\n\
|
||||||
|
renderer: function(value) {\n\
|
||||||
|
const cpuTempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS});\n\
|
||||||
|
// Make SODIMM unique keys\n\
|
||||||
|
value = value.split('\\\n'); // Split by newlines\n\
|
||||||
|
for (let i = 0; i < value.length; i++) {\n\
|
||||||
|
// Check if the current line contains 'SODIMM'\n\
|
||||||
|
if (value[i].includes('SODIMM') && i + 1 < value.length) {\n\
|
||||||
|
// Extract the number '3' following 'temp' from the next line (e.g., "temp3_input": 25.000)\n\
|
||||||
|
let nextLine = value[i + 1];\n\
|
||||||
|
let match = nextLine.match(/\"temp(\\\d+)_input\": (\\\d+\\\.\\\d+)/);\n\
|
||||||
|
\n\
|
||||||
|
if (match) {\n\
|
||||||
|
let number = match[1]; // Extracted number\n\
|
||||||
|
// Replace the current line with SODIMM by the extracted number\n\
|
||||||
|
value[i] = value[i].replace('SODIMM', \`SODIMM\${number}\`);\n\
|
||||||
|
}\n\
|
||||||
|
}\n\
|
||||||
|
}\n\
|
||||||
|
value = value.join('\\\n'); // Reverse line split\n\
|
||||||
|
\n\
|
||||||
|
let objValue;\n\
|
||||||
|
try {\n\
|
||||||
|
objValue = JSON.parse(value) || {};\n\
|
||||||
|
} catch(e) {\n\
|
||||||
|
objValue = {};\n\
|
||||||
|
}\n\
|
||||||
|
\n\
|
||||||
|
// Recursive function to find Ram keys and values\n\
|
||||||
|
function findMemoryKeys(obj, memoryKeys, parentKey = null) {\n\
|
||||||
|
Object.keys(obj).forEach(key => {\n\
|
||||||
|
const value = obj[key];\n\
|
||||||
|
if (typeof value === 'object' && value !== null) {\n\
|
||||||
|
// If the value is an object, recursively call the function\n\
|
||||||
|
findMemoryKeys(value, memoryKeys, key);\n\
|
||||||
|
} else if (/^temp\\\d+_input$/.test(key) && parentKey && parentKey.startsWith(\"SODIMM\")) {\n\
|
||||||
|
if (value !== 0) {\n\
|
||||||
|
memoryKeys.push({ key: parentKey, value: value});\n\
|
||||||
|
}\n\
|
||||||
|
}\n\
|
||||||
|
});\n\
|
||||||
|
}\n\
|
||||||
|
\n\
|
||||||
|
let memoryTemps = [];\n\
|
||||||
|
// Loop through the parent keys\n\
|
||||||
|
Object.keys(objValue).forEach(parentKey => {\n\
|
||||||
|
const parentObj = objValue[parentKey];\n\
|
||||||
|
// Array to store memory keys and values\n\
|
||||||
|
const memoryKeys = [];\n\
|
||||||
|
// Call the recursive function to find memory keys and values\n\
|
||||||
|
findMemoryKeys(parentObj, memoryKeys);\n\
|
||||||
|
// Sort the memoryKeys keys\n\
|
||||||
|
memoryKeys.sort();\n\
|
||||||
|
// Process each memory key and value\n\
|
||||||
|
memoryKeys.forEach(({ key: memoryKey, value: memoryTemp }) => {\n\
|
||||||
|
try {\n\
|
||||||
|
memory = memoryKey.replace('SODIMM', 'SODIMM ');\n\
|
||||||
|
memoryTemps.push(\`\${memory}: \${memoryTemp}\${cpuTempHelper.getUnit()}\`);\n\
|
||||||
|
} catch(e) {\n\
|
||||||
|
console.error(\`Error retrieving Memory Temp for \${memoryTemps} in \${parentKey}:\`, e); // Debug: Log specific error\n\
|
||||||
|
}\n\
|
||||||
|
});\n\
|
||||||
|
});\n\
|
||||||
|
return '<div style=\"text-align: left; margin-left: 28px;\">' + (memoryTemps.length > 0 ? memoryTemps.join(' | ') : 'N/A') + '</div>';\n\
|
||||||
|
}\n\
|
||||||
|
},
|
||||||
|
}" "$PVE_MANAGER_LIB_JS_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add an empty line to separate modified items as a visual group
|
# Add an empty line to separate modified items as a visual group
|
||||||
# NOTE: Check for the presence of items in the reverse order of display
|
# NOTE: Check for the presence of items in the reverse order of display
|
||||||
local lastItemId=""
|
local lastItemId=""
|
||||||
@ -913,4 +1014,4 @@ done
|
|||||||
# If no arguments were provided or all arguments have been processed, print the usage message
|
# If no arguments were provided or all arguments have been processed, print the usage message
|
||||||
if [[ $executed -eq 0 ]]; then
|
if [[ $executed -eq 0 ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user