VM: operation corrections

This commit is contained in:
bergware
2023-03-16 20:39:40 +01:00
parent b4e6f88002
commit e5376edfa2
2 changed files with 26 additions and 21 deletions

View File

@@ -120,20 +120,17 @@ 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%}
table.domdisk thead th:nth-child(1){width:76%;}
table.domdisk thead th:nth-child(2){width:8%;}
table.domdisk thead th:nth-child(3){width:8%;}
table.domdisk thead th:nth-child(3){width:8%;}
div.template,div#dialogWindow,input#upload{display:none}
table.domdisk thead tr th:nth-child(1){width:56%!important}
table.domdisk thead tr th:nth-child(n+2){width:8%!important}
table.domdisk thead tr th:nth-child(1){padding-left:72px}
table.domdisk tbody tr td:nth-child(1){padding-left:72px}
table.domdisk tbody tr:nth-child(even){background-color:transparent!important}
table.domdisk tbody tr:nth-child(4n-1){background-color:transparent!important}
.fileTree{background:<?=$bgcolor?>;width:500px;max-height:320px;overflow-y:scroll;overflow-x:hidden;position:absolute;z-index:100;display:none}
div.template,div#dialogWindow,input#upload{display:none}
i.mover{margin-right:8px;display:none}
.fileTree{background:<?=$bgcolor?>;width:500px;max-height:320px;overflow-y:scroll;overflow-x:hidden;position:absolute;z-index:100;display:none}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset button[disabled]{cursor:default;color:#808080;background:-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 0 no-repeat,-webkit-gradient(linear,left top,right top,from(#404040),to(#808080)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#404040),to(#404040)) 0 100% no-repeat,-webkit-gradient(linear,left bottom,left top,from(#808080),to(#808080)) 100% 100% no-repeat;background:linear-gradient(90deg,#404040 0,#808080) 0 0 no-repeat,linear-gradient(90deg,#404040 0,#808080) 0 100% no-repeat,linear-gradient(0deg,#404040 0,#404040) 0 100% no-repeat,linear-gradient(0deg,#808080 0,#808080) 100% 100% no-repeat;background-size:100% 2px,100% 2px,2px 100%,2px 100%}
.dropdown-menu{z-index:10001}
i.mover{margin-right:8px;display:none}
</style>
<table id="kvm_table" class="tablesorter four shift">
<thead><tr><th class="th1"><a href="#" style="cursor:hand;margin-left:12px;display:inline-block;width:32px" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-th-list"></i></a>_(Name)_</th><th class="th2">_(Description)_</th><th>_(CPUs)_</th><th>_(Memory)_</th><th>_(vDisks)_</th><th>_(Graphics)_</th><th class="th3">_(Autostart)_</th></tr></thead>
@@ -155,8 +152,7 @@ function resize(bind) {
var s = Math.max(window.innerHeight-340,330);
if (h>s || bind) {
$('#kvm_list').height(s);
$('#kvm_table tbody tr:first-child td').each(function(){width.push($(this).width());});
$('#kvm_table thead tr th').each(function(i){$(this).width(width[i]);});
$('#kvm_table thead tr th').each(function(){$(this).width($(this).width());});
if (!bind) $('#kvm_table thead,#kvm_table tbody').addClass('fixed');
}
}
@@ -215,6 +211,7 @@ function dialogStyle() {
$('.ui-button-text').css({'padding':'0px 5px'});
}
var sortableHelper = function(e,ui){
ui.next().hide();
ui.children().each(function(){$(this).width($(this).width());});
return ui;
};
@@ -222,26 +219,33 @@ function LockButton() {
if ($.cookie('lockbutton') == null) {
$.cookie('lockbutton','lockbutton');
$('i.mover').show();
$('#kvm_list .sortable').css({'cursor':'move'});
<?if ($themes1):?>
$('div.nav-item.LockButton').find('a').prop('title',"_(Lock sortable items)_");
$('div.nav-item.LockButton').find('b').removeClass('icon-u-lock red-text').addClass('icon-u-lock-open green-text');
$('div.nav-item.LockButton a').prop('title',"_(Lock sortable items)_");
$('div.nav-item.LockButton b').removeClass('icon-u-lock red-text').addClass('icon-u-lock-open green-text');
<?endif;?>
$('div.nav-item.LockButton').find('span').text("_(Lock sortable items)_");
$('#kvm_list').sortable({helper:sortableHelper,items:'tr.sortable',cursor:'move',axis:'y',containment:'parent',delay:100,opacity:0.5,zIndex:9999,forcePlaceholderSize:true,
$('div.nav-item.LockButton span').text("_(Lock sortable items)_");
$('#kvm_list').sortable({helper:sortableHelper,items:'.sortable',cursor:'grab',axis:'y',containment:'parent',delay:100,opacity:0.5,zIndex:9999,forcePlaceholderSize:true,
update:function(e,ui){
var row = $('#kvm_list').find('tr:first');
var names = ''; var index = '';
$('#kvm_list .sortable').each(function(){
var parent = $(this).attr('parent-id');
var child = $('tr[child-id="'+parent+'"]');
child.detach().insertAfter($(this));
});
var row = $('#kvm_list tr:first');
var names = '', index = '';
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});
}});
} else {
$.removeCookie('lockbutton');
$('i.mover').hide();
$('#kvm_list .sortable').css({'cursor':'default'});
<?if ($themes1):?>
$('div.nav-item.LockButton').find('a').prop('title',"_(Unlock sortable items)_");
$('div.nav-item.LockButton').find('b').removeClass('icon-u-lock-open green-text').addClass('icon-u-lock red-text');
$('div.nav-item.LockButton a').prop('title',"_(Unlock sortable items)_");
$('div.nav-item.LockButton b').removeClass('icon-u-lock-open green-text').addClass('icon-u-lock red-text');
<?endif;?>
$('div.nav-item.LockButton').find('span').text("_(Unlock sortable items)_");
$('div.nav-item.LockButton span').text("_(Unlock sortable items)_");
$('#kvm_list').sortable('destroy');
}
}

View File

@@ -29,8 +29,9 @@ if (empty($vms)) {
if (file_exists($user_prefs)) {
$prefs = @parse_ini_file($user_prefs) ?: [];
$sort = [];
foreach ($vms as $vm) $sort[] = array_search($vm,$prefs) ?: 999;
foreach ($vms as $vm) $sort[] = array_search($vm,$prefs);
array_multisort($sort,SORT_NUMERIC,$vms);
unset($sort);
} else {
natcasesort($vms);
}
@@ -134,9 +135,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='margin:0;padding:0'>";
echo "<table class='tablesorter domdisk' id='domdisk_table'>";
echo "<table class='tablesorter domdisk'>";
echo "<thead><tr><th><i class='fa fa-hdd-o'></i> <b>"._('Disk devices')."</b></th><th>"._('Serial')."</b></th><th>"._('Bus')."</th><th>"._('Capacity')."</th><th>"._('Allocation')."</th><th>Boot Order</th</tr></thead>";
echo "<tbody id='domdisk_list'>";
echo "<tbody>";
/* Display VM disks */
foreach ($lv->get_disk_stats($res) as $arrDisk) {