Merge branch 'develop' into feature/search_autocomplete_haste
[ganeti_webmgr.git] / ganeti / templates / virtual_machine / vnc.html
blob34d13e9bd4af5e5c0e557ec9e138c51488dfc49a
1 <script type="text/javascript">
2 var host, port, password;
4 function show_errors() {
5 if (host===false || port===false || password===false) {
6 $("#vnc_errors").html("Probably your proxy is not running or some errors occured. Try again.");
7 $("#vnc_errors").show();
8 return false;
10 return true;
13 function start() {
14 $("#vnc_errors").hide();
16 url1 = "{% url instance-vnc-proxy cluster.slug instance.hostname %}";
17 $.ajax({
18 "async": false,
19 "url": url1,
20 "dataType": "json",
21 "success": function(data, s, x){
22 host = data[0];
23 port = data[1];
24 password = data[2];
26 });
27 if (!show_errors()) return false;
29 url2 = "{% url instance-vnc-applet cluster.slug instance.hostname %}" + "/" + host + "/" + port + "/" + password + "/";
30 $("#applet").load( url2 );
32 return false;
34 </script>
36 <input type="button" id="connect" value="Connect" onclick="start()" />
37 <div id="applet">&nbsp;</div>