vm-detail-console.html 2.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<div class="btn-toolbar">
    <div class="btn-group">
        <button id="sendCtrlAltDelButton" class="btn btn-danger small" href="#">Send CtrlAltDel</button>
        <button id="akkount-mate" class="btn btn-default small" href="#">Máténak akkountot adok</button>
        <button id="akkount-bd" class="btn btn-success small" href="#">bd-nek akkountot adok</button>
    </div>
    <div class="btn-group">
        <button id="blabla" class="btn btn-warning small disabled" href="#">GubaSanyinak akkountot adok</button>
    </div>
</div>
<div class="alert alert-info" id="noVNC_status">
</div>

<canvas id="noVNC_canvas" width="640px" height="20px">Canvas not supported.
</canvas>

<script src="{{ STATIC_URL }}dashboard/novnc/util.js"></script>
<script>
    "use strict";

    var INCLUDE_URI = '{{ STATIC_URL }}dashboard/novnc/';

    Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
                       "input.js", "display.js", "jsunzip.js", "rfb.js"]);

    var rfb;

    function updateState(rfb, state, oldstate, msg) {
        var s, sb, cad
        s = $('#noVNC_status')[0];
        cad = $('#sendCtrlAltDelButton')[0];

        if (state === "normal") { cad.disabled = false; }
        else                    { cad.disabled = true; }

        if (typeof(msg) !== 'undefined') {
            s.innerHTML = msg;
        }
    }

    $('a[data-toggle$="pill"][href!="#console"]').click(function() {
        if (rfb) {
            rfb.disconnect();
            rfb = 0;
        }
        $("#vm-info-pane").fadeIn();
        $("#vm-detail-pane").removeClass("col-md-12");
    });
    $('#sendCtrlAltDelButton').click(function() {
        rfb.sendCtrlAltDel(); return false;});
    $('#akkount-mate').click(function() {
52
        return false;});
53
    $('#akkount-bd').click(function() {
54
        return false;});
55 56 57 58 59 60 61 62 63


    $('a[href$="console"]').click(function() {
        var host, port, password, path;

        $("#vm-info-pane").hide();
        $("#vm-detail-pane").addClass("col-md-12");
        WebUtil.init_logging('warn');

64 65 66 67
        host = window.location.hostname;
        port = window.location.port == ""?"443":window.location.port ;
        password = 'autogiro';
        path = 'vnc/?d={{ vnc_url }}';
68 69

        rfb = new RFB({'target': $D('noVNC_canvas'),
70
                       'encrypt': (window.location.protocol === "https:"),
71 72 73 74 75 76 77 78
                       'true_color':   true,
                       'local_cursor': true,
                       'shared':       true,
                       'view_only':    false,
                       'updateState':  updateState});
        rfb.connect(host, port, password, path);
    });
    </script>