<commit_before>// global variables, hold current state
var chart_data_url = null
var chart = null;
var chart_data = null;

// get current URL:
// window.location.pathname + "cumulative/",

// DOM is ready, let's start the show
$(function() {
  // load URL for getting data for chart
  chart_data_url = $("#chart-settings").attr('action');

  // load chart data
  $.ajax({
    url: chart_data_url,
    cache: false,
    dataType: "json"
  }).done(function(data) {
    if (chart_data_url.indexOf("control") > -1) {
      render_control_chart(data);
    } else if (chart_data_url.indexOf("cumulative") > -1) {
      render_cumulative_chart(data);
    }
    $.each(data["all_lists"], function(idx, value) {
      $('#workflow-1-1')
          .append($("<option></option>")
          .attr("value", value)
          .text(value)
      );
    });
  });

  // get chart data on form submit
  $('form#chart-settings input.submit-button').click(function() {
    $.post(
      chart_data_url,
      $('#chart-settings').serialize(),
      function(data) {
        chart_data["columns"] = data["data"];
        chart_data["unload"] = chart.columns;
        chart_data["groups"] = data["order"];
        chart.load(chart_data);
      },
      'json' // I expect a JSON response
    );
  });

  $("div#chart-workflow div select").focus(on_focus_states);
});

// handler for growing state machine
// FIXME: focus event is not active right away, debug & fix
function on_focus_states(data) {
  var t = $(this);
  var parent_div = t.parent("div")

  // should we add another state?
  if (parent_div.children("select").last().find(":selected").length > 0) {
    var new_select = parent_div
        .children("select")
        .last()
        .clone()
        .appendTo(parent_div)
        .val("")
        .attr("id", function(i, oldVal) {
            return oldVal.replace(/\d+$/, function(m) {
                return (+m + 1);  // +m means it's converted to `int(m) + 1`
            });
        });
    new_select
        .attr("name", new_select.attr("id"))
        .on("focus", on_focus_states);
  }

  // should we add another checkpoint?
  if ($("#chart-workflow div").last().children("select").find(":selected").length > 0) {
    var root_div = parent_div.parent("div#chart-workflow");
    root_div.append("<div class=\"chart-settings-state-column\"></div>");
    var new_div = root_div.children("div").last();
    var new_select = parent_div
        .children("select")
        .first()
        .clone()
        .appendTo(new_div)
        .val("")
        .attr("id", function(i, oldVal) {<commit_msg>js: disable checkpoint groups<commit_after>// global variables, hold current state
var chart_data_url = null
var chart = null;
var chart_data = null;

// get current URL:
// window.location.pathname + "cumulative/",

// DOM is ready, let's start the show
$(function() {
  // load URL for getting data for chart
  chart_data_url = $("#chart-settings").attr('action');

  // load chart data
  $.ajax({
    url: chart_data_url,
    cache: false,
    dataType: "json"
  }).done(function(data) {
    if (chart_data_url.indexOf("control") > -1) {
      render_control_chart(data);
    } else if (chart_data_url.indexOf("cumulative") > -1) {
      render_cumulative_chart(data);
    }
    $.each(data["all_lists"], function(idx, value) {
      $('#workflow-1-1')
          .append($("<option></option>")
          .attr("value", value)
          .text(value)
      );
    });
  });

  // get chart data on form submit
  $('form#chart-settings input.submit-button').click(function() {
    $.post(
      chart_data_url,
      $('#chart-settings').serialize(),
      function(data) {
        chart_data["columns"] = data["data"];
        chart_data["unload"] = chart.columns;
        chart_data["groups"] = data["order"];
        chart.load(chart_data);
      },
      'json' // I expect a JSON response
    );
  });

  $("div#chart-workflow div select").focus(on_focus_states);
});

// handler for growing state machine
function on_focus_states(data) {
  var t = $(this);
  var parent_div = t.parent("div")

  // // should we add another state?
  // if (parent_div.children("select").last().find(":selected").length > 0) {
  //   var new_select = parent_div
  //       .children("select")
  //       .last()
  //       .clone()
  //       .appendTo(parent_div)
  //       .val("")
  //       .attr("id", function(i, oldVal) {
  //           return oldVal.replace(/\d+$/, function(m) {
  //               return (+m + 1);  // +m means it's converted to `int(m) + 1`
  //           });
  //       });
  //   new_select
  //       .attr("name", new_select.attr("id"))
  //       .on("focus", on_focus_states);
  // }

  // should we add another checkpoint?
  if ($("#chart-workflow div").last().children("select").find(":selected").length > 0) {
    var root_div = parent_div.parent("div#chart-workflow");
    root_div.append("<div class=\"chart-settings-state-column\"></div>");
    var new_div = root_div.children("div").last();
    var new_select = parent_div
        .children("select")
        .first()
        .clone()
        .appendTo(new_div)
        .val("")
        .attr("id", function(i, oldVal) {
{'fraction_non_alphanumeric': 0.18038157641164002, 'fraction_numerical': 0.0030834457506263247, 'mean_word_length': 2.523421588594705, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 19, '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': '3856028', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1649, 'n_words': 355}