fix indentation

This commit is contained in:
Meliox 2023-06-28 23:40:55 +02:00
parent 6ff1b3b44c
commit 58d00533f9

View File

@ -176,37 +176,37 @@ function install_mod {
/thermal.*},/!{N;bb;} /thermal.*},/!{N;bb;}
a\ a\
\\ \\
{\n\ {\n\
itemId: 'thermal2',\n\ itemId: 'thermal2',\n\
colspan: 1,\n\ colspan: 1,\n\
printBar: false,\n\ printBar: false,\n\
title: gettext('NVME Thermal State'),\n\ title: gettext('NVME Thermal State'),\n\
iconCls: 'fa fa-fw fa-thermometer-half',\n\ iconCls: 'fa fa-fw fa-thermometer-half',\n\
textField: 'thermalstate',\n\ textField: 'thermalstate',\n\
renderer: function(value) {\n\ renderer: function(value) {\n\
// sensors configuration\n\ // sensors configuration\n\
const addressPrefix = \"nvme-pci-\";\n\ const addressPrefix = \"nvme-pci-\";\n\
const sensorName = \"Composite\";\n\ const sensorName = \"Composite\";\n\
const tempInputNo = 1;\n\ const tempInputNo = 1;\n\
// display configuration\n\ // display configuration\n\
const drivesPerRow = ${NVMEPerRow};\n\ const drivesPerRow = ${NVMEPerRow};\n\
objValue = JSON.parse(value);\n\ objValue = JSON.parse(value);\n\
nvmeKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort();\n\ nvmeKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort();\n\
let temps = [];\n\ let temps = [];\n\
nvmeKeys.forEach((nvmeKey, index) => {\n\ nvmeKeys.forEach((nvmeKey, index) => {\n\
try {\n\ try {\n\
Object.keys(objValue[nvmeKey][sensorName]).forEach((secondLevelKey) => {\n\ Object.keys(objValue[nvmeKey][sensorName]).forEach((secondLevelKey) => {\n\
if (secondLevelKey.includes('_input')) {\n\ if (secondLevelKey.includes('_input')) {\n\
let temp = objValue[nvmeKey][sensorName][secondLevelKey];\n\ let temp = objValue[nvmeKey][sensorName][secondLevelKey];\n\
temps.push(\`Drive \$\{index\}: \$\{temp\}°C\`);\n\ temps.push(\`Drive \$\{index\}: \$\{temp\}°C\`);\n\
}\n\ }\n\
})\n\ })\n\
} catch(e) { /*_*/ }\n\ } catch(e) { /*_*/ }\n\
});\n\ });\n\
result = temps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? ((index + 1) % drivesPerRow === 0 ? '<br>' : ' | ') : ''); });\n\ result = temps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? ((index + 1) % drivesPerRow === 0 ? '<br>' : ' | ') : ''); });\n\
return result.length > 0 ? result.join('') : 'N/A';\n\ return result.length > 0 ? result.join('') : 'N/A';\n\
\}\n\ \}\n\
}, },
}" $pvemanagerlib }" $pvemanagerlib
fi fi
@ -218,42 +218,42 @@ function install_mod {
/thermal2.*},/!{N;bb;} /thermal2.*},/!{N;bb;}
a\ a\
\\ \\
{\n\ {\n\
xtype: 'box',\n\ xtype: 'box',\n\
colspan: 1,\n\ colspan: 1,\n\
padding: '0 0 20 0',\n\ padding: '0 0 20 0',\n\
},\n\ },\n\
{\n\ {\n\
itemId: 'thermal3',\n\ itemId: 'thermal3',\n\
colspan: 1,\n\ colspan: 1,\n\
printBar: false,\n\ printBar: false,\n\
title: gettext('HDD/SSD Thermal State'),\n\ title: gettext('HDD/SSD Thermal State'),\n\
iconCls: 'fa fa-fw fa-thermometer-half',\n\ iconCls: 'fa fa-fw fa-thermometer-half',\n\
textField: 'thermalstate',\n\ textField: 'thermalstate',\n\
renderer: function(value) {\n\ renderer: function(value) {\n\
// sensors configuration\n\ // sensors configuration\n\
const addressPrefix = \"drivetemp-scsi-\";\n\ const addressPrefix = \"drivetemp-scsi-\";\n\
const sensorName = \"temp1\";\n\ const sensorName = \"temp1\";\n\
const tempInputNo = 1;\n\ const tempInputNo = 1;\n\
// display configuration\n\ // display configuration\n\
const drivesPerRow = ${HDDPerRow};\n\ const drivesPerRow = ${HDDPerRow};\n\
objValue = JSON.parse(value);\n\ objValue = JSON.parse(value);\n\
drvKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort();\n\ drvKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort();\n\
let temps = [];\n\ let temps = [];\n\
drvKeys .forEach((drvKey, index) => {\n\ drvKeys .forEach((drvKey, index) => {\n\
try {\n\ try {\n\
Object.keys(objValue[drvKey][sensorName]).forEach((secondLevelKey) => {\n\ Object.keys(objValue[drvKey][sensorName]).forEach((secondLevelKey) => {\n\
if (secondLevelKey.includes('_input')) {\n\ if (secondLevelKey.includes('_input')) {\n\
let temp = objValue[drvKey][sensorName][secondLevelKey];\n\ let temp = objValue[drvKey][sensorName][secondLevelKey];\n\
temps.push(\`Drive \$\{index\}: \$\{temp\}&deg;C\`);\n\ temps.push(\`Drive \$\{index\}: \$\{temp\}&deg;C\`);\n\
}\n\ }\n\
})\n\ })\n\
} catch(e) { /*_*/ }\n\ } catch(e) { /*_*/ }\n\
});\n\ });\n\
result = temps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? ((index + 1) % drivesPerRow === 0 ? '<br>' : ' | ') : ''); });\n\ result = temps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? ((index + 1) % drivesPerRow === 0 ? '<br>' : ' | ') : ''); });\n\
return result.length > 0 ? result.join('') : 'N/A';\n\ return result.length > 0 ? result.join('') : 'N/A';\n\
\}\n\ \}\n\
}, },
}" $pvemanagerlib }" $pvemanagerlib
fi fi