<commit_before>/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, forin: true */
/*global Backbone, $, window, EJS, GraphViewerUI */

window.graphView = Backbone.View.extend({
  el: '#content',

  template: new EJS({url: 'js/templates/graphView.ejs'}),

  initialize: function () {
    var self = this;
    this.newLineTmpl = new EJS({url: "js/templates/graphViewGroupByEntry.ejs"});
    this.graphs = [];
    this.i = 1;
  },

  events: {
    "click input[type='radio'][name='loadtype']": "toggleLoadtypeDisplay",
    "click #createViewer": "createViewer",
    "click #add_group_by": "insertNewAttrLine",
    "click .gv_internal_remove_line": "removeAttrLine"
  },

  removeAttrLine: function(e) {
    var g = $(e.currentTarget)
      .parent()
      .parent(),
      set = g.parent();
    set.get(0).removeChild(g.get(0));
  }, 


  insertNewAttrLine: function() {
    this.i++;
    var next = this.newLineTmpl.render({id: this.i});
    $("#group_by_list").append(next);
  },

  toggleLoadtypeDisplay: function() {
    var selected = $("input[type='radio'][name='loadtype']:checked").attr("id");
    if (selected === "collections") {
      $("#collection_config").css("display", "block");
      $("#graph_config").css("display", "none");
    } else {
      $("#collection_config").css("display", "none");
      $("#graph_config").css("display", "block");
    }
  },

  createViewer: function() {
    var ecol,
    ncol,
    aaconfig,
    undirected,
    randomStart,
    label,
    config,
    ui;

    ecol = $("#edgeCollection").val();
    ncol = $("#nodeCollection").val();
    undirected = !!$("#undirected").attr("checked");
    label = $("#nodeLabel").val();
    randomStart = !!$("#randomStart").attr("checked");

    aaconfig = {
      type: "arango",
      nodeCollection: ncol,
      edgeCollection: ecol,
      undirected: undirected
    };

    if (label !== undefined && label !== "") {
      config = {
        nodeShaper: {
          label: label
        }
      };
    }
<commit_msg>GraphViewer: The priority list for grouping is now piped through to the graphviewer<commit_after>/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, forin: true */
/*global Backbone, $, window, EJS, GraphViewerUI */

window.graphView = Backbone.View.extend({
  el: '#content',

  template: new EJS({url: 'js/templates/graphView.ejs'}),

  initialize: function () {
    var self = this;
    this.newLineTmpl = new EJS({url: "js/templates/graphViewGroupByEntry.ejs"});
    this.graphs = [];
    this.i = 1;
  },

  events: {
    "click input[type='radio'][name='loadtype']": "toggleLoadtypeDisplay",
    "click #createViewer": "createViewer",
    "click #add_group_by": "insertNewAttrLine",
    "click .gv_internal_remove_line": "removeAttrLine"
  },

  removeAttrLine: function(e) {
    var g = $(e.currentTarget)
      .parent()
      .parent(),
      set = g.parent();
    set.get(0).removeChild(g.get(0));
  }, 


  insertNewAttrLine: function() {
    this.i++;
    var next = this.newLineTmpl.render({id: this.i});
    $("#group_by_list").append(next);
  },

  toggleLoadtypeDisplay: function() {
    var selected = $("input[type='radio'][name='loadtype']:checked").attr("id");
    if (selected === "collections") {
      $("#collection_config").css("display", "block");
      $("#graph_config").css("display", "none");
    } else {
      $("#collection_config").css("display", "none");
      $("#graph_config").css("display", "block");
    }
  },

  createViewer: function() {
    var ecol,
    ncol,
    aaconfig,
    undirected,
    randomStart,
    groupByList,
    groupByAttribute,
    label,
    config,
    ui;

    ecol = $("#edgeCollection").val();
    ncol = $("#nodeCollection").val();
    undirected = !!$("#undirected").attr("checked");
    label = $("#nodeLabel").val();
    randomStart = !!$("#randomStart").attr("checked");

    groupByAttribute = [];
    $("#group_by_list input").each(function() {
      var a = $(this).val();
      if (a) {
        groupByAttribute.push(a);
      }
    });

    aaconfig = {
      type: "arango",
      nodeCollection: ncol,
      edgeCollection: ecol,
      undirected: undirected
    };
    
    if (groupByAttribute.length > 0) {
      aaconfig.prioList = groupByAttribute;
    }

    if (label !== undefined && label !== "") {
      config = {
        nodeShaper: {
          label: label
        }
      };
    }

{'fraction_non_alphanumeric': 0.18726256983240225, 'fraction_numerical': 0.0033519553072625698, 'mean_word_length': 3.0653950953678475, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 4, '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': '2992359', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1464, 'n_words': 284}