mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 00:09:27 -05:00
Docker and VM list updates
This commit is contained in:
@@ -98,21 +98,18 @@ if (empty($vms)) {
|
||||
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
|
||||
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
|
||||
<style type="text/css">
|
||||
body{-webkit-overflow-scrolling:touch;}
|
||||
.fileTree{width:300px;max-height:150px;overflow-y:scroll;position:absolute;z-index:100;display:none;}
|
||||
.fileTree{width:300px;max-height:150px;overflow-y:scroll;position:absolute;z-index:100;display:none}
|
||||
div.four{font-size:1.1rem;width:300px}
|
||||
div.four label{float:left;display:table-cell;width:25%}
|
||||
div.four label:nth-child(4n+4){float:none;clear:both}
|
||||
div.four label.cpu1{width:32%}
|
||||
div.four label.cpu2{width:26%}
|
||||
div.Panel{float:unset;margin:4px;height:inherit;border:none;}
|
||||
div.Panel:hover{background-color:unset;}
|
||||
div.PanelText{display:none;}
|
||||
th.five{width:6%}
|
||||
tbody > tr.sortable:hover{cursor:move}
|
||||
th.six{width:6%}
|
||||
tbody>tr.sortable:hover{cursor:move}
|
||||
table.domdisk tbody tr:nth-child(even){background-color:transparent}
|
||||
</style>
|
||||
<table id="kvm_table" class="tablesorter four shift">
|
||||
<thead><tr><th><a href="#" style="cursor:hand;margin-left:12px" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-th-list"></i></a></th><th>Name</th><th>Description</th><th>CPUs</th><th>Memory</th><th>vDisks</th><th>Graphics</th><th class="five">Autostart</th></tr></thead>
|
||||
<thead><tr><th><a href="#" style="cursor:hand;margin-left:12px" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-th-list"></i></a></th><th>Description</th><th>CPUs</th><th>Memory</th><th>vDisks</th><th>Graphics</th><th class="six">Autostart</th></tr></thead>
|
||||
<tbody id="kvm_list"><tr><td colspan='8'><div class="spinner"></div></td></tr></tbody>
|
||||
</table>
|
||||
<input type="button" onclick="addVM()" id="btnAddVM" value="Add VM" style="display:none">
|
||||
@@ -158,7 +155,7 @@ function loadlist() {
|
||||
});
|
||||
var row = $('#kvm_list').find('tr:first');
|
||||
var names = ''; var index = '';
|
||||
row.parent().children().find('td.vm-name').each(function(){names+=$(this).text()+';';index+=$(this).parent().parent().children().index($(this).parent())+';';});
|
||||
row.parent().children().find('td.vm-name').each(function(){names+=$(this).find('a').text()+';';index+=$(this).parent().parent().children().index($(this).parent())+';';});
|
||||
$.post('/plugins/dynamix.vm.manager/include/UserPrefs.php',{names:names,index:index});
|
||||
}});
|
||||
$('head').append('<script>'+data[1]+'<\/script>');
|
||||
|
||||
@@ -42,7 +42,8 @@ foreach ($vms as $vm) {
|
||||
$id = $lv->domain_get_id($res) ?: '-';
|
||||
$is_autostart = $lv->domain_get_autostart($res);
|
||||
$state = $lv->domain_state_translate($dom['state']);
|
||||
$vmicon = $lv->domain_get_icon_url($res);
|
||||
$icon = $lv->domain_get_icon_url($res);
|
||||
$image = substr($icon,-4)=='.png' ? "<img src='$icon' class='img'>" : (substr($icon,0,5)=='icon-' ? "<i class='$icon img'></i>" : "<i class='fa fa-$icon img'></i>");
|
||||
$arrConfig = domain_to_config($uuid);
|
||||
if ($state == 'running') {
|
||||
$mem = $dom['memory'] / 1024;
|
||||
@@ -81,11 +82,28 @@ foreach ($vms as $vm) {
|
||||
unset($dom);
|
||||
$menu[] = sprintf("addVMContext('%s','%s','%s','%s','%s','%s');", addslashes($vm),addslashes($uuid),addslashes($template),$state,addslashes($vnc),addslashes($log));
|
||||
$kvm[] = "kvm.push({id:'$uuid',state:'$state'});";
|
||||
switch ($state) {
|
||||
case 'running':
|
||||
$shape = 'play';
|
||||
$status = 'started';
|
||||
$color = 'green-text';
|
||||
break;
|
||||
case 'paused':
|
||||
case 'pmsuspended':
|
||||
$shape = 'pause';
|
||||
$status = 'paused';
|
||||
$color = 'orange-text';
|
||||
break;
|
||||
default:
|
||||
$shape = 'square';
|
||||
$status = 'stopped';
|
||||
$color = 'red-text';
|
||||
break;
|
||||
}
|
||||
|
||||
/* VM information */
|
||||
echo "<tr parent-id='$i' class='sortable'>";
|
||||
echo "<td style='width:48px;padding:4px'>".renderVMContentIcon($uuid, $vm, $vmicon, $state)."</td>";
|
||||
echo "<td class='vm-name'><a href='#' onclick='return toggle_id(\"name-$i\")' title='click for more VM info'>$vm</a></td>";
|
||||
echo "<tr parent-id='$i' class='sortable'><td class='vm-name' style='width:220px;padding:8px'>";
|
||||
echo "<span class='outer'><span id='vm-$uuid'>$image</span><span class='inner'><a href='#' onclick='return toggle_id(\"name-$i\")' title='click for more VM info'>$vm</a><br><i class='fa fa-$shape $status $color'></i><span class='state'>$status</span></span></span></td>";
|
||||
echo "<td>$desc</td>";
|
||||
echo "<td><a class='vcpu-$uuid' style='cursor:pointer'>$vcpu</a></td>";
|
||||
echo "<td>$mem</td>";
|
||||
@@ -95,9 +113,9 @@ foreach ($vms as $vm) {
|
||||
|
||||
/* Disk device information */
|
||||
echo "<tr child-id='$i' id='name-$i".(in_array('name-'.$i++,$show) ? "'>" : "' style='display:none'>");
|
||||
echo "<td colspan='8' style='overflow:hidden'>";
|
||||
echo "<td colspan='7' style='overflow:hidden'>";
|
||||
echo "<table class='tablesorter domdisk' id='domdisk_table'>";
|
||||
echo "<thead><tr><th><i class='fa fa-hdd-o'></i><b> Disk devices </b></th><th>Bus</th><th>Capacity</th><th>Allocation</th></tr></thead>";
|
||||
echo "<thead><tr><th><i class='fa fa-hdd-o'></i> <b>Disk devices</b></th><th>Bus</th><th>Capacity</th><th>Allocation</th></tr></thead>";
|
||||
echo "<tbody id='domdisk_list'>";
|
||||
|
||||
/* Display VM disks */
|
||||
|
||||
@@ -487,20 +487,6 @@
|
||||
$maxmem = number_format(($arrHostInfo['memory'] / 1048576), 1, '.', ' ');
|
||||
}
|
||||
|
||||
//set color on even rows for white or black theme
|
||||
function bcolor($row) {
|
||||
global $display;
|
||||
|
||||
if ($display['theme']=='gray')
|
||||
return "transparent";
|
||||
elseif ($display['theme']=='azure')
|
||||
return "transparent";
|
||||
elseif ($display['theme']=='black')
|
||||
return ($row % 2 == 0) ? "transparent":"#212121";
|
||||
else
|
||||
return ($row % 2 == 0) ? "transparent":"#ededed";
|
||||
}
|
||||
|
||||
function mk_dropdown_options($arrOptions, $strSelected) {
|
||||
foreach ($arrOptions as $key => $label) {
|
||||
echo mk_option($strSelected, $key, $label);
|
||||
@@ -519,30 +505,6 @@
|
||||
return $abbreviation;
|
||||
}
|
||||
|
||||
function renderVMContentIcon($uuid, $name, $icon, $state, $text=false) {
|
||||
switch ($state) {
|
||||
case 'running':
|
||||
$shape = 'play';
|
||||
$status = 'started';
|
||||
break;
|
||||
case 'paused': //no break on purpose
|
||||
case 'pmsuspended':
|
||||
$shape = 'pause';
|
||||
$status = 'paused';
|
||||
break;
|
||||
default:
|
||||
$shape = 'square';
|
||||
$status = 'stopped';
|
||||
break;
|
||||
}
|
||||
|
||||
return "<div id=\"vm-".htmlspecialchars($uuid)."\" class=\"Panel $status\" style=\"cursor:pointer\">
|
||||
<div style=\"display:block\"><div style=\"position:relative; width:48px; height:48px; margin:0px auto;\">
|
||||
<img src=\"$icon\" class=\"$status\" style=\"position:absolute; z-index:1; top:0; bottom:0; left:0; right:0; width:48px; height:48px;\"/>
|
||||
<i class=\"fa iconstatus fa-$shape $status\" title=\"$status\"></i>
|
||||
</div></div>".($text?"<div class=\"PanelText\"><span class=\"PanelText $status\">$name</span></div>":"")."</div>";
|
||||
}
|
||||
|
||||
function sanitizeVendor($strVendor) {
|
||||
// Specialized vendor name cleanup
|
||||
// e.g.: Advanced Micro Devices, Inc. [AMD/ATI] --> Advanced Micro Devices, Inc.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function ajaxVMDispatch(params, spin){
|
||||
if (spin) $('#vm-'+params['uuid']).find('i').removeClass('fa-play fa-square fa-pause').addClass('fa-refresh fa-spin');
|
||||
if (spin) $('#vm-'+params['uuid']).parent().find('i').removeClass('fa-play fa-square fa-pause').addClass('fa-refresh fa-spin');
|
||||
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", params, function(data) {
|
||||
if (data.error) {
|
||||
swal({
|
||||
|
||||
Reference in New Issue
Block a user