1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-08-29 09:49:28 +03:00

Feature #564: Update vnc server and client side.

Server side: corrected path to vnc proxy script. Enabled returning the proxy details when we believe it is running, instead of an error saying it is running.

Client side: vms-plugin loads dynamically the noVNC web client. This way someone may actually change it into a different client without having to modify a hardcoded <script> in index.html.
This commit is contained in:
Hector Sanjuan
2011-05-04 11:51:03 +02:00
committed by Daniel Molina
parent d975548003
commit 02bec9360c
4 changed files with 15 additions and 6 deletions

View File

@ -246,7 +246,7 @@ class SunstoneServer
# and serving as proxy for the VM host on the configured VNC port.
# TODO - This path is in public...
begin
pipe = IO.popen("#{File.dirname(__FILE__)}/../public/vendor/noVNC/utils/launch.sh --listen #{proxy_port} --vnc #{host}:#{vnc_port}")
pipe = IO.popen("#{File.dirname(__FILE__)}/../lib/vendor/noVNC/utils/launch.sh --listen #{proxy_port} --vnc #{host}:#{vnc_port}")
rescue Exception => e
error = Error.new(e.message)
return [500, error.to_json]

View File

@ -15,6 +15,12 @@
/* -------------------------------------------------------------------------- */
/*Virtual Machines tab plugin*/
var INCLUDE_URI = "vendor/noVNC/include/";
function loadVNC(){
var script = '<script src="vendor/noVNC/include/vnc.js"></script>';
document.write(script);
}
loadVNC();
var vms_tab_content =
'<form id="virtualMachine_list" action="javascript:alert(\'js error!\');">\

View File

@ -172,7 +172,7 @@ post '/vm/:id/stopvnc' do
return [403, OpenNebula::Error.new(msg).to_json]
end
rc = @SunstoneServer.stopvnc(vm_id, vnc_hash[vm_id])
rc = @SunstoneServer.stopvnc(vm_id, vnc_hash[vm_id][:pipe])
if rc[0] == 200
session['vnc'].delete(vm_id)
end
@ -188,14 +188,17 @@ post '/vm/:id/startvnc' do
if !vnc_hash
session['vnc']= {}
elsif vnc_hash[vm_id]
msg = "There is a VNC server running for this VM"
return [403, OpenNebula::Error.new(msg).to_json]
#return existing information
info = vnc_hash[vm_id].clone
info.delete(:pipe)
return [200, info.to_json]
end
rc = @SunstoneServer.startvnc(vm_id)
if rc[0] == 200
info = rc[1]
session['vnc'][vm_id] = info[:pipe]
session['vnc'][vm_id] = info.clone
info.delete(:pipe)
[200, info.to_json]

View File

@ -16,7 +16,7 @@
<script type="text/javascript" src="/vendor/jQueryUI/jquery-ui-1.8.7.custom.min.js"></script>
<script type="text/javascript" src="/vendor/jQueryLayout/jquery.layout.min-1.2.0.js"></script>
<script type="text/javascript" src="/vendor/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/vendor/noVNC/include/vnc.js"></script>
<!-- End Vendor Libraries -->