<table class="table table-chrome table-striped expand-collapse-sandbox">
  <thead>
    <tr>
      <th class="sorts" <%- sortKeyAttribute %>="name">
        <a href="#"><%= _('Index Name').t() %><i class="icon-sorts"></i></a>
      </th>
      <th class="sorts" <%- sortKeyAttribute %>="is_searchable">
        <a href="#"><%= _('Fully Searchable').t() %><i class="icon-sorts"></i></a>
      </th>
      <th class="sorts" <%- sortKeyAttribute %>="searchable_copies_tracker">
        <a href="#"><%= _('Searchable Data Copies').t() %><i class="icon-sorts"></i></a>
      </th>
      <th class="sorts" <%- sortKeyAttribute %>="replicated_copies_tracker">
        <a href="#"><%= _('Replicated Data Copies').t() %><i class="icon-sorts"></i></a>
      </th>
      <th class="sorts" <%- sortKeyAttribute %>="num_buckets">
        <a href="#"><%= _('Buckets').t() %><i class="icon-sorts"></i></a> <sup><a class="tooltip-link" rel="tooltip" data-title="<%= _('Buckets are directories where Splunk stores indexed data.').t() %>" data-original-title="">?</a></sup>
      </th>
      <th class="sorts" <%- sortKeyAttribute %>="index_size">
        <a href="#"><%= _('Cumulative Raw Data Size').t() %><i class="icon-sorts"></i></a>
      </th>
    </tr>
  </thead>
  <tbody>
  <% eachRow(collection, function(indexModel, index, rowNumber, isExpanded) { %>
    <% var num_buckets = indexModel.entry.content.get('num_buckets');
      var buckets_with_excess_copies = indexModel.entry.content.get('buckets_with_excess_copies');
      var buckets_with_excess_searchable_copies = indexModel.entry.content.get('buckets_with_excess_searchable_copies');
      var total_excess_bucket_copies = indexModel.entry.content.get('total_excess_bucket_copies');
      var total_excess_searchable_copies = indexModel.entry.content.get('total_excess_searchable_copies');
    %>
    <tr class="list-item">
      <td><%-indexModel.entry.get('name')%></td>
      <td><%if (splunkUtil.normalizeBoolean(indexModel.entry.content.get('is_searchable'))) {%>
        <i class="icon-check"></i><%= _('Yes').t() %>
        <%} else {%>
        <i class="icon-alert"></i><%= _('No').t() %>
        <%} %>
      </td>
      <td>
        <span style="margin-right: 10px"><%- _.size(indexModel.entry.content.get('searchable_copies_tracker')) %></span>
        <div class="bucket-group">
          <% _.each(indexModel.entry.content.get('searchable_copies_tracker'), function(obj, key) {%><% if (obj.actual_copies_per_slot == obj.expected_total_per_slot){%><div class="bucket bucket-tooltip tooltip-link complete" rel="tooltip" data-title="<%= obj.actual_copies_per_slot %> / <%- obj.expected_total_per_slot %> <%= _('Buckets').t() %>" data-original-title=""></div><% }else{ %><a href="clustering_bucket_details?index=<%- indexModel.entry.get('name') %>&tab=fixup-buckets-tab&level=search_factor" class="bucket bucket-tooltip tooltip-link building" rel="tooltip" data-title="<%= obj.actual_copies_per_slot %> / <%- obj.expected_total_per_slot %> <%= _('Buckets').t() + _('\nClick for details').t() %>" data-original-title=""><div class="bucket-progress-bar" style="height: <%- (obj.actual_copies_per_slot/obj.expected_total_per_slot)*100 %>%"></div></a><% } %><% }); %>
        </div>
      </td>
      <td>
        <span style="margin-right: 10px"><%- _.size(indexModel.entry.content.get('replicated_copies_tracker')) %></span>
        <div class="bucket-group">
          <% _.each(indexModel.entry.content.get('replicated_copies_tracker'), function(obj, key) {%><% if (obj.actual_copies_per_slot == obj.expected_total_per_slot){%><div class="bucket bucket-tooltip tooltip-link  complete" rel="tooltip" data-title="<%= obj.actual_copies_per_slot%> / <%-obj.expected_total_per_slot %> <%= _('Buckets').t() %>" data-original-title=""></div><% }else{ %><a href="clustering_bucket_details?index=<%- indexModel.entry.get('name') %>&tab=fixup-buckets-tab&level=replication_factor" class="bucket bucket-tooltip tooltip-link  building" rel="tooltip" data-title="<%= obj.actual_copies_per_slot %> / <%- obj.expected_total_per_slot %> <%= _('Buckets').t() + _('\nClick for details').t() %>" data-original-title=""><div class="bucket-progress-bar" style="height: <%- (obj.actual_copies_per_slot/obj.expected_total_per_slot)*100 %>%"></div></a><% } %><% }); %>
        </div>
      </td>
      <td>
        <%- num_buckets %>
        <% var indexName = indexModel.entry.get('name');
          /* var counts = {
            checksum_sync: (fixups.getModel('checksum_sync') && fixups.getModel('checksum_sync').getBucketNames(indexName).length) || 0,
            data_safety: (fixups.getModel('data_safety') && fixups.getModel('data_safety').getBucketNames(indexName).length) || 0,
            generation: (fixups.getModel('generation') && fixups.getModel('generation').getBucketNames(indexName).length) || 0,
            replication_factor: (fixups.getModel('replication_factor') && fixups.getModel('replication_factor').getBucketNames(indexName).length) || 0,
            search_factor: (fixups.getModel('search_factor') && fixups.getModel('search_factor').getBucketNames(indexName).length) || 0,
            streaming: (fixups.getModel('streaming') && fixups.getModel('streaming').getBucketNames(indexName).length) || 0
          }; */ %>
        <a class="tooltip-link" rel="tooltip" style="display: none;"
           data-title="<% /* print(_('Fixups:\nChecksum_sync: ').t() + counts.checksum_sync
              + _('\ndata_safety: ').t() + counts.data_safety
              + _('\ngeneration: ').t() + counts.generation
              + _('\nreplication factor: ').t() + counts.replication_factor
              + _('\nsearch factor: ').t() + counts.search_factor
              + _('\nstreaming: ').t() + counts.streaming
              + _('\n\nNumber of buckets with excess replication copies: ').t() + buckets_with_excess_copies
              + _('\nNumber of buckets with excess searchable copies: ').t() + buckets_with_excess_searchable_copies
              + _('\nTotal excess replication copies: ').t() + total_excess_bucket_copies
              + _('\nTotal excess searchable copies: ').t() + total_excess_searchable_copies
              ) */ %>"
           data-original-title="">
          <i class="icon-alert"></i>
        </a>
        <a class="btn" href="clustering_bucket_details" style="display: none;">details</a></td>
      <td><%- convertToGygabytes(indexModel.entry.content.get('index_size')) %> </td>
    </tr>
  <% }) %>
  </tbody>
</table>
