mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
M #~: Fix remote actions state (#810)
This commit is contained in:
parent
024ee70a11
commit
dc999c347b
@ -233,13 +233,13 @@ define(function(require) {
|
||||
type: "action",
|
||||
text: Locale.tr("GUAC SSH"),
|
||||
layout: "vmsremote_buttons",
|
||||
custom_classes: "only-sunstone-info ssh-sunstone-info"
|
||||
custom_classes: "only-sunstone-info ssh-sunstone-info guac-button"
|
||||
},
|
||||
"VM.guac_rdp" : {
|
||||
type: "action",
|
||||
text: Locale.tr("GUAC RDP"),
|
||||
layout: "vmsremote_buttons",
|
||||
custom_classes: "only-sunstone-info rdp-sunstone-info"
|
||||
custom_classes: "only-sunstone-info rdp-sunstone-info guac-button"
|
||||
},
|
||||
"VM.save_rdp" : {
|
||||
type: "action",
|
||||
|
@ -20,7 +20,8 @@ define(function(require) {
|
||||
*/
|
||||
|
||||
var OpenNebulaVM = require('opennebula/vm');
|
||||
var StateActions = require('../utils/state-actions');
|
||||
var StateActions = require('tabs/vms-tab/utils/state-actions');
|
||||
var FireedgeValidator = require('utils/fireedge-validator');
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -43,6 +44,7 @@ define(function(require) {
|
||||
|
||||
var isVNCSupported = Boolean(OpenNebulaVM.isVNCSupported(element)),
|
||||
isSPICESupported = Boolean(OpenNebulaVM.isSPICESupported(element)),
|
||||
isWMRCSupported = Boolean(OpenNebulaVM.isVMRCSupported(element)),
|
||||
isWFileSupported = Boolean(OpenNebulaVM.isWFileSupported(element)),
|
||||
isRDPSupported = Boolean(OpenNebulaVM.isConnectionSupported(element, 'rdp')),
|
||||
isSSHSupported = Boolean(OpenNebulaVM.isConnectionSupported(element, 'ssh'));
|
||||
@ -51,10 +53,29 @@ define(function(require) {
|
||||
var allDisabled = (
|
||||
!isVNCSupported &&
|
||||
!isSPICESupported &&
|
||||
!isWMRCSupported &&
|
||||
!isWFileSupported &&
|
||||
!isRDPSupported &&
|
||||
!isSSHSupported
|
||||
);
|
||||
|
||||
var vncAndSpiceController = function() {
|
||||
if (isVNCSupported) {
|
||||
$(".vnc-sunstone-info").show();
|
||||
$(".spice-sunstone-info").hide();
|
||||
|
||||
}
|
||||
else if (isSPICESupported) {
|
||||
$(".spice-sunstone-info").show();
|
||||
$(".vnc-sunstone-info").hide();
|
||||
}
|
||||
else {
|
||||
$(".spice-sunstone-info").hide();
|
||||
$(".vnc-sunstone-info").hide();
|
||||
}
|
||||
}
|
||||
|
||||
vncAndSpiceController();
|
||||
|
||||
$("#vmsremote_buttons").toggle(!allDisabled);
|
||||
|
||||
@ -91,8 +112,32 @@ define(function(require) {
|
||||
{
|
||||
$(".vnc-sunstone-info").hide();
|
||||
}
|
||||
|
||||
var show_noVNC_buttons = function() {
|
||||
vncAndSpiceController();
|
||||
$(".guac-button").hide();
|
||||
$(".vmrc-button").hide();
|
||||
}
|
||||
|
||||
var show_fireedge_buttons = function() {
|
||||
$(".vnc-button").hide();
|
||||
$(".vmrc-button").toggle(isWMRCSupported);
|
||||
$(".guac-button").toggle(!isWMRCSupported);
|
||||
}
|
||||
|
||||
var show_buttons = function(fireedgeToken) {
|
||||
if (fireedgeToken != "") {
|
||||
show_fireedge_buttons();
|
||||
}
|
||||
else{
|
||||
show_noVNC_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
FireedgeValidator.validateFireedgeToken(show_buttons, show_noVNC_buttons);
|
||||
}
|
||||
|
||||
|
||||
function _post(info, contextTabId) {
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ define(function(require) {
|
||||
var TemplateTableVcenter = require("utils/panel/template-table");
|
||||
var OpenNebula = require("opennebula");
|
||||
var Navigation = require("utils/navigation");
|
||||
var FireedgeValidator = require("utils/fireedge-validator");
|
||||
var TemplateUtils = require('utils/template-utils');
|
||||
var Sunstone = require('sunstone');
|
||||
|
||||
@ -188,41 +187,6 @@ define(function(require) {
|
||||
TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, unshownValues, strippedTemplateVcenter);
|
||||
TemplateTableVcenter.setup(strippedTemplateVcenter, RESOURCE, this.element.ID, context, unshownValues, strippedTemplate);
|
||||
|
||||
var show_noVNC_buttons = function(){
|
||||
$(".vnc-button").show();
|
||||
$(".guac-button").hide();
|
||||
$(".vmrc-button").hide();
|
||||
}
|
||||
|
||||
var show_fireedge_buttons = function(){
|
||||
$(".vnc-button").hide();
|
||||
if(that && that.element && that.element.USER_TEMPLATE && that.element.USER_TEMPLATE.HYPERVISOR){
|
||||
if (that.element.USER_TEMPLATE.HYPERVISOR == "vcenter"){
|
||||
$(".vmrc-button").show();
|
||||
$(".guac-button").hide();
|
||||
}
|
||||
else{
|
||||
$(".guac-button").show();
|
||||
$(".vmrc-button").hide();
|
||||
}
|
||||
}
|
||||
else{
|
||||
$(".guac-button").show();
|
||||
$(".vmrc-button").hide();
|
||||
}
|
||||
}
|
||||
|
||||
var show_buttons = function(fireedgeToken){
|
||||
if (fireedgeToken != ""){
|
||||
show_fireedge_buttons();
|
||||
}
|
||||
else{
|
||||
show_noVNC_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
FireedgeValidator.validateFireedgeToken(show_buttons, show_noVNC_buttons);
|
||||
|
||||
context.off("click", "#close_vm_async_error");
|
||||
context.on("click", "#close_vm_async_error", function() {
|
||||
var resourceId = that.element.ID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user