diff --git a/plugins/dynamix.vm.manager/VMMachines.page b/plugins/dynamix.vm.manager/VMMachines.page index 1d92a0750..5ea3420b6 100644 --- a/plugins/dynamix.vm.manager/VMMachines.page +++ b/plugins/dynamix.vm.manager/VMMachines.page @@ -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:;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:;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} @@ -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'}); - $('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'); - $('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'}); - $('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'); - $('div.nav-item.LockButton').find('span').text("_(Unlock sortable items)_"); + $('div.nav-item.LockButton span').text("_(Unlock sortable items)_"); $('#kvm_list').sortable('destroy'); } } diff --git a/plugins/dynamix.vm.manager/include/VMMachines.php b/plugins/dynamix.vm.manager/include/VMMachines.php index 898e3c50c..de020e1ed 100644 --- a/plugins/dynamix.vm.manager/include/VMMachines.php +++ b/plugins/dynamix.vm.manager/include/VMMachines.php @@ -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 "" : "' style='display:none'>"); echo "
_(Name)__(Description)__(CPUs)__(Memory)__(vDisks)__(Graphics)__(Autostart)_
"; - echo ""; + echo "
"; echo ""; - echo ""; + echo ""; /* Display VM disks */ foreach ($lv->get_disk_stats($res) as $arrDisk) {
"._('Disk devices').""._('Serial').""._('Bus').""._('Capacity').""._('Allocation')."Boot Order