mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
(cherry picked from commit e1476fb24553216f4eb3c379e3a962c30b1ba34f)
This commit is contained in:
parent
8fbf59ea53
commit
aad460fa13
@ -19,15 +19,15 @@ define(function(require) {
|
||||
Sunstone = require("sunstone"),
|
||||
Config = require("sunstone-config"),
|
||||
OpenNebulaVM = require("opennebula/vm"),
|
||||
FireedgeValidator = require('utils/fireedge-validator'),
|
||||
Notifier = require('utils/notifier');
|
||||
|
||||
FireedgeValidator = require("utils/fireedge-validator"),
|
||||
Notifier = require("utils/notifier");
|
||||
|
||||
function _callSpice(data) {
|
||||
if (data.hasOwnProperty('id')) Sunstone.runAction('VM.startspice_action', String(data.id));
|
||||
if (data.hasOwnProperty("id")) Sunstone.runAction("VM.startspice_action", String(data.id));
|
||||
}
|
||||
|
||||
function _callVNC(data) {
|
||||
if (data.hasOwnProperty('id')) Sunstone.runAction('VM.startvnc_action', String(data.id));
|
||||
if (data.hasOwnProperty("id")) Sunstone.runAction("VM.startvnc_action", String(data.id));
|
||||
}
|
||||
|
||||
function _callSaveRDP(data) {
|
||||
@ -293,58 +293,60 @@ define(function(require) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} response Callback response with the token and info
|
||||
* @param {Object} options
|
||||
* @returns
|
||||
*
|
||||
* @param {Object} response Callback response with the token and info
|
||||
* @param {Object} options
|
||||
* @returns
|
||||
*/
|
||||
function _getLink(response, options){
|
||||
options = $.extend({
|
||||
host: undefined,
|
||||
port: undefined,
|
||||
connnection_type: '',
|
||||
extra_path: '',
|
||||
connnection_type: "",
|
||||
extra_path: "",
|
||||
extra_params: []
|
||||
}, options);
|
||||
|
||||
var paramInfo = config && config.system_config && !config.system_config.disable_guacamole_info_header && response.info && "info=" + response.info;
|
||||
|
||||
var params = options.extra_params.concat([
|
||||
response.token && 'token=' + response.token,
|
||||
response.info && 'info=' + response.info
|
||||
response.token && "token=" + response.token,
|
||||
paramInfo
|
||||
]).filter(Boolean);
|
||||
|
||||
var endpoint = new URL(window.location.href);
|
||||
var websocketProtocol = endpoint.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
var websocketProtocol = endpoint.protocol === "https:" ? "wss:" : "ws:";
|
||||
|
||||
var websocket = websocketProtocol + '//';
|
||||
var websocket = websocketProtocol + "//";
|
||||
|
||||
if (options.host && options.port)
|
||||
websocket += options.host + ':' + options.port
|
||||
websocket += options.host + ":" + options.port;
|
||||
else if (options.port)
|
||||
websocket += endpoint.hostname + ':' + options.port
|
||||
else
|
||||
websocket += endpoint.hostname + ":" + options.port;
|
||||
else
|
||||
websocket += endpoint.host;
|
||||
|
||||
websocket += options.extra_path + '?' + params.join("&");
|
||||
|
||||
websocket += options.extra_path + "?" + params.join("&");
|
||||
|
||||
var encoded_socket = btoa(websocket);
|
||||
|
||||
var link = endpoint.origin + "/" + options.connnection_type + "?socket=" + encoded_socket;
|
||||
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
return {
|
||||
'callSpice': _callSpice,
|
||||
'callVNC': _callVNC,
|
||||
'callSaveRDP': _callSaveRDP,
|
||||
'callSaveWFile': _callSaveWFile,
|
||||
'callVMRC': _callVMRC,
|
||||
'callGuacVNC': _callGuacVNC,
|
||||
'callGuacSSH': _callGuacSSH,
|
||||
'callGuacRDP': _callGuacRDP,
|
||||
'callGuacVNC': _callGuacVNC,
|
||||
'renderActionsHtml': _renderActionsHtml,
|
||||
'bindActionsToContext': _bindActionsToContext,
|
||||
'getLink': _getLink
|
||||
"callSpice": _callSpice,
|
||||
"callVNC": _callVNC,
|
||||
"callSaveRDP": _callSaveRDP,
|
||||
"callSaveWFile": _callSaveWFile,
|
||||
"callVMRC": _callVMRC,
|
||||
"callGuacVNC": _callGuacVNC,
|
||||
"callGuacSSH": _callGuacSSH,
|
||||
"callGuacRDP": _callGuacRDP,
|
||||
"callGuacVNC": _callGuacVNC,
|
||||
"renderActionsHtml": _renderActionsHtml,
|
||||
"bindActionsToContext": _bindActionsToContext,
|
||||
"getLink": _getLink
|
||||
};
|
||||
});
|
||||
|
@ -59,6 +59,7 @@
|
||||
'vnc_client_port' : '<%= $conf[:vnc_client_port] %>',
|
||||
'allow_vnc_federation' : '<%= (!$conf[:allow_vnc_federation].nil?)? $conf[:allow_vnc_federation] : "no" %>',
|
||||
'max_upload_file_size' : <%= $conf[:max_upload_file_size] ? $conf[:max_upload_file_size] : "undefined" %>,
|
||||
'disable_guacamole_info_header' : <%= $conf[:disable_guacamole_info_header] === 'yes' %>,
|
||||
'leases' : <%= $conf[:leases] ? $conf[:leases].to_json : "null" %>,
|
||||
'mapped_ips' : '<%= $conf[:mapped_ips] ? $conf[:mapped_ips] : false %>',
|
||||
'get_extended_vm_info': '<%= $conf[:get_extended_vm_info] ? $conf[:get_extended_vm_info] : false %>',
|
||||
|
Loading…
x
Reference in New Issue
Block a user