<commit_before>angular.module('npact')
  .directive('npactGraphPage', function(STATIC_BASE_URL, $log, GraphDealer, $window) {
    'use strict';
    return {
      restrict: 'A',
      templateUrl: STATIC_BASE_URL + 'js/graphs/page.html',
      controller: 'npactGraphPageCtrl',
      controllerAs: 'ctrl',
      link: function($scope, $element) {
        var getWidth = function(){ return $element.width(); };

        $scope.$watch(getWidth, function(newValue, oldValue){
          if (newValue > 0){
            $log.log('width changed from', oldValue, '->', newValue);
            GraphDealer.setWidth(newValue);
          }
        });

        // check for scope changes on resize
        angular.element($window)
          .bind('resize', function () { $scope.$apply(); });
      }
    };
  })

  .controller('npactGraphPageCtrl', function($scope, GraphDealer, Fetcher, npactConstants, $q, $log, StatusPoller, FETCH_URL) {
    'use strict';
    $scope.miscFiles = [];
    $scope.graphHeight = npactConstants.graphSpecDefaults.height;
    $scope.status = 'Initializing';
    $scope.ready = false;
    $scope.FETCH_URL = FETCH_URL;

    this.addMore = _.debounce(function(){
      $log.log('scrolling down via infinite scroller');
      GraphDealer.showMore();
    }, 250);


<commit_msg>move logic from directive to controller<commit_after>angular.module('npact')
  .directive('npactGraphPage', function(STATIC_BASE_URL) {
    'use strict';
    return {
      restrict: 'A',
      templateUrl: STATIC_BASE_URL + 'js/graphs/page.html',
      controller: 'npactGraphPageCtrl',
      controllerAs: 'ctrl'
    };
  })

  .controller('npactGraphPageCtrl', function($scope, GraphDealer, Fetcher, npactConstants, $q, $log, StatusPoller, FETCH_URL, $window, $element) {
    'use strict';
    $scope.miscFiles = [];
    $scope.graphHeight = npactConstants.graphSpecDefaults.height;
    $scope.status = 'Initializing';
    $scope.ready = false;
    $scope.FETCH_URL = FETCH_URL;

    this.addMore = _.debounce(function(){
      $log.log('scrolling down via infinite scroller');
      GraphDealer.showMore();
    }, 250);

    var getWidth = function(){ return $element.width(); };

    $scope.$watch(getWidth, function(newValue, oldValue){
          if (newValue > 0){
            $log.log('width changed from', oldValue, '->', newValue);
            GraphDealer.setWidth(newValue);
          }
    });

    // check for scope changes on resize
    angular.element($window)
      .bind('resize', function () { $scope.$apply(); });

{'fraction_non_alphanumeric': 0.15043547110055425, 'fraction_numerical': 0.003167062549485352, 'mean_word_length': 3.0823909531502425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1549364', 'n_tokens_mistral': 807, 'n_tokens_neox': 773, 'n_words': 155}