diff --git a/emhttp/plugins/dynamix.vm.manager/VMMachines.page b/emhttp/plugins/dynamix.vm.manager/VMMachines.page
index 946ebe37e..91ba453cb 100644
--- a/emhttp/plugins/dynamix.vm.manager/VMMachines.page
+++ b/emhttp/plugins/dynamix.vm.manager/VMMachines.page
@@ -18,6 +18,7 @@ Markdown="false"
*/
?>
+$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
$cpus = cpu_list();
@@ -121,6 +122,7 @@ div.four label:nth-child(4n+4){float:none;clear:both}
div.four label.cpu1{width:32%}
div.four label.cpu2{width:26%}
div.template,div#dialogWindow,input#upload{display:none}
+div.template,div#dialogWindow2,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}
@@ -134,7 +136,7 @@ i.mover{margin-right:8px;display:none}
.dropdown-menu{z-index:10001}
-| _(Name)_ | _(Description)_ | _(CPUs)_ | _(Memory)_ | _(vDisks)_ | _(Graphics)_ | _(Autostart)_ |
+| _(Name)_ | _(Description)_ | _(CPUs)_ | _(Memory)_ | _(vDisks / vCDs)_ | _(Graphics)_ | _(Autostart)_ |
|
@@ -163,7 +165,54 @@ function resetSorting() {
function changemedia(uuid,dev,bus,file) {
if (file === "--select") getisoimage(uuid,dev,bus,file);
if (file === "--eject") ajaxVMDispatch({action:"change-media", uuid:uuid , cdrom:"" , dev:dev , bus:bus , file:file}, "loadlist");
+}
+function getisoimageboth(uuid,dev,bus,file,dev2,bus2,file2){
+ var root = = '"'.$domain_cfg["MEDIADIR"].'"';?>;
+ var match= ".iso";
+ var box = $("#dialogWindow");
+ box.html($("#templateISOboth").html());
+ box.find('#target').attr('data-pickroot',root).attr('data-picktop',root).attr('data-pickmatch',match).attr('value', file).fileTreeAttach(null,null,function(path){
+ var bits = path.substr(1).split('/');
+ var auto = bits.length>3 ? '' : share;
+ box.find('#target').val(path+auto).change();
+ });
+ box.find('#target2').attr('data-pickroot',root).attr('data-picktop',root).attr('data-pickmatch',match).attr('value', file2).fileTreeAttach(null,null,function(path){
+ var bits = path.substr(1).split('/');
+ var auto = bits.length>3 ? '' : share;
+ box.find('#target2').val(path+auto).change();
+ });
+ var height = 100;
+
+ box.dialog({
+ title: "Select ISOs for CDROMs",
+ resizable: false,
+ width: 600,
+ height: 300,
+ modal: true,
+ show: {effect:'fade', duration:250},
+ hide: {effect:'fade', duration:250},
+ buttons: {
+ "_(Update)_": function(){
+ var target = box.find('#target');
+ if (target.length) {
+ target = target.val();
+ } else target = '';
+ var target2 = box.find('#target2');
+ if (target2.length) {
+ target2 = target2.val();
+ } else target2 = '';
+ box.find('#target').prop('disabled',true);
+ box.find('#target2').prop('disabled',true);
+ ajaxVMDispatch({action:"change-media-both", uuid:uuid , cdrom:"" , dev:dev , bus:bus , file:target, dev2:dev2 , bus2:bus2 , file2:target2}, "loadlist");
+ box.dialog('close');
+ },
+ "_(Cancel)_": function(){
+ box.dialog('close');
+ }
+ }
+ });
+ dialogStyle();
}
function getisoimage(uuid,dev,bus,file){
var root = = '"'.$domain_cfg["MEDIADIR"].'"';?>;
@@ -251,8 +300,172 @@ function VMClone(uuid, name){
});
dialogStyle();
}
+
+
+function selectsnapshot(uuid, name ,snaps, opt, getlist,state){
+
+ 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) ;
+ 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');
+ }
+
+ document.getElementById("targetsnaprmv").checked = true ;
+ document.getElementById("targetsnaprmvmeta").checked = true ;
+ document.getElementById("targetsnapkeep").checked = true ;
+ document.getElementById("targetsnapfspc").checked = true ;
+
+ box.dialog({
+ title: "_("+optiontext+ ")_",
+ resizable: false,
+ width: 600,
+ height: 500,
+ 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;}
+ } else target = '';
+ var remove = 'yes'
+ var keep = 'yes'
+ var removemeta = 'yes'
+ var free = 'yes'
+ var desc = ''
+ box.find('#targetsnap').prop('disabled',true);
+ if (opt == "revert") {
+ var 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' ;
+ }
+ if (opt == "create") {
+ var x = box.find('#targetsnapfspc').prop('checked') ;
+ if (x) free = 'yes' ; else free = 'no' ;
+ var desc = box.find("#targetsnapdesc").prop('value') ;
+ }
+ ajaxVMDispatch({action:"snap-" + opt +'-external', uuid:uuid , snapshotname:target , remove:remove, free:free ,removemeta:removemeta ,keep:keep, desc:desc} , "loadlist");
+ box.dialog('close');
+ },
+ "_(Cancel)_": function(){
+ box.dialog('close');
+ }
+ }
+ });
+ dialogStyle();
+}
+
+function selectblock(uuid, name ,snaps, opt, getlist,state){
+
+ var root = = '"'.$domain_cfg["MEDIADIR"].'"';?>;
+ var match= ".iso";
+ var box = $("#dialogWindow2");
+ box.html($("#templateblock").html());
+ var height = 200;
+ const Capopt = opt.charAt(0).toUpperCase() + opt.slice(1) ;
+ var optiontext = Capopt + " Block Devices" ;
+ box.find('#VMName').html(name) ;
+ box.find('#targetsnap').val(snaps) ;
+ box.find('#targetsnapl').html(snaps) ;
+
+ getlist = true ;
+ if (getlist) {
+ var only = 1 ;
+ if (opt == "remove") only = 0;
+ $.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-list", uuid:uuid }, function(data) {
+ if (data.html) {
+ var targetbase = document.getElementById("targetblockbase") ;
+ htmlstrbase = ""
+ htmlstrtop = ""
+ $("select.targetblockbase").replaceWith(htmlstrbase) ;
+ $("select.targetblocktop").replaceWith(htmlstrtop) ;
+ }
+ },'json');
+ }
+
+ document.getElementById("targetsnaprmv").checked = true ;
+ document.getElementById("targetsnaprmvmeta").checked = true ;
+ document.getElementById("targetsnapkeep").checked = true ;
+ document.getElementById("targetsnapfspc").checked = true ;
+ if (opt== "pull") {
+ $('.toprow').hide();
+ $('.targetpivotrow').hide();
+ $('.targetdeleterow').hide();
+ } else {
+ $('.toprow').show();
+ $('.targetpivotrow').show();
+ $('.targetdeleterow').show();
+ }
+
+ box.dialog({
+ title: "_("+optiontext+ ")_",
+ resizable: false,
+ width: 600,
+ height: 500,
+ modal: true,
+ show: {effect:'fade', duration:250},
+ hide: {effect:'fade', duration:250},
+ buttons: {
+ _("Action")_: function(){
+ var target = box.find('#targetsnap');
+ if (target.length) {
+ target = target.val();
+ if (!target ) {errorTarget(); return;}
+ } else target = '';
+ var remove = 'yes'
+ var keep = 'yes'
+ var removemeta = 'yes'
+ var free = 'yes'
+ var delete_file = 'yes'
+ var pivot = 'yes'
+ var desc = ''
+ box.find('#targetsnap').prop('disabled',true);
+ if (opt == "create") {
+ var x = box.find('#targetsnapfspc').prop('checked') ;
+ if (x) free = 'yes' ; else free = 'no' ;
+ var desc = box.find("#targetsnapdesc").prop('value') ;
+ }
+ var targetbase = box.find("#targetblockbase").prop('value') ;
+ var targettop = box.find("#targetblocktop").prop('value') ;
+
+ x = box.find('#targetpivot').prop('checked') ;
+ if (x) pivot = 'yes' ; else pivot = 'no' ;
+ x = box.find('#targetdelete').prop('checked') ;
+ if (x) delete_file = 'yes' ; else delete_file = 'no' ;
+ Ajaxurl = "VMAjaxCall.php " + encodeURIComponent("/usr/local/emhttp/plugins/dynamix.vm.manager/include/VMajax.php&" + $.param({action:opt , name:name ,targetbase:targetbase, targettop:targettop , snapshotname:target , remove:remove, targetpivot:pivot ,removemeta:removemeta ,targetdelete:delete_file})) ;
+ openVMAction((Ajaxurl),"Block Commit", "dynamix.vm.manager", "loadlist") ;
+ box.dialog('close');
+ },
+ "_(Cancel)_": function(){
+ box.dialog('close');
+ }
+ }
+ });
+ dialogStyle();
+}
+
function dialogStyle() {
- $('.ui-dialog-titlebar-close').css({'background':'transparent','border':'none','font-size':'1.8rem','margin-top':'-14px','margin-right':'-18px'}).html('').prop('title') ;
+ $('.ui-dialog-titlebar-close').css({'background':'transparent','border':'none','font-size':'1.8rem','margin-top':'-14px','margin-right':'-18px'}).html('').prop('title');
$('.ui-dialog-title').css({'text-align':'center','width':'100%','font-size':'1.8rem'});
$('.ui-dialog-content').css({'padding-top':'15px','vertical-align':'bottom'});
$('.ui-button-text').css({'padding':'0px 5px'});
@@ -352,6 +565,13 @@ $(function() {
_(ISO Image)_:
:
+
+
+_(CD1 ISO Image)_:
+:
+_(CD2 ISO Image)_:
+:
+
@@ -391,4 +611,73 @@ _(ISO Image)_: