Sha256: bb2a35653e52c7c30d973cce415ef81d12e8e991e9649835a0da36c0d7db23ff

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

//= require spice-html5

var sc = null;
$(function () {
  var scheme = "ws://", uri;

  var host = window.location.hostname;
  var port = $('#spice-area').data('port');
  var password = $('#spice-area').data('password');

  if ((!host) || (!port)) {
    console.log("must set host and port");
    return;
  }

  uri = scheme + host + ":" + port;

  sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", password: password,
                          onerror: spice_error, onsuccess: spice_success});
});

function disconnect() {
  if (sc) { sc.stop(); }
}

function spice_error(e) {
  $('#spice-status').text(e);
  $('#spice-status').removeClass('label-success').addClass('label-important');
  disconnect();
}

function spice_success(m) {
  $('#spice-status').text($('#spice-status').text().replace('Connecting','Connected'));
  $('#spice-status').addClass('label-success');
}

function connectXPI() {
  if ($('#spice-xpi').size() == 0) {
    $('#spice-area').append('<embed type="application/x-spice" height=0 width=0 id="spice-xpi">');
  }
  var attrs = $('#spice-area');
  // we close down the other WebSocket connection when opening the XPI
  disconnect();
  var pluginobj = document.embeds[0];
  pluginobj.hostIP = attrs.data('address');
  pluginobj.SecurePort = attrs.data('secure_port');
  pluginobj.Password = attrs.data('password');
  pluginobj.TrustStore = decodeURIComponent(attrs.data('ca_cert'));
  pluginobj.SSLChannels = String("all");
  pluginobj.fullScreen = false;
  pluginobj.Title = attrs.data('title');
  pluginobj.connect();
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/assets/javascripts/spice.js
foreman_discovery-1.0.0.rc4 test/foreman_app/app/assets/javascripts/spice.js
foreman_discovery-1.0.0.rc3 test/foreman_app/app/assets/javascripts/spice.js
foreman_discovery-1.0.0.rc2 test/foreman_app/app/assets/javascripts/spice.js
foreman_discovery-1.0.0.rc1 test/foreman_app/app/assets/javascripts/spice.js