<commit_before>'use strict';

var controllerModule = angular.module('uchiwa.controllers', []);

/**
* Init
*/
controllerModule.controller('init', ['$rootScope', '$scope', 'notification', 'pollingFactory', 'Page', 'uchiwaBackend',
  function ($rootScope, $scope, notification, pollingFactory, Page, uchiwaBackend) {
    $scope.Page = Page;
    $rootScope.skipRefresh = false;
    $rootScope.alerts = [];
    $rootScope.events = [];

    uchiwaBackend.getConfig()
      .success(function (data) {
        pollingFactory.callFnOnInterval(function () { $rootScope.getSensu(); }, data.Uchiwa.Refresh);
      })
      .error(function () {
        pollingFactory.callFnOnInterval(function () { $rootScope.getSensu(); }, 10);
      });

    $rootScope.getSensu = function () {
      if ($rootScope.skipRefresh) {
        $rootScope.skipRefresh = false;
        return;
      }
      uchiwaBackend.getHealth()
        .success(function (data) {
          $rootScope.health = data;
        });
      uchiwaBackend.getSensu()
        .success(function (data) {
          angular.forEach(data, function(value, key) { // initialize null elements
            if (!value || value === null) {
              data[key] = [];
            }
          });
          $rootScope.checks = data.Checks;
          $rootScope.dc = data.Dc;

          $rootScope.clients = _.map(data.Clients, function(client) {
            var existingClient = _.findWhere($rootScope.clients, {name: client.name});
            if (existingClient !== undefined) {
              client = angular.extend(existingClient, client);
            }
            return existingClient || client;
          });

          $rootScope.events = _.map(data.Events, function(event) {<commit_msg>[bulk_actions] include dc when searching for existing clients<commit_after>'use strict';

var controllerModule = angular.module('uchiwa.controllers', []);

/**
* Init
*/
controllerModule.controller('init', ['$rootScope', '$scope', 'notification', 'pollingFactory', 'Page', 'uchiwaBackend',
  function ($rootScope, $scope, notification, pollingFactory, Page, uchiwaBackend) {
    $scope.Page = Page;
    $rootScope.skipRefresh = false;
    $rootScope.alerts = [];
    $rootScope.events = [];

    uchiwaBackend.getConfig()
      .success(function (data) {
        pollingFactory.callFnOnInterval(function () { $rootScope.getSensu(); }, data.Uchiwa.Refresh);
      })
      .error(function () {
        pollingFactory.callFnOnInterval(function () { $rootScope.getSensu(); }, 10);
      });

    $rootScope.getSensu = function () {
      if ($rootScope.skipRefresh) {
        $rootScope.skipRefresh = false;
        return;
      }
      uchiwaBackend.getHealth()
        .success(function (data) {
          $rootScope.health = data;
        });
      uchiwaBackend.getSensu()
        .success(function (data) {
          angular.forEach(data, function(value, key) { // initialize null elements
            if (!value || value === null) {
              data[key] = [];
            }
          });
          $rootScope.checks = data.Checks;
          $rootScope.dc = data.Dc;

          $rootScope.clients = _.map(data.Clients, function(client) {
            var existingClient = _.findWhere($rootScope.clients, {name: client.name, dc: client.dc});
            if (existingClient !== undefined) {
              client = angular.extend(existingClient, client);
            }
            return existingClient || client;
          });

          $rootScope.events = _.map(data.Events, function(event) {
{'fraction_non_alphanumeric': 0.14641744548286603, 'fraction_numerical': 0.0011328235627301047, 'mean_word_length': 2.5004955401387514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5685716', 'n_tokens_mistral': 1025, 'n_tokens_neox': 1007, 'n_words': 181}