mirror of
https://github.com/unraid/webgui.git
synced 2026-04-29 14:29:24 -05:00
vm manager: consolidate vm icon content menu code
This commit is contained in:
@@ -159,21 +159,6 @@ if ($action) {
|
||||
$id = $lv->domain_get_id($res);
|
||||
$is_autostart = $lv->domain_get_autostart($res);
|
||||
$state = $lv->domain_state_translate($dom['state']);
|
||||
switch ($state) {
|
||||
case 'running':
|
||||
$shape = 'play';
|
||||
$status = 'started';
|
||||
break;
|
||||
case 'paused': //no break on purpose
|
||||
case 'pmsuspended':
|
||||
$shape = 'pause';
|
||||
$status = 'paused';
|
||||
break;
|
||||
default:
|
||||
$shape = 'square';
|
||||
$status = 'stopped';
|
||||
break;
|
||||
}
|
||||
if ($state == 'running') {
|
||||
$mem = $dom['memory'] / 1024;
|
||||
}else{
|
||||
@@ -218,14 +203,7 @@ if ($action) {
|
||||
|
||||
//Domain information
|
||||
echo "<tr style='background-color:".bcolor($i)."'>
|
||||
<td style=\"width: 48px; padding: 4px\">
|
||||
<div id=\"vm-" . htmlspecialchars($uuid) . "\" style=\"display:block; cursor:pointer\">
|
||||
<div style=\"position: relative; width: 48px; height: 48px; margin: 0px auto;\">
|
||||
<img src=\"" . $vmicon . "\" class=\"$status\" style=\"position: absolute; z-index: 1; top: 0; bottom: 0; left: 0; right: 0; width: 48px; height: 48px;\"/>
|
||||
<i class=\"fa iconstatus fa-$shape $status\" title='$status'></i>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td style=\"width: 48px; padding: 4px\">".renderVMContentIcon($uuid, $name, $vmicon, $state)."</td>
|
||||
<td><a href='#' onclick=\"return toggle_id('name$i');\" title='click for more VM info'>$name</a></td>
|
||||
<td>$desc</td>
|
||||
<td><a class='vcpu$i' style='cursor:pointer'>$vcpu</a></td>
|
||||
@@ -498,8 +476,12 @@ 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:27%}
|
||||
div.four label.cpu2{width:33%}
|
||||
div.Panel{float:unset;margin:4px;height:inherit;border:none;}
|
||||
div.Panel:hover{background-color:unset;}
|
||||
div.PanelText{display:none;}
|
||||
</style>
|
||||
|
||||
<script src="/plugins/dynamix.vm.manager/javascript/vmmanager.js"></script>
|
||||
<script>
|
||||
function vncOpen() {
|
||||
$.post('/plugins/dynamix.vm.manager/classes/vnc.php',{cmd:'open',root:'<?=$docroot?>',file:'<?=$docroot?>/plugins/dynamix.vm.manager/vncconnect.vnc'},function(data) {
|
||||
@@ -530,126 +512,6 @@ function hideInput(){
|
||||
$(this).siblings('span').click(showInput);
|
||||
}
|
||||
|
||||
function ajaxVMDispatch(currentstate, params){
|
||||
$.post("/plugins/dynamix.vm.manager/VMajax.php", params, function( data ) {
|
||||
if (data.error) {
|
||||
swal({title:"Execution error",text:data.error,type:"error"});
|
||||
} else {
|
||||
if (!data.state || currentstate != data.state) {
|
||||
location = window.location.href;
|
||||
}
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function addVMContext(name, uuid, template, state, vncurl, log){
|
||||
var opts = [{header: name, image: "/plugins/dynamix.vm.manager/images/dynamix.vm.manager.png"}];
|
||||
|
||||
var path = location.pathname;
|
||||
var x = path.indexOf("?");
|
||||
if (x!=-1) path = path.substring(0,x);
|
||||
|
||||
if (vncurl !== "") {
|
||||
opts.push({text: "VNC Remote", icon: "fa-desktop", action: function(e){ e.preventDefault(); window.open(vncurl, '_blank', 'scrollbars=yes,resizable=yes'); } });
|
||||
opts.push({divider: true});
|
||||
}
|
||||
|
||||
if (state == "running") {
|
||||
|
||||
opts.push({text: "Stop", icon: "fa-stop", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-stop", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Pause", icon: "fa-pause", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pause", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Restart", icon: "fa-refresh", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-restart", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Hibernate", icon: "fa-bed", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmsuspend", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "pmsuspended") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmwakeup", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "paused" || state == "unknown") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-resume", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "Start", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-start", uuid: uuid });
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
if (log !== "") {
|
||||
if (location.pathname.indexOf("/Dashboard") === 0) {
|
||||
opts.push({text: "Logs", icon: "fa-navicon", action: function(e){ e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1=' + log, 'Log for: ' + name, 600, 900); } });
|
||||
}
|
||||
}
|
||||
|
||||
if (state == "shutoff") {
|
||||
|
||||
opts.push({text: "Edit", icon: "fa-pencil", href: path+'/UpdateVM?uuid='+uuid });
|
||||
opts.push({text: "Edit XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
opts.push({text: "Remove VM", icon: "fa-minus", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Remove definition: "+name,type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-undefine",uuid:uuid});});
|
||||
}});
|
||||
|
||||
if (template != 'OpenELEC') {
|
||||
opts.push({text: "Remove VM + Disks", icon: "fa-trash", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Completely REMOVE "+name+" disk image and definition",type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-delete",uuid:uuid});});
|
||||
}});
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "View XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
}
|
||||
|
||||
context.attach('#vm-'+uuid, opts);
|
||||
}
|
||||
|
||||
<?if ($display['resize']):?>
|
||||
function resize(bind) {
|
||||
var width = [];
|
||||
|
||||
@@ -518,6 +518,36 @@
|
||||
return $abbreviation;
|
||||
}
|
||||
|
||||
function renderVMContentIcon($uuid, $name, $icon, $state) {
|
||||
switch ($state) {
|
||||
case 'running':
|
||||
$shape = 'play';
|
||||
$status = 'started';
|
||||
break;
|
||||
case 'paused': //no break on purpose
|
||||
case 'pmsuspended':
|
||||
$shape = 'pause';
|
||||
$status = 'paused';
|
||||
break;
|
||||
default:
|
||||
$shape = 'square';
|
||||
$status = 'stopped';
|
||||
break;
|
||||
}
|
||||
|
||||
return "<div class=\"Panel $status\">
|
||||
<div id=\"vm-".htmlspecialchars($uuid)."\" style=\"display:block; cursor:pointer\">
|
||||
<div style=\"position:relative; width:48px; height:48px; margin:0px auto;\">
|
||||
<img src=\"$icon\" class=\"$status\" style=\"position:absolute; z-index:1; top:0; bottom:0; left:0; right:0; width:48px; height:48px;\"/>
|
||||
<i class=\"fa iconstatus fa-$shape $status\" title=\"$status\"></i>
|
||||
</div>
|
||||
<div class=\"PanelText\">
|
||||
<span class=\"PanelText $status\">$name</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
}
|
||||
|
||||
function sanitizeVendor($strVendor) {
|
||||
// Specialized vendor name cleanup
|
||||
// e.g.: Advanced Micro Devices, Inc. [AMD/ATI] --> Advanced Micro Devices, Inc.
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
function ajaxVMDispatch(currentstate, params){
|
||||
$.post("/plugins/dynamix.vm.manager/VMajax.php", params, function( data ) {
|
||||
if (data.error) {
|
||||
swal({title:"Execution error",text:data.error,type:"error"});
|
||||
} else {
|
||||
if (!data.state || currentstate != data.state) {
|
||||
location = window.location.href;
|
||||
}
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function addVMContext(name, uuid, template, state, vncurl, log){
|
||||
var opts = [{header: name, image: "/plugins/dynamix.vm.manager/images/dynamix.vm.manager.png"}];
|
||||
|
||||
var path = location.pathname;
|
||||
var x = path.indexOf("?");
|
||||
if (x!=-1) path = path.substring(0,x);
|
||||
|
||||
if (vncurl !== "") {
|
||||
opts.push({text: "VNC Remote", icon: "fa-desktop", action: function(e){ e.preventDefault(); window.open(vncurl, '_blank', 'scrollbars=yes,resizable=yes'); } });
|
||||
opts.push({divider: true});
|
||||
}
|
||||
|
||||
if (state == "running") {
|
||||
|
||||
opts.push({text: "Stop", icon: "fa-stop", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-stop", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Pause", icon: "fa-pause", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pause", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Restart", icon: "fa-refresh", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-restart", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Hibernate", icon: "fa-bed", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmsuspend", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "pmsuspended") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmwakeup", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "paused" || state == "unknown") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-resume", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "Start", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-start", uuid: uuid });
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
if (log !== "") {
|
||||
opts.push({text: "Logs", icon: "fa-navicon", action: function(e){ e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1=' + log, 'Log for: ' + name, 600, 900); } });
|
||||
}
|
||||
|
||||
if (state == "shutoff") {
|
||||
|
||||
opts.push({text: "Edit", icon: "fa-pencil", href: path+'/UpdateVM?uuid='+uuid });
|
||||
opts.push({text: "Edit XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
opts.push({text: "Remove VM", icon: "fa-minus", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Remove definition: "+name,type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-undefine",uuid:uuid});});
|
||||
}});
|
||||
|
||||
if (template != 'OpenELEC') {
|
||||
opts.push({text: "Remove VM + Disks", icon: "fa-trash", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Completely REMOVE "+name+" disk image and definition",type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-delete",uuid:uuid});});
|
||||
}});
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "View XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
}
|
||||
|
||||
context.attach('#vm-'+uuid, opts);
|
||||
}
|
||||
@@ -21,8 +21,8 @@ img.paused{opacity:1.0;}
|
||||
.stopped{color:#EF3D47;}
|
||||
.update{color:#3300FF;}
|
||||
.show{display:block;}
|
||||
div.Panel{float:none;display:inline-block;margin:0 18px 15px 0;height:90px;overflow:hidden;vertical-align:top;width:94px;word-wrap:break-word;}
|
||||
div.Panel:hover{overflow:visible;z-index:10;}
|
||||
div.Panel{float:none;display:inline-block;margin:0 18px 15px 0;height:90px;overflow:hidden;vertical-align:top;width:94px;word-wrap:break-word;border:none;}
|
||||
div.Panel:hover{overflow:visible;z-index:10;background-color:unset;}
|
||||
#noapps{display:none;font-style:italic;font-size:16px;opacity:0.5;padding:5px;}
|
||||
.switch-button-label.off{color:inherit;}
|
||||
.switch-button-label.on{color:#009900;}
|
||||
@@ -106,24 +106,7 @@ foreach ($allVMs as $name) {
|
||||
$uuid = libvirt_domain_get_uuid_string($res);
|
||||
$dom = $lv->domain_get_info($res);
|
||||
$id = $lv->domain_get_id($res);
|
||||
|
||||
$state = $lv->domain_state_translate($dom['state']);
|
||||
switch ($state) {
|
||||
case 'running':
|
||||
$shape = 'play';
|
||||
$status = 'started';
|
||||
break;
|
||||
case 'paused': //no break on purpose
|
||||
case 'pmsuspended':
|
||||
$shape = 'pause';
|
||||
$status = 'paused';
|
||||
break;
|
||||
default:
|
||||
$shape = 'square';
|
||||
$status = 'stopped';
|
||||
break;
|
||||
}
|
||||
|
||||
$vncport = $lv->domain_get_vnc_port($res);
|
||||
$vnc = '';
|
||||
if ($vncport > 0) {
|
||||
@@ -144,18 +127,7 @@ foreach ($allVMs as $name) {
|
||||
|
||||
$vmicon = $lv->domain_get_icon_url($res);
|
||||
|
||||
print "
|
||||
<div class=\"Panel $status\">
|
||||
<div id='vm-" . htmlspecialchars($uuid) . "' style='display:block; cursor:pointer'>
|
||||
<div style=\"position:relative; width:48px; height:48px; margin:0px auto;\">
|
||||
<img src=\"" . $vmicon . "\" class=\"$status\" style=\"position:absolute; z-index:1; top:0; bottom:0; left:0; right:0; width:48px; height:48px;\"/>
|
||||
<i class=\"fa iconstatus fa-$shape $status\" title='$status'></i>
|
||||
</div>
|
||||
<div class=\"PanelText\">
|
||||
<span class=\"PanelText " . $status . "\">" . $name . "</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
echo renderVMContentIcon($uuid, $name, $vmicon, $state);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -163,128 +135,8 @@ foreach ($allVMs as $name) {
|
||||
</div>
|
||||
<script src="/webGui/javascript/jquery.switchbutton.js"></script>
|
||||
<script src="/plugins/dynamix.docker.manager/javascript/docker.js"></script>
|
||||
<script src="/plugins/dynamix.vm.manager/javascript/vmmanager.js"></script>
|
||||
<script>
|
||||
function ajaxVMDispatch(currentstate, params){
|
||||
$.post("/plugins/dynamix.vm.manager/VMajax.php", params, function( data ) {
|
||||
if (data.error) {
|
||||
swal({title:"Execution error",text:data.error,type:"error"});
|
||||
} else {
|
||||
if (!data.state || currentstate != data.state) {
|
||||
location = window.location.href;
|
||||
}
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
|
||||
function addVMContext(name, uuid, template, state, vncurl, log){
|
||||
var opts = [{header: name, image: "/plugins/dynamix.vm.manager/images/dynamix.vm.manager.png"}];
|
||||
|
||||
var path = location.pathname;
|
||||
var x = path.indexOf("?");
|
||||
if (x!=-1) path = path.substring(0,x);
|
||||
|
||||
if (vncurl !== "") {
|
||||
opts.push({text: "VNC Remote", icon: "fa-desktop", action: function(e){ e.preventDefault(); window.open(vncurl, '_blank', 'scrollbars=yes,resizable=yes'); } });
|
||||
opts.push({divider: true});
|
||||
}
|
||||
|
||||
if (state == "running") {
|
||||
|
||||
opts.push({text: "Stop", icon: "fa-stop", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-stop", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Pause", icon: "fa-pause", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pause", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Restart", icon: "fa-refresh", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-restart", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Hibernate", icon: "fa-bed", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmsuspend", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "pmsuspended") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-pmwakeup", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else if (state == "paused" || state == "unknown") {
|
||||
|
||||
opts.push({text: "Resume", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-resume", uuid: uuid });
|
||||
}});
|
||||
|
||||
opts.push({text: "Force Stop", icon: "fa-bomb", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-destroy", uuid: uuid });
|
||||
}});
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "Start", icon: "fa-play", action: function(e) {
|
||||
e.preventDefault();
|
||||
ajaxVMDispatch(state, { action: "domain-start", uuid: uuid });
|
||||
}});
|
||||
|
||||
}
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
if (log !== "") {
|
||||
if (location.pathname.indexOf("/Dashboard") === 0) {
|
||||
opts.push({text: "Logs", icon: "fa-navicon", action: function(e){ e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1=' + log.replace(/'/g, '\'\\\'\''), 'Log for: ' + name, 600, 900); } });
|
||||
}
|
||||
}
|
||||
|
||||
if (state == "shutoff") {
|
||||
|
||||
opts.push({text: "Edit", icon: "fa-pencil", href: path+'/UpdateVM?uuid='+uuid });
|
||||
opts.push({text: "Edit XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
opts.push({divider: true});
|
||||
|
||||
opts.push({text: "Remove VM", icon: "fa-minus", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Remove definition: "+name,type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-undefine",uuid:uuid});});
|
||||
}});
|
||||
|
||||
if (template != 'OpenELEC') {
|
||||
opts.push({text: "Remove VM + Disks", icon: "fa-trash", action: function(e) {
|
||||
e.preventDefault();
|
||||
swal({title:"Are you sure?",text:"Completely REMOVE "+name+" disk image and definition",type:"warning",showCancelButton:true},function(){ajaxVMDispatch(state,{action:"domain-delete",uuid:uuid});});
|
||||
}});
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
opts.push({text: "View XML", icon: "fa-code", href: path+'/UpdateVM?template=Custom&uuid='+uuid });
|
||||
|
||||
}
|
||||
|
||||
context.attach('#vm-'+uuid, opts);
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
if ($.cookie('dashapps_view_mode') == 'startedonly') {
|
||||
$('.Panel').not('.started').hide();
|
||||
|
||||
Reference in New Issue
Block a user