<commit_before>'use strict';

var serviceModule = angular.module('uchiwa.services', []);

/**
* Uchiwa
*/
serviceModule.service('backendService', ['conf', '$http', '$interval', '$location', '$rootScope', '$timeout',
  function(conf, $http, $interval, $location, $rootScope, $timeout){
    var self = this;
    this.auth = function () {
      return $http.get('auth');
    };
    this.createStash = function (payload) {
      return $http.post('post_stash', payload);
    };
    this.deleteClient = function (client, dc) {
      return $http.get('delete_client?id=' + client + '&dc=' + dc );
    };
    this.deleteStash = function (payload) {
      return $http.post('delete_stash', payload);
    };
    this.getClient = function (client, dc) {
      return $http.get('get_client?id=' + client + '&dc=' + dc );
    };
    this.getConfig = function () {
      if ($location.path().substring(0, 6) == "/login") {
        return;
      }
      $http.get('get_config')
        .success(function (data) {
          $rootScope.config = data;
          conf.refresh = data.Uchiwa.Refresh * 1000;
          $interval(self.update, conf.refresh);
        })
        .error(function () {
          $interval(self.update, conf.refresh);
        });
    };
    this.getConfigAuth = function () {
      return $http.get('config/auth');
    };
    this.getHealth = function () {
      return $http.get('health/sensu');
    };
    this.getSensu = function () {
      return $http.get('get_sensu');
    };
    this.login = function (payload) {
      return $http.post('login', payload);
    };
    this.resolveEvent = function (payload) {
      return $http.post('post_event', payload);
    };
    this.update = function () {
      if ($location.path().substring(0, 6) == "/login") {
        return;
      }
      if ($rootScope.skipRefresh) {
        $rootScope.skipRefresh = false;
        return;
      }
      self.getHealth()
      .success(function (data) {
        $rootScope.health = data;
      });
      self.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.aggregates = data.Aggregates;<commit_msg>linting<commit_after>'use strict';

var serviceModule = angular.module('uchiwa.services', []);

/**
* Uchiwa
*/
serviceModule.service('backendService', ['conf', '$http', '$interval', '$location', '$rootScope', '$timeout',
  function(conf, $http, $interval, $location, $rootScope, $timeout){
    var self = this;
    this.auth = function () {
      return $http.get('auth');
    };
    this.createStash = function (payload) {
      return $http.post('post_stash', payload);
    };
    this.deleteClient = function (client, dc) {
      return $http.get('delete_client?id=' + client + '&dc=' + dc );
    };
    this.deleteStash = function (payload) {
      return $http.post('delete_stash', payload);
    };
    this.getClient = function (client, dc) {
      return $http.get('get_client?id=' + client + '&dc=' + dc );
    };
    this.getConfig = function () {
      if ($location.path().substring(0, 6) === '/login') {
        return;
      }
      $http.get('get_config')
        .success(function (data) {
          $rootScope.config = data;
          conf.refresh = data.Uchiwa.Refresh * 1000;
          $interval(self.update, conf.refresh);
        })
        .error(function () {
          $interval(self.update, conf.refresh);
        });
    };
    this.getConfigAuth = function () {
      return $http.get('config/auth');
    };
    this.getHealth = function () {
      return $http.get('health/sensu');
    };
    this.getSensu = function () {
      return $http.get('get_sensu');
    };
    this.login = function (payload) {
      return $http.post('login', payload);
    };
    this.resolveEvent = function (payload) {
      return $http.post('post_event', payload);
    };
    this.update = function () {
      if ($location.path().substring(0, 6) === '/login') {
        return;
      }
      if ($rootScope.skipRefresh) {
        $rootScope.skipRefresh = false;
        return;
      }
      self.getHealth()
      .success(function (data) {
        $rootScope.health = data;
      });
      self.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.aggregates = data.Aggregates;
{'fraction_non_alphanumeric': 0.17169570760730982, 'fraction_numerical': 0.003399915002124947, 'mean_word_length': 2.345415778251599, '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': '176418', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1440, 'n_words': 273}