1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

feature #1711: Add SPICE button for the vm detailed view

This commit is contained in:
Daniel Molina 2014-12-09 15:24:12 +01:00
parent 77fbd6d4ec
commit 91906ce77f

View File

@ -20,6 +20,7 @@ var VM_HISTORY_LENGTH = 40;
// Only one vnc request is allowed
var vnc_lock = false;
var spice_lock = false;
function loadVNC(){
// Load supporting scripts
@ -539,6 +540,13 @@ var vm_actions = {
}
},
"VM.startspice" : {
type: "custom",
call: function(){
popUpSPICE();
}
},
"VM.startvnc_action" : {
type: "single",
call: OpenNebula.VM.startvnc,
@ -915,6 +923,12 @@ var vm_buttons = {
text: '<i class="fa fa-desktop" style="color: rgb(111, 111, 111)"/> '+tr("VNC"),
custom_classes: "only-right-info vnc-right-info",
tip: tr("VNC")
},
"VM.startspice" : {
type: "action",
text: '<i class="fa fa-desktop" style="color: rgb(111, 111, 111)"/> '+tr("SPICE"),
custom_classes: "only-right-info spice-right-info",
tip: tr("SPICE")
}
}
@ -1461,7 +1475,17 @@ function updateVMInfo(request,vm){
setPermissionsTable(vm_info,'');
// Enable / disable vnc button
$(".vnc-right-info").prop("disabled", !enableVnc(vm_info));
if (!enableVnc(vm_info)) {
$(".vnc-right-info").hide();
} else {
$(".vnc-right-info").show();
}
if (!enableSPICE(vm_info)) {
$(".spice-right-info").hide();
} else {
$(".spice-right-info").show();
}
}
function updateVMDisksInfo(request,vm){
@ -3103,6 +3127,19 @@ function popUpVnc(){
});
}
// Open vnc window
function popUpSPICE(){
$.each(getSelectedNodes(dataTable_vMachines), function(index, elem) {
if (!spice_lock) {
spice_lock = true
Sunstone.runAction("VM.startspice_action", elem);
} else {
notifyError(tr("SPICE Connection in progress"))
return false;
}
});
}
function vncCallback(request,response){
rfb = new RFB({'target': $D('VNC_canvas'),
'encrypt': config['user_config']['vnc_wss'] == "yes",