<commit_before>// dashboard.js
// Provides a client-side interface to obtain the status
// and control servers for Clasp.
//
// <NAME>
// 2013.09.22

var socket = io.connect('http://ataack.ece.vt.edu:9090')
var servers = {}

function refresh() {
  socket.emit('refresh', null);
}

window.setInterval(function() {
  refresh()
}, 30000);

socket.on('serverRegister', function(serverName) {
  servers[serverName] = {'name': serverName};
  redraw();
});

socket.on('serverPing', function(data) {
  servers[data['server']]['ping'] = data['ping'];
  redraw();
});

socket.on('serverSsh', function(data) {
  servers[data['server']]['ssh'] = data['ssh'];
  redraw();
});

socket.on('serverClasp', function(data) {
  servers[data['server']]['clasp'] = data['clasp'];
  if (data['clasp'] === 'No') {
    servers[data['server']]['status'] = 'success';
  }
  redraw();
});

socket.on('killClasp', function(data) {
  console.log(data);
});

function redraw() {
  var newHtml =
    '<table id="servers" class="table table-condensed table-hover">' +
    "<tr>" +
      "<td><b>Server</b></td>" +
      "<td><b>Pingable</b></td>" +
      "<td><b>ssh-able</b></td>" +
      "<td><b>Clasp running?</b></td>" +
    "</tr>";
  var serversLength = servers.length;
  for (var i in servers) {
    newHtml += serverTmpl(servers[i]);
  }
  newHtml += '</table>';
  $('#server-table').html(newHtml);<commit_msg>Clasp: Delete the status if Clasp is online.<commit_after>// dashboard.js
// Provides a client-side interface to obtain the status
// and control servers for Clasp.
//
// <NAME>
// 2013.09.22

var socket = io.connect('http://ataack.ece.vt.edu:9090')
var servers = {}

function refresh() {
  socket.emit('refresh', null);
}

window.setInterval(function() {
  refresh()
}, 30000);

socket.on('serverRegister', function(serverName) {
  servers[serverName] = {'name': serverName};
  redraw();
});

socket.on('serverPing', function(data) {
  servers[data['server']]['ping'] = data['ping'];
  redraw();
});

socket.on('serverSsh', function(data) {
  servers[data['server']]['ssh'] = data['ssh'];
  redraw();
});

socket.on('serverClasp', function(data) {
  servers[data['server']]['clasp'] = data['clasp'];
  if (data['clasp'] === 'No') {
    servers[data['server']]['status'] = 'success';
  } else {
    delete servers[data['server']]['status'];
  }
  redraw();
});

socket.on('killClasp', function(data) {
  console.log(data);
});

function redraw() {
  var newHtml =
    '<table id="servers" class="table table-condensed table-hover">' +
    "<tr>" +
      "<td><b>Server</b></td>" +
      "<td><b>Pingable</b></td>" +
      "<td><b>ssh-able</b></td>" +
      "<td><b>Clasp running?</b></td>" +
    "</tr>";
  var serversLength = servers.length;
  for (var i in servers) {
    newHtml += serverTmpl(servers[i]);
  }
  newHtml += '</table>';
  $('#server-table').html(newHtml);
{'fraction_non_alphanumeric': 0.23617914625612316, 'fraction_numerical': 0.011896431070678797, 'mean_word_length': 4.1606498194945845, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4417535', 'n_tokens_mistral': 1036, 'n_tokens_neox': 1027, 'n_words': 183}