fix(node_info): hide GPU Details and GPU Fans when no GPU is present

Empty graphics payloads currently leave the labelled rows visible with
no content. Hide those widgets unless they can render at least one GPU.
This commit is contained in:
Evan 2026-08-21 19:47:12 +08:00
parent f754331c3a
commit bbfeb24983

View File

@ -391,6 +391,7 @@ Ext.define('PVE.node.StatusView', {
this.hide();
return '';
} else if (!gpuStats || !gpuStats.Graphics) {
this.hide();
return '';
}
@ -508,9 +509,12 @@ Ext.define('PVE.node.StatusView', {
}
html += '</table>';
return html.indexOf('<tr>') > 0
? '<div style="padding-left: 20px; box-sizing: border-box;">' + html + '</div>'
: '';
if (html.indexOf('<tr>') <= 0) {
this.hide();
return '';
}
this.show();
return '<div style="padding-left: 20px; box-sizing: border-box;">' + html + '</div>';
},
},
{
@ -865,6 +869,7 @@ Ext.define('PVE.node.StatusView', {
this.hide();
return '';
} else if (!gpuStats || !gpuStats.Graphics || !gpuStats.Graphics.NVIDIA) {
this.hide();
return '';
}
@ -892,8 +897,10 @@ Ext.define('PVE.node.StatusView', {
});
if (rows.length === 0) {
this.hide();
return '';
}
this.show();
return '<div style="padding-left: 20px; box-sizing: border-box;"><table style="width: 100%; border-collapse: collapse; table-layout: fixed;">' + rows.join('') + '</table></div>';
},