From 4fc6623a6417c851abd3e0e4d457cc57a2d39cd3 Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Fri, 21 May 2021 13:54:48 +0200 Subject: [PATCH] B #5408: Fix available remote connections (#1241) --- .../public/app/tabs/provision-tab/vms/list.js | 6 +++-- .../public/app/tabs/vms-tab/buttons.js | 6 ++--- .../public/app/tabs/vms-tab/hooks/state.js | 22 ++++++------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index 1e012f8281..e377b4ab6a 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -333,6 +333,8 @@ define(function(require) { var is_spice_allowed = OpenNebulaVM.isSPICESupported(data); var is_vmrc_allowed = OpenNebulaVM.isVMRCSupported(data); var is_virt_viewer_allowed = OpenNebulaVM.isWFileSupported(data); + var is_rdp_allowed = Boolean(OpenNebulaVM.isConnectionSupported(data, 'rdp')); + var is_ssh_allowed = Boolean(OpenNebulaVM.isConnectionSupported(data, 'ssh')); $('.dropdown-menu-css', context).toggle(state.str === "RUNNING"); $(".provision_spice_button", context).parent().toggle(is_spice_allowed); @@ -348,8 +350,8 @@ define(function(require) { }else { // Guacamole connections $(".provision_vmrc_button", context).parent().hide(); $(".provision_guac_vnc_button", context).parent().show(); - $(".provision_guac_rdp_button", context).parent().show(); - $(".provision_guac_ssh_button", context).parent().show(); + $(".provision_guac_rdp_button", context).parent().toggle(is_rdp_allowed); + $(".provision_guac_ssh_button", context).parent().toggle(is_ssh_allowed); } } else{ diff --git a/src/sunstone/public/app/tabs/vms-tab/buttons.js b/src/sunstone/public/app/tabs/vms-tab/buttons.js index 228f515c90..e3cde458ef 100644 --- a/src/sunstone/public/app/tabs/vms-tab/buttons.js +++ b/src/sunstone/public/app/tabs/vms-tab/buttons.js @@ -228,19 +228,19 @@ define(function(require) { type: "action", text: '
' + Locale.tr("VNC"), layout: "vmsremote_buttons", - custom_classes: "only-sunstone-info vnc-sunstone-info guac-button" + custom_classes: "only-sunstone-info vnc-sunstone-info guac-button guac-vnc-button" }, "VM.guac_ssh" : { type: "action", text: '
' + Locale.tr("SSH"), layout: "vmsremote_buttons", - custom_classes: "only-sunstone-info ssh-sunstone-info guac-button" + custom_classes: "only-sunstone-info ssh-sunstone-info guac-button guac-ssh-button" }, "VM.guac_rdp" : { type: "action", text: '
' + Locale.tr("RDP"), layout: "vmsremote_buttons", - custom_classes: "only-sunstone-info rdp-sunstone-info guac-button" + custom_classes: "only-sunstone-info rdp-sunstone-info guac-button guac-rdp-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 b7f724bb73..a476eb1252 100644 --- a/src/sunstone/public/app/tabs/vms-tab/hooks/state.js +++ b/src/sunstone/public/app/tabs/vms-tab/hooks/state.js @@ -75,6 +75,11 @@ define(function(require) { } } + var sshAndRdpController = function(){ + $('.rdp-guac-button').toggle(isRDPSupported); + $('.ssh-guac-button').toggle(isSSHSupported); + } + vncAndSpiceController(); $("#vmsremote_buttons").toggle(!allDisabled); @@ -88,20 +93,6 @@ define(function(require) { $("#vmsremote_buttons").hide(); } } - - 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(); - } // Show / hide virt-viewer button $(".vv-sunstone-info").toggle(!!isWFileSupported); @@ -132,7 +123,8 @@ define(function(require) { var show_fireedge_buttons = function() { $(".vnc-button").hide(); $(".vmrc-button").toggle(isVMRCSupported); - $(".guac-button").toggle(!isVMRCSupported); + $(".vnc-guac-button").toggle(isVNCSupported); + sshAndRdpController(); } var show_buttons = function(fireedgeToken) {