mirror of
https://github.com/unraid/webgui.git
synced 2026-03-20 20:02:44 -05:00
vm manager: re-style vm list elements
This commit is contained in:
@@ -129,8 +129,8 @@ if ($action) {
|
||||
<th class='header'>Description</th>
|
||||
<th class='header'>CPUs</th>
|
||||
<th class='header'>Memory</th>
|
||||
<th class='header'>Hard Drives</th>
|
||||
<th class='header'>VNC Port</th>
|
||||
<th class='header'>vDisks</th>
|
||||
<th class='header'>Graphics</th>
|
||||
<th class='header'>Autostart</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -158,12 +158,13 @@ if ($action) {
|
||||
$id = $lv->domain_get_id($res);
|
||||
$is_autostart = $lv->domain_get_autostart($res);
|
||||
$state = $lv->domain_state_translate($dom['state']);
|
||||
$arrConfig = domain_to_config($uuid);
|
||||
if ($state == 'running') {
|
||||
$mem = $dom['memory'] / 1024;
|
||||
}else{
|
||||
$mem = $lv->domain_get_memory($res)/1024;
|
||||
}
|
||||
$mem = number_format($mem, 0);
|
||||
$mem = round($mem).'M';
|
||||
$vcpu = $dom['nrVirtCpu'];
|
||||
$auto = $is_autostart ? 'checked="checked"':"";
|
||||
$template = $lv->_get_single_xpath_result($res, '//domain/metadata/*[local-name()=\'vmtemplate\']/@name');
|
||||
@@ -182,11 +183,23 @@ if ($action) {
|
||||
$vncport = $lv->domain_get_vnc_port($res);
|
||||
|
||||
$vnc = '';
|
||||
$graphics = '';
|
||||
if ($vncport > 0) {
|
||||
$wsport = $lv->domain_get_ws_port($res);
|
||||
$vnc = '/plugins/dynamix.vm.manager/vnc.html?autoconnect=true&host=' . $_SERVER['HTTP_HOST'] . '&port=' . $wsport . '&path=';
|
||||
} else {
|
||||
$vncport = ($vncport < 0) ? "auto" : "";
|
||||
$wsport = $lv->domain_get_ws_port($res);
|
||||
$vnc = '/plugins/dynamix.vm.manager/vnc.html?autoconnect=true&host=' . $_SERVER['HTTP_HOST'] . '&port=' . $wsport . '&path=';
|
||||
$graphics = 'VNC:'.$vncport;
|
||||
} else if ($vncport == -1) {
|
||||
$graphics = 'VNC:auto';
|
||||
} else if (!empty($arrConfig['gpu'])) {
|
||||
$arrValidGPUDevices = getValidGPUDevices();
|
||||
foreach($arrConfig['gpu'] as $arrGPU) {
|
||||
foreach($arrValidGPUDevices as $arrDev) {
|
||||
if ($arrGPU['id'] == $arrDev['id']) {
|
||||
$graphics .= $arrDev['name']."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$graphics = str_replace("\n", "<br>", trim($graphics));
|
||||
}
|
||||
|
||||
$bootdev = $lv->domain_get_boot_devices($res)[0];
|
||||
@@ -208,7 +221,7 @@ if ($action) {
|
||||
<td><a class='vcpu$i' style='cursor:pointer'>$vcpu</a></td>
|
||||
<td>$mem</td>
|
||||
<td title='$diskdesc'>$disks</td>
|
||||
<td>$vncport</td>
|
||||
<td>$graphics</td>
|
||||
<td><input class='autostart' type='checkbox' name='auto_$name' title='Toggle VM auostart' $auto uuid='$uuid'></td>";
|
||||
|
||||
echo "</tr>
|
||||
|
||||
@@ -1102,7 +1102,7 @@
|
||||
}
|
||||
unset($tmp);
|
||||
|
||||
return $this->format_size($ret, 2, $unit);
|
||||
return $this->format_size($ret, 0, $unit);
|
||||
}
|
||||
|
||||
function get_disk_count($domain) {
|
||||
@@ -1139,11 +1139,11 @@
|
||||
$unit = strtoupper($unit);
|
||||
|
||||
switch ($unit) {
|
||||
case 'T': return number_format($value / (float)1099511627776, $decimals).' TB';
|
||||
case 'G': return number_format($value / (float)(1 << 30), $decimals).' GB';
|
||||
case 'M': return number_format($value / (float)(1 << 20), $decimals).' MB';
|
||||
case 'K': return number_format($value / (float)(1 << 10), $decimals).' KB';
|
||||
case 'B': return $value.' B';
|
||||
case 'T': return number_format($value / (float)1099511627776, $decimals).'T';
|
||||
case 'G': return number_format($value / (float)(1 << 30), $decimals).'G';
|
||||
case 'M': return number_format($value / (float)(1 << 20), $decimals).'M';
|
||||
case 'K': return number_format($value / (float)(1 << 10), $decimals).'K';
|
||||
case 'B': return $value.'B';
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user