<commit_before>'use strict';

angular.module('metadatamanagementApp').controller(
    'HealthController',
    function($scope, MonitoringService, $modal, AdminService) {
      $scope.isRecreatingIndices = false;
      $scope.updatingHealth = true;
      $scope.separator = '.';

      $scope.refresh = function() {
        $scope.updatingHealth = true;
        MonitoringService.checkHealth().then(function(response) {
          $scope.healthData = $scope.transformHealthData(response);
          $scope.updatingHealth = false;
        }, function(response) {
          $scope.healthData = $scope.transformHealthData(response.data);
          $scope.updatingHealth = false;
        });
      };

      $scope.recreateAllElasticsearchIndices = function() {
        $scope.isRecreatingIndices = true;
        AdminService.recreateAllElasticsearchIndices().then(function() {
          $scope.isRecreatingIndices = false;
        });
      };

      $scope.refresh();

      $scope.getLabelClass = function(statusState) {
        if (statusState === 'UP') {
          return 'label-success';
        } else {
          return 'label-danger';
        }
      };

      $scope.transformHealthData = function(data) {
        var response = [];
        $scope.flattenHealthData(response, null, data);
        return response;
      };

      $scope.flattenHealthData = function(result, path, data) {
        angular.forEach(data, function(value, key) {
          if ($scope.isHealthObject(value)) {
            if ($scope.hasSubSystem(value)) {
              $scope.addHealthObject(result, false, value, $scope
                  .getModuleName(path, key));
              $scope.flattenHealthData(result, $scope.getModuleName(path, key),
                  value);
            } else {
              $scope.addHealthObject(result, true, value, $scope.getModuleName(<commit_msg>#76 resetting button on error<commit_after>'use strict';

angular.module('metadatamanagementApp').controller(
    'HealthController',
    function($scope, MonitoringService, $modal, AdminService) {
      $scope.isRecreatingIndices = false;
      $scope.updatingHealth = true;
      $scope.separator = '.';

      $scope.refresh = function() {
        $scope.updatingHealth = true;
        MonitoringService.checkHealth().then(function(response) {
          $scope.healthData = $scope.transformHealthData(response);
          $scope.updatingHealth = false;
        }, function(response) {
          $scope.healthData = $scope.transformHealthData(response.data);
          $scope.updatingHealth = false;
        });
      };

      $scope.recreateAllElasticsearchIndices = function() {
        $scope.isRecreatingIndices = true;
        AdminService.recreateAllElasticsearchIndices().then(function() {
          // success
          $scope.isRecreatingIndices = false;
        }, function() {
          // error
          $scope.isRecreatingIndices = false;
        });
      };

      $scope.refresh();

      $scope.getLabelClass = function(statusState) {
        if (statusState === 'UP') {
          return 'label-success';
        } else {
          return 'label-danger';
        }
      };

      $scope.transformHealthData = function(data) {
        var response = [];
        $scope.flattenHealthData(response, null, data);
        return response;
      };

      $scope.flattenHealthData = function(result, path, data) {
        angular.forEach(data, function(value, key) {
          if ($scope.isHealthObject(value)) {
            if ($scope.hasSubSystem(value)) {
              $scope.addHealthObject(result, false, value, $scope
                  .getModuleName(path, key));
              $scope.flattenHealthData(result, $scope.getModuleName(path, key),
                  value);
            } else {
              $scope.addHealthObject(result, true, value, $scope.getModuleName(
{'fraction_non_alphanumeric': 0.12590673575129532, 'fraction_numerical': 0.0005181347150259067, 'mean_word_length': 2.3457538994800693, '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': '4440146', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1049, 'n_words': 168}