mirror of
https://github.com/unraid/webgui.git
synced 2026-02-05 16:39:01 -06:00
Add "reset sorting" to docker and VM list
This commit is contained in:
@@ -41,7 +41,7 @@ th.eight{width:8%}
|
||||
<div id="iframe-popup" style="display:none;-webkit-overflow-scrolling:touch;"></div>
|
||||
<span class="status" style="margin-top:-44px"><span><input type="checkbox" class="advancedview"></span></span>
|
||||
<table class="tablesorter shift" id="docker_containers">
|
||||
<thead><tr><th></th><th>Application</th><th>Version</th><th>Network</th><th>Port Mappings <small>(App to Host)</small></th><th>Volume Mappings <small>(App to Host)</small></th><th class="eight">Autostart</th><th class="five">Log</th><th class="five" style="text-align:right;padding-right:24px"><i class="fa fa-sort"></i></th></tr></thead>
|
||||
<thead><tr><th></th><th>Application</th><th>Version</th><th>Network</th><th>Port Mappings <small>(App to Host)</small></th><th>Volume Mappings <small>(App to Host)</small></th><th class="eight">Autostart</th><th class="five">Log</th><th class="five" style="text-align:right;padding-right:24px"><a href="#" style="cursor:hand" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-sort"></i></a></th></tr></thead>
|
||||
<tbody id="docker_list"><tr><td colspan='8' style='text-align:center;padding:24px'><i class='fa fa-circle-o-notch fa-spin fa-3x fa-fw'></i></td></tr></tbody>
|
||||
</table>
|
||||
<input type="button" onclick="addContainer()" value="Add Container" style="display:none">
|
||||
@@ -66,6 +66,10 @@ function resize(bind) {
|
||||
}
|
||||
}
|
||||
<?endif;?>
|
||||
function resetSorting() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
$.post('/plugins/dynamix.docker.manager/include/UserPrefs.php',{reset:true},function(){loadlist();});
|
||||
}
|
||||
function listview() {
|
||||
if ($.cookie('docker_listview_mode')=='basic') {
|
||||
$('.docker_readmore').readmore({maxHeight:32,moreLink:"<a href='#' style='text-align:center'><i class='fa fa-chevron-down'></i></a>",lessLink:"<a href='#' style='text-align:center'><i class='fa fa-chevron-up'></i></a>"});
|
||||
|
||||
@@ -18,19 +18,28 @@ require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
$autostart_file = $dockerManPaths['autostart-file'];
|
||||
$user_prefs = $dockerManPaths['user-prefs'];
|
||||
|
||||
$names = explode(';',$_POST['names']);
|
||||
$index = explode(';',$_POST['index']);
|
||||
$save = []; $i = 0;
|
||||
if (isset($_POST['reset'])) {
|
||||
@unlink($user_prefs);
|
||||
if (file_exists($autostart_file)) {
|
||||
$allAutoStart = file($autostart_file, FILE_IGNORE_NEW_LINES);
|
||||
natcasesort($allAutoStart);
|
||||
file_put_contents($autostart_file, implode(PHP_EOL, $allAutoStart).PHP_EOL);
|
||||
}
|
||||
} else {
|
||||
$names = explode(';',$_POST['names']);
|
||||
$index = explode(';',$_POST['index']);
|
||||
$save = []; $i = 0;
|
||||
|
||||
foreach ($names as $name) if ($name) $save[] = $index[$i++]."=\"".$name."\""; else $i++;
|
||||
file_put_contents($user_prefs, implode("\n",$save)."\n");
|
||||
foreach ($names as $name) if ($name) $save[] = $index[$i++]."=\"".$name."\""; else $i++;
|
||||
file_put_contents($user_prefs, implode("\n",$save)."\n");
|
||||
|
||||
// sort containers for start-up
|
||||
if (file_exists($autostart_file)) {
|
||||
$prefs = parse_ini_file($user_prefs); $sort = [];
|
||||
$allAutoStart = file($autostart_file, FILE_IGNORE_NEW_LINES);
|
||||
foreach ($allAutoStart as $ct) $sort[] = array_search($ct,$prefs) ?? 999;
|
||||
array_multisort($sort,SORT_NUMERIC,$allAutoStart);
|
||||
file_put_contents($autostart_file, implode(PHP_EOL, $allAutoStart).PHP_EOL);
|
||||
// sort containers for start-up
|
||||
if (file_exists($autostart_file)) {
|
||||
$prefs = parse_ini_file($user_prefs); $sort = [];
|
||||
$allAutoStart = file($autostart_file, FILE_IGNORE_NEW_LINES);
|
||||
foreach ($allAutoStart as $ct) $sort[] = array_search($ct,$prefs) ?? 999;
|
||||
array_multisort($sort,SORT_NUMERIC,$allAutoStart);
|
||||
file_put_contents($autostart_file, implode(PHP_EOL, $allAutoStart).PHP_EOL);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -111,7 +111,7 @@ div.PanelText{display:none;}
|
||||
th.five{width:5%}
|
||||
</style>
|
||||
<table class="tablesorter shift kvm" id="kvm_table">
|
||||
<thead><tr><th><i class="fa fa-th-list"></i></th><th>Name</th><th>Description</th><th>CPUs</th><th>Memory</th><th>vDisks</th><th>Graphics</th><th class="five">Autostart</th><th class="five" style="text-align:right;padding-right:24px"><i class="fa fa-sort"></i></th></tr></thead>
|
||||
<thead><tr><th><i class="fa fa-th-list"></i></th><th>Name</th><th>Description</th><th>CPUs</th><th>Memory</th><th>vDisks</th><th>Graphics</th><th class="five">Autostart</th><th class="five" style="text-align:right;padding-right:24px"><a href="#" style="cursor:hand" onclick="resetSorting()" title="Reset sorting"><i class="fa fa-sort"></i></a></th></tr></thead>
|
||||
<tbody id="kvm_list"><tr><td colspan='9' style='text-align:center;padding:24px'><i class='fa fa-circle-o-notch fa-spin fa-3x fa-fw'></i></td></tr></tbody>
|
||||
</table>
|
||||
<input type="button" onclick="addVM()" id="btnAddVM" value="Add VM" style="display:none">
|
||||
@@ -136,6 +136,10 @@ function resize(bind) {
|
||||
}
|
||||
}
|
||||
<?endif;?>
|
||||
function resetSorting() {
|
||||
$('input[type=button]').prop('disabled',true);
|
||||
$.post('/plugins/dynamix.vm.manager/include/UserPrefs.php',{reset:true},function(){loadlist();});
|
||||
}
|
||||
function loadlist() {
|
||||
$.get('/plugins/dynamix.vm.manager/include/VMMachines.php',function(d) {
|
||||
var data = d.split(/\0/);
|
||||
|
||||
@@ -12,12 +12,17 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$prefs = '/boot/config/plugins/dynamix.vm.manager';
|
||||
$names = explode(';',$_POST['names']);
|
||||
$index = explode(';',$_POST['index']);
|
||||
$save = []; $i = 0;
|
||||
$user_prefs = '/boot/config/plugins/dynamix.vm.manager/userprefs.cfg';
|
||||
|
||||
foreach ($names as $name) if ($name) $save[] = $index[$i++]."=\"".$name."\""; else $i++;
|
||||
if (!is_dir($prefs)) mkdir($prefs);
|
||||
file_put_contents("$prefs/userprefs.cfg", implode("\n",$save)."\n");
|
||||
if (isset($_POST['reset'])) {
|
||||
@unlink($user_prefs);
|
||||
} else {
|
||||
$names = explode(';',$_POST['names']);
|
||||
$index = explode(';',$_POST['index']);
|
||||
$save = []; $i = 0;
|
||||
|
||||
foreach ($names as $name) if ($name) $save[] = $index[$i++]."=\"".$name."\""; else $i++;
|
||||
if (!is_dir(dirname($user_prefs))) mkdir(dirname($user_prefs));
|
||||
file_put_contents($user_prefs, implode("\n",$save)."\n");
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user