fixes
This commit is contained in:
parent
f91bad0aa3
commit
582ec30809
@ -576,16 +576,14 @@ Ext.define('PVE.node.StatusView', {
|
|||||||
itemId: 'thermalHdd',
|
itemId: 'thermalHdd',
|
||||||
colspan: 2,
|
colspan: 2,
|
||||||
printBar: false,
|
printBar: false,
|
||||||
title: gettext('HDD/SSD Thermal State'),
|
title: gettext('HDD/SSD Temperatures'),
|
||||||
iconCls: 'fa fa-fw fa-thermometer-half',
|
iconCls: 'fa fa-fw fa-thermometer-half',
|
||||||
textField: 'sensorsOutput',
|
textField: 'PveMod_JsonSensorInfo',
|
||||||
renderer: function(value) {
|
renderer: function(value) {
|
||||||
// sensors configuration
|
// sensors configuration
|
||||||
const addressPrefix = "drivetemp-scsi-";
|
const addressPrefix = "drivetemp-scsi-";
|
||||||
const sensorName = "temp1";
|
const sensorName = "temp1";
|
||||||
const tempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS});
|
const tempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS});
|
||||||
// display configuration
|
|
||||||
const itemsPerRow = 1;
|
|
||||||
// ---
|
// ---
|
||||||
let objValue;
|
let objValue;
|
||||||
try {
|
try {
|
||||||
@ -601,19 +599,19 @@ Ext.define('PVE.node.StatusView', {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
objValue = {};
|
objValue = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const drvKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }));
|
const drvKeys = Object.keys(objValue).filter(item => String(item).startsWith(addressPrefix)).sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }));
|
||||||
let temps = [];
|
let drvData = [];
|
||||||
drvKeys.forEach((drvKey, index) => {
|
drvKeys.forEach((drvKey) => {
|
||||||
try {
|
try {
|
||||||
|
const drv = objValue[drvKey];
|
||||||
let tempVal = NaN, tempMax = NaN, tempCrit = NaN;
|
let tempVal = NaN, tempMax = NaN, tempCrit = NaN;
|
||||||
Object.keys(objValue[drvKey][sensorName]).forEach((secondLevelKey) => {
|
Object.keys(drv[sensorName]).forEach((secondLevelKey) => {
|
||||||
if (secondLevelKey.endsWith('_input')) {
|
if (secondLevelKey.endsWith('_input')) {
|
||||||
tempVal = tempHelper.getTemp(parseFloat(objValue[drvKey][sensorName][secondLevelKey]));
|
tempVal = tempHelper.getTemp(parseFloat(drv[sensorName][secondLevelKey]));
|
||||||
} else if (secondLevelKey.endsWith('_max')) {
|
} else if (secondLevelKey.endsWith('_max')) {
|
||||||
tempMax = tempHelper.getTemp(parseFloat(objValue[drvKey][sensorName][secondLevelKey]));
|
tempMax = tempHelper.getTemp(parseFloat(drv[sensorName][secondLevelKey]));
|
||||||
} else if (secondLevelKey.endsWith('_crit')) {
|
} else if (secondLevelKey.endsWith('_crit')) {
|
||||||
tempCrit = tempHelper.getTemp(parseFloat(objValue[drvKey][sensorName][secondLevelKey]));
|
tempCrit = tempHelper.getTemp(parseFloat(drv[sensorName][secondLevelKey]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!isNaN(tempVal)) {
|
if (!isNaN(tempVal)) {
|
||||||
@ -624,13 +622,32 @@ Ext.define('PVE.node.StatusView', {
|
|||||||
if (!isNaN(tempCrit) && tempVal >= tempCrit) {
|
if (!isNaN(tempCrit) && tempVal >= tempCrit) {
|
||||||
tempStyle = 'color: red; font-weight: bold;';
|
tempStyle = 'color: red; font-weight: bold;';
|
||||||
}
|
}
|
||||||
const tempStr = `Drive ${index + 1}: <span style="${tempStyle}">${Ext.util.Format.number(tempVal, '0.0')}${tempHelper.getUnit()}</span>`;
|
drvData.push({
|
||||||
temps.push(tempStr);
|
model: drv['model'] || 'Unknown',
|
||||||
|
serial: drv['serial'] || '',
|
||||||
|
temp: tempVal,
|
||||||
|
tempStyle: tempStyle,
|
||||||
|
unit: tempHelper.getUnit()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch(e) { /*_*/ }
|
} catch(e) { /*_*/ }
|
||||||
});
|
});
|
||||||
const result = temps.map((strTemp, index, arr) => { return strTemp + (index + 1 < arr.length ? ((index + 1) % itemsPerRow === 0 ? '<br>' : ' | ') : ''); });
|
|
||||||
return '<div style="text-align: left; margin-left: 28px;">' + (result.length > 0 ? result.join('') : 'N/A') + '</div>';
|
if (drvData.length === 0) {
|
||||||
|
return 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
|
let html = '<table style="width: 100%; border-collapse: collapse; table-layout: fixed;">';
|
||||||
|
drvData.forEach((data) => {
|
||||||
|
let deviceName = data.model;
|
||||||
|
deviceName += ` (${data.serial})`;
|
||||||
|
html += '<tr>';
|
||||||
|
html += `<td style="padding: 2px 10px 2px 0; text-align: left; width: 30%; vertical-align: top; overflow-wrap: anywhere; word-break: break-word;">${deviceName}</td>`;
|
||||||
|
html += `<td style="padding: 2px 0 2px 10px; text-align: right; width: 70%; vertical-align: top; overflow-wrap: anywhere; word-break: break-word; white-space: normal;"><span style="${data.tempStyle}">${Ext.util.Format.number(data.temp, '0.0')}${data.unit}</span></td>`;
|
||||||
|
html += '</tr>';
|
||||||
|
});
|
||||||
|
html += '</table>';
|
||||||
|
return '<div style="padding-left: 20px; box-sizing: border-box;">' + html + '</div>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user