diff --git a/src/sunstone/public/app/tabs/vms-tab/buttons.js b/src/sunstone/public/app/tabs/vms-tab/buttons.js index f7823b75b7..4a03c8a531 100644 --- a/src/sunstone/public/app/tabs/vms-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vms-tab/buttons.js @@ -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", diff --git a/src/sunstone/public/app/tabs/vms-tab/hooks/state.js b/src/sunstone/public/app/tabs/vms-tab/hooks/state.js index e723abe31d..c21a2cf443 100644 --- a/src/sunstone/public/app/tabs/vms-tab/hooks/state.js +++ b/src/sunstone/public/app/tabs/vms-tab/hooks/state.js @@ -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) { } diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js index 2fcf224d6e..ac7f9d97e7 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -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;