<commit_before>InjectionController.onConnected = reloadData;

InjectionController.init();

function reloadData() {
  InjectionController.slaveApply(onResult, function (reply) {
    // unfortunately due to bug in /diag/eval implementation we have to call eval from inside eval :(, thus extra escaping
    var code = 'S = "{json, [rpc:call(N, erlang, apply, [fun () -> {struct, [{nodeName, N}, {masterNode, rpc:call(N, mb_master, master_node, [])}, {publicIP, list_to_binary(os:cmd(\\"curl -s http://169.254.169.254/latest/mata-data/public-ipv4\\"))}]} end, []]) || N <- [node() | nodes()]]}.",' +
      '{value, V, _} = eshell:eval(S,[]), V.';
    $.post("/diag/eval", code, function (data, status) {
      reply(data, status);
    }, "json");
  });

  function onResult(data, status) {
    console.log("data:", data);
    console.log("status:", status);

    var container = $('address-list');
    container.empty();
    if (status !== 'success') {
      alert('crap: ' + status);
      return;
    }

    var template = $('address-list-template').textContent;
    container.innerHTML = Mustache.to_html(template, {pairs: data});
  }
}<commit_msg>fixed curl cmd-line typo<commit_after>InjectionController.onConnected = reloadData;

InjectionController.init();

function reloadData() {
  InjectionController.slaveApply(onResult, function (reply) {
    // unfortunately due to bug in /diag/eval implementation we have to call eval from inside eval :(, thus extra escaping
    var code = 'S = "{json, [rpc:call(N, erlang, apply, [fun () -> {struct, [{nodeName, N}, {masterNode, rpc:call(N, mb_master, master_node, [])}, {publicIP, list_to_binary(os:cmd(\\"curl -s http://169.254.169.254/latest/meta-data/public-ipv4\\"))}]} end, []]) || N <- [node() | nodes()]]}.",' +
      '{value, V, _} = eshell:eval(S,[]), V.';
    $.post("/diag/eval", code, function (data, status) {
      reply(data, status);
    }, "json");
  });

  function onResult(data, status) {
    console.log("data:", data);
    console.log("status:", status);

    var container = $('address-list');
    container.empty();
    if (status !== 'success') {
      alert('crap: ' + status);
      return;
    }

    var template = $('address-list-template').textContent;
    container.innerHTML = Mustache.to_html(template, {pairs: data});
  }
}
{'fraction_non_alphanumeric': 0.196529284164859, 'fraction_numerical': 0.011279826464208243, 'mean_word_length': 3.7941787941787943, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3058010', 'n_tokens_mistral': 782, 'n_tokens_neox': 746, 'n_words': 173}