mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 11:19:25 -05:00
Minor code optimization in VMMachine page
This commit is contained in:
@@ -25,16 +25,17 @@ exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu', $cp
|
||||
function showCPUs($uuid) {
|
||||
global $cpus;
|
||||
$vm = domain_to_config($uuid);
|
||||
$vcpu = $vm['domain']['vcpu'];
|
||||
echo "<div class='four'>";
|
||||
foreach ($cpus as $pair) {
|
||||
unset($cpu1,$cpu2);
|
||||
list($cpu1, $cpu2) = preg_split('/[,-]/',$pair);
|
||||
$check = in_array($cpu1, $vm['domain']['vcpu']) ? 'fa-check-square-o':'fa-square-o';
|
||||
$check = in_array($cpu1, $vcpu) ? 'fa-check-square-o':'fa-square-o';
|
||||
if (!$cpu2) {
|
||||
echo "<label><i class='$check'></i> cpu $cpu1</label>";
|
||||
} else {
|
||||
echo "<label class='cpu1'><i class='fa fa-fw $check'></i> cpu $cpu1 / $cpu2</label>";
|
||||
$check = in_array($cpu2, $vm['domain']['vcpu']) ? 'fa-check-square-o':'fa-square-o';
|
||||
$check = in_array($cpu2, $vcpu) ? 'fa-check-square-o':'fa-square-o';
|
||||
echo "<label class='cpu2'><i class='fa fa-fw $check'></i></label>";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user