mirror of
https://github.com/unraid/webgui.git
synced 2026-05-01 15:29:20 -05:00
Dashboard: fix PHP error (snapshot part)
This commit is contained in:
@@ -55,6 +55,7 @@ exec("sed -ri 's/^\.logLine\{color:#......;/.logLine{color:$fgcolor;/' $docroot/
|
||||
|
||||
exec("/etc/rc.d/rc.docker status >/dev/null",$dummy,$dockerd);
|
||||
exec("/etc/rc.d/rc.libvirt status >/dev/null",$dummy,$libvirtd);
|
||||
$domain_cfg = parse_ini_file("/boot/config/domain.cfg");
|
||||
$dockerd = $dockerd==0;
|
||||
$libvirtd = $libvirtd==0;
|
||||
$apcupsd = file_exists('/var/run/apcupsd.pid');
|
||||
@@ -816,30 +817,21 @@ if ($.cookie('port_select')!=null && !ports.includes($.cookie('port_select'))) $
|
||||
var port_select = $.cookie('port_select')||ports[0];
|
||||
|
||||
function selectsnapshot(uuid, name ,snaps, opt, getlist){
|
||||
|
||||
var root = <?= '"'.$domain_cfg["MEDIADIR"].'"';?>;
|
||||
var match= ".iso";
|
||||
var box = $("#dialogWindow2");
|
||||
box.html($("#templatesnapshot"+opt).html());
|
||||
var height = 200;
|
||||
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1) ;
|
||||
var optiontext = Capopt + " Snapshot" ;
|
||||
box.find('#VMName').html(name) ;
|
||||
box.find('#targetsnap').val(snaps) ;
|
||||
box.find('#targetsnapl').html(snaps) ;
|
||||
const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1);
|
||||
var optiontext = Capopt + " Snapshot";
|
||||
box.find('#VMName').html(name);
|
||||
box.find('#targetsnap').val(snaps);
|
||||
box.find('#targetsnapl').html(snaps);
|
||||
if (getlist) {
|
||||
var only = 1 ;
|
||||
if (opt == "remove") only = 0;
|
||||
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-images", uuid:uuid , snapshotname:snaps, only:only}, function(data) {
|
||||
if (data.html) {
|
||||
box.find('#targetsnapimages').html(data.html) ;
|
||||
}
|
||||
},'json');
|
||||
var only = (opt == "remove") ? 0 : 1;
|
||||
$.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-images", uuid:uuid, snapshotname:snaps, only:only}, function(data){if (data.html) box.find('#targetsnapimages').html(data.html);},'json');
|
||||
}
|
||||
|
||||
|
||||
document.getElementById("targetsnapfspc").checked = true ;
|
||||
|
||||
document.getElementById("targetsnapfspc").checked = true;
|
||||
box.dialog({
|
||||
title: "_("+optiontext+ ")_",
|
||||
resizable: false,
|
||||
@@ -848,34 +840,29 @@ function selectsnapshot(uuid, name ,snaps, opt, getlist){
|
||||
modal: true,
|
||||
show: {effect:'fade', duration:250},
|
||||
hide: {effect:'fade', duration:250},
|
||||
|
||||
buttons: {
|
||||
"_(Proceed)_": function(){
|
||||
var target = box.find('#targetsnap');
|
||||
if (target.length) {
|
||||
target = target.val();
|
||||
if (!target ) {errorTarget(); return;}
|
||||
if (!target) {errorTarget(); return;}
|
||||
} else target = '';
|
||||
var remove = 'yes'
|
||||
var keep = 'yes'
|
||||
var removemeta = 'yes'
|
||||
var free = 'yes'
|
||||
var desc = ''
|
||||
var remove = 'yes';
|
||||
var removemeta = 'yes';
|
||||
var keep = 'yes';
|
||||
var free = 'yes';
|
||||
var desc = '';
|
||||
box.find('#targetsnap').prop('disabled',true);
|
||||
if (opt == "revert") {
|
||||
const x = box.find('#targetsnaprmv').prop('checked') ;
|
||||
if (x) remove = 'yes' ; else remove = 'no' ;
|
||||
x = box.find('#targetsnaprmvmeta').prop('checked') ;
|
||||
if (x) removemeta = 'yes' ; else removemeta = 'no' ;
|
||||
x = box.find('#targetsnapkeep').prop('checked') ;
|
||||
if (x) keep = 'yes' ; else keep = 'no' ;
|
||||
remove = box.find('#targetsnaprmv').prop('checked') ? 'yes' : 'no';
|
||||
removemeta = box.find('#targetsnaprmvmeta').prop('checked') ? 'yes' : 'no';
|
||||
keep = box.find('#targetsnapkeep').prop('checked') ? 'yes' : 'no';
|
||||
}
|
||||
if (opt == "create") {
|
||||
const x = box.find('#targetsnapfspc').prop('checked') ;
|
||||
if (x) free = 'yes' ; else free = 'no' ;
|
||||
var desc = box.find("#targetsnapdesc").prop('value') ;
|
||||
if (opt == "create") {
|
||||
free = box.find('#targetsnapfspc').prop('checked') ? 'yes' : 'no';
|
||||
desc = box.find("#targetsnapdesc").prop('value');
|
||||
}
|
||||
ajaxVMDispatch({action:"snap-" + opt +'-external', uuid:uuid , snapshotname:target , remove:remove, free:free, desc:desc } , "loadlist");
|
||||
ajaxVMDispatch({action:"snap-" + opt +'-external', uuid:uuid, snapshotname:target, remove:remove, free:free, desc:desc}, "loadlist");
|
||||
box.dialog('close');
|
||||
},
|
||||
"_(Cancel)_": function(){
|
||||
|
||||
Reference in New Issue
Block a user