B #5707: Use VM_MAD to show VirtViewer (#1858)

This commit is contained in:
Frederick Borges authored and GitHub committed 2022-03-21 12:20:47 +01:00
1 parent 8515b4ee96
commit 4fcfbc6ea8
3 files changed
+22 -18

No files matched your search

+3 -18
View File
@@ -1257,22 +1257,8 @@ define(function(require) {
String(element.USER_TEMPLATE.HYPERVISOR).toLowerCase() === "vcenter");
}
function isKVMVM(hostID){
var isKVM = false;
OpenNebulaHost.show({
data : {
id: hostID
},
timeout: true,
success: function (_, hostTemplate) {
isKVM = String(hostTemplate.HOST.VM_MAD).toLowerCase() === 'kvm';
},
error: function(request, response) {
isKVM = false;
}},
false
);
return isKVM;
function isKvmVm(history = {}){
return Boolean(history.VM_MAD && String(history.VM_MAD).toLowerCase() === "kvm");
}
function isVMRCSupported(element = {}) {
@@ -1294,8 +1280,7 @@ define(function(require) {
var actionEnabled = Config.isTabActionEnabled("vms-tab", "VM.save_virt_viewer");
var vncSupported = graphicSupported(element, "vnc");
var spiceSupported = graphicSupported(element, "spice");
var hostId = history && history.HID
var isKVM = hostId ? isKVMVM(hostId) : false;
var isKVM = isKvmVm(history);
return (actionEnabled && history && (vncSupported || spiceSupported) && isKVM)
? {
+1
View File
@@ -17,6 +17,7 @@
define(function(require) {
var Config = require('sunstone-config');
var UtilsConnection = require("utils/info-connection/utils");
var Notifier = require("utils/notifier");
return {
"downloadWFile": _downloadWFile,
@@ -99,6 +99,21 @@ define(function(require) {
return $("<div>").append(button.append(icon)).html();
}
function buttonWFile(id = "", wfile = {}) {
var icon = $("<i>", { class: "fas fa-file-code" });
var button = $("<button>", {
title: "w-file",
class: "w-file remote-vm",
"data-id": id,
"data-hostname": wfile.hostname,
"data-type": wfile.type,
"data-port": wfile.port
});
return $("<div>").append(button.append(icon)).html();
}
function buttonSSH(id = "") {
var icon = $("<i>", { class: "fas fa-terminal" });
@@ -197,6 +212,9 @@ define(function(require) {
actions += buttonSpice(vm.ID);
}
var wFile = OpenNebulaVM.isWFileSupported(vm);
actions += wFile ? buttonWFile(vm.ID, wFile) : "";
var rdpIp = OpenNebulaVM.isConnectionSupported(vm, "rdp");
actions += rdpIp ? dropdownRDP(vm.ID, rdpIp, vm) : "";