<commit_before>'use strict';

/**
 * @ngdoc directive
 * @name facetedviz.directive:visList
 * @description
 * # visList
 */
angular.module('facetedviz')
  .directive('visList', function (Fields, Visrec, vl, jQuery, consts, _, Logger) {
    return {
      templateUrl: 'components/vislist/vislist.html',
      restrict: 'E',
      replace: true,
      scope: {},
      link: function postLink(scope , element /*, attrs*/) {
        scope.Fields = Fields;
        scope.Visrec = Visrec;
        scope.consts = consts;
        scope.shorthands = vl.field.shorthands;
        scope.limit = consts.numInitClusters;

        scope.increaseLimit = function() {
          if(scope.limit + consts.numMoreClusters > Visrec.numClustersGenerated) {
            Visrec.update.clusters(scope.limit + consts.numMoreClusters);
          }

          scope.limit += consts.numMoreClusters;
          Logger.logInteraction(Logger.actions.LOAD_MORE, scope.limit);
        };

        scope.select = function(fieldSet, cluster/*, $index*/) {
          Logger.logInteraction(Logger.actions.DRILL_DOWN_OPEN, fieldSet.key);
          Visrec.selectedFieldSet = fieldSet;
          Visrec.selectedCluster = cluster;
        };

        function updateFields() {
          scope.limit = consts.numInitClusters;
          element.scrollTop(0); // scroll the the top
          var fieldList = Fields.getList();

          Fields.update();
          Logger.logInteraction(Logger.actions.FIELDS_CHANGE, {
            selected: Fields.selected,
            list: fieldList
          });
          Visrec.update.projections(fieldList);
        }

        var dUpdateFields = _.debounce(updateFields, 200, {maxWait: 1500});

        scope.$watch('Fields.fields', function(fields, oldFields) {
          if (!oldFields || _.keys(oldFields).length ===0 ) { // first time!
            updateFields();
          } else {
            dUpdateFields();
          }
        }, true);

      }
    };
  });<commit_msg>Don’t update fields from vislist because it triggers an undo<commit_after>'use strict';

/**
 * @ngdoc directive
 * @name facetedviz.directive:visList
 * @description
 * # visList
 */
angular.module('facetedviz')
  .directive('visList', function (Fields, Visrec, vl, jQuery, consts, _, Logger) {
    return {
      templateUrl: 'components/vislist/vislist.html',
      restrict: 'E',
      replace: true,
      scope: {},
      link: function postLink(scope , element /*, attrs*/) {
        scope.Fields = Fields;
        scope.Visrec = Visrec;
        scope.consts = consts;
        scope.shorthands = vl.field.shorthands;
        scope.limit = consts.numInitClusters;

        scope.increaseLimit = function() {
          if(scope.limit + consts.numMoreClusters > Visrec.numClustersGenerated) {
            Visrec.update.clusters(scope.limit + consts.numMoreClusters);
          }

          scope.limit += consts.numMoreClusters;
          Logger.logInteraction(Logger.actions.LOAD_MORE, scope.limit);
        };

        scope.select = function(fieldSet, cluster/*, $index*/) {
          Logger.logInteraction(Logger.actions.DRILL_DOWN_OPEN, fieldSet.key);
          Visrec.selectedFieldSet = fieldSet;
          Visrec.selectedCluster = cluster;
        };

        function updateFields() {
          scope.limit = consts.numInitClusters;
          element.scrollTop(0); // scroll the the top
          var fieldList = Fields.getList();

          Logger.logInteraction(Logger.actions.FIELDS_CHANGE, {
            selected: Fields.selected,
            list: fieldList
          });
          Visrec.update.projections(fieldList);
        }

        var dUpdateFields = _.debounce(updateFields, 200, {maxWait: 1500});

        scope.$watch('Fields.fields', function(fields, oldFields) {
          if (!oldFields || _.keys(oldFields).length ===0 ) { // first time!
            updateFields();
          } else {
            dUpdateFields();
          }
        }, true);

      }
    };
  });
{'fraction_non_alphanumeric': 0.12405636638147961, 'fraction_numerical': 0.004529441368897836, 'mean_word_length': 2.231707317073171, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2116620', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1140, 'n_words': 206}