<commit_before>'use strict';


angular.module('deckApp')
  .directive('instanceList', function(clusterFilterService) {
    return {
      restrict: 'E',
      templateUrl: 'scripts/modules/instance/instanceList.html',
      scope: {
        instances: '=',
        sortFilter: '=',
      },
      link: function(scope) {
        scope.updateQueryParams = clusterFilterService.updateQueryParams;
      }
    };
  })
  .directive('instanceListBody', function ($timeout, $filter, $rootScope, $state, scrollTriggerService, clusterFilterService) {
    return {
      restrict: 'C',
      scope: {
        instances: '=',
        sortFilter: '=',
        renderInstancesOnScroll: '=',
      },
      link: function (scope, elem) {
        scope.rendered = false;

        var base = elem.parent().inheritedData('$uiView').state;

        function buildTableRowOpenTag(instance) {
          var activeClass = $state.includes('**.instanceDetails', {instanceId: instance.id, provider: instance.provider }) ? ' info' : ' ';
          return '<tr class="clickable instance-row ' + activeClass + '"' +
            ' data-provider="' + instance.provider + '"' +
            ' data-instance-id="' + instance.id + '">';
        }

        function buildInstanceIdCell(row, instance) {
          var status = instance.healthState;
          row += '<td><span class="glyphicon glyphicon-' + status + '-triangle"></span> ' +
            instance.id + '</td>';
          return row;
        }

        function buildLaunchTimeCell(row, instance) {
          row += '<td>' + $filter('timestamp')(instance.launchTime) + '</td>';
          return row;
        }

        function buildZoneCell(row, instance) {
          row += '<td>' + instance.availabilityZone + '</td>';
          return row;
        }

        function buildDiscoveryCell(row, discoveryStatus) {
          row += '<td class="text-center small">' + discoveryStatus + '</td>';
          return row;
        }

        function buildLoadBalancersCell(row, loadBalancers) {
          row += '<td>';
          loadBalancers.forEach(function (loadBalancer) {
            var tooltip = loadBalancer.state === 'OutOfService' ? loadBalancer.description.replace(/"/g, '&quot;') : null;
            var icon = loadBalancer.state === 'InService' ? 'up' : 'down';
            if (tooltip) {
              row += '<div data-toggle="tooltip" title="' + tooltip + '">';
            } else {
              row += '<div>';
            }
            row += '<span class="glyphicon glyphicon-' + icon + '-triangle"></span> ';
            row += loadBalancer.name;
            row += '</div>';
          });
          if (!loadBalancers.length) {
            row += '-';
          }
          row += '</td>';
          return row;
        }

        function renderInstances() {
          $('[data-toggle="tooltip"]', elem).tooltip('destroy');
          var instances = scope.instances || [],
            filtered = instances.filter(clusterFilterService.shouldShowInstance),
            sorted = $filter('orderBy')(filtered, scope.sortFilter.instanceSort.key);

          elem.get(0).innerHTML = sorted.map(function (instance) {<commit_msg>fix icon on load balancer health in instance details<commit_after>'use strict';


angular.module('deckApp')
  .directive('instanceList', function(clusterFilterService) {
    return {
      restrict: 'E',
      templateUrl: 'scripts/modules/instance/instanceList.html',
      scope: {
        instances: '=',
        sortFilter: '=',
      },
      link: function(scope) {
        scope.updateQueryParams = clusterFilterService.updateQueryParams;
      }
    };
  })
  .directive('instanceListBody', function ($timeout, $filter, $rootScope, $state, scrollTriggerService, clusterFilterService) {
    return {
      restrict: 'C',
      scope: {
        instances: '=',
        sortFilter: '=',
        renderInstancesOnScroll: '=',
      },
      link: function (scope, elem) {
        scope.rendered = false;

        var base = elem.parent().inheritedData('$uiView').state;

        function buildTableRowOpenTag(instance) {
          var activeClass = $state.includes('**.instanceDetails', {instanceId: instance.id, provider: instance.provider }) ? ' info' : ' ';
          return '<tr class="clickable instance-row ' + activeClass + '"' +
            ' data-provider="' + instance.provider + '"' +
            ' data-instance-id="' + instance.id + '">';
        }

        function buildInstanceIdCell(row, instance) {
          var status = instance.healthState;
          row += '<td><span class="glyphicon glyphicon-' + status + '-triangle"></span> ' +
            instance.id + '</td>';
          return row;
        }

        function buildLaunchTimeCell(row, instance) {
          row += '<td>' + $filter('timestamp')(instance.launchTime) + '</td>';
          return row;
        }

        function buildZoneCell(row, instance) {
          row += '<td>' + instance.availabilityZone + '</td>';
          return row;
        }

        function buildDiscoveryCell(row, discoveryStatus) {
          row += '<td class="text-center small">' + discoveryStatus + '</td>';
          return row;
        }

        function buildLoadBalancersCell(row, loadBalancers) {
          row += '<td>';
          loadBalancers.forEach(function (loadBalancer) {
            var tooltip = loadBalancer.state === 'OutOfService' ? loadBalancer.description.replace(/"/g, '&quot;') : null;
            var icon = loadBalancer.state === 'InService' ? 'Up' : 'Down';
            if (tooltip) {
              row += '<div data-toggle="tooltip" title="' + tooltip + '">';
            } else {
              row += '<div>';
            }
            row += '<span class="glyphicon glyphicon-' + icon + '-triangle"></span> ';
            row += loadBalancer.name;
            row += '</div>';
          });
          if (!loadBalancers.length) {
            row += '-';
          }
          row += '</td>';
          return row;
        }

        function renderInstances() {
          $('[data-toggle="tooltip"]', elem).tooltip('destroy');
          var instances = scope.instances || [],
            filtered = instances.filter(clusterFilterService.shouldShowInstance),
            sorted = $filter('orderBy')(filtered, scope.sortFilter.instanceSort.key);

          elem.get(0).innerHTML = sorted.map(function (instance) {
{'fraction_non_alphanumeric': 0.15498039215686274, 'fraction_numerical': 0.00031372549019607844, 'mean_word_length': 2.1737182677949227, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '3130957', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1707, 'n_words': 342}