{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<table class="table table-expandable">
  <thead>
    <tr>
      {{#each column in columns}}
        <th>
          {{#if column.caption}}
            {{column-filter-widget class="pull-left"
                                   column=column
                                   filterValue=column.filterValue
                                   sortAscending=controller.sortAscending
                                   sortProperties=controller.sortProperties
                                   columnSorted="sort"
                                   columnFiltered="filter"}}
          {{else}}
            {{tb-helper "caption" column}}
          {{/if}}
        </th>
      {{/each}}
      <th>
        <button type="btn" class="btn btn-sm btn-warning pull-right clear-filters" {{action "clearFilters"}}>{{t "buttons.clearFilters"}}</button>
      </th>
    </tr>
  </thead>
  <tbody>
    {{#each item in this}}
      <tr class="main-row" {{action "loadFile"}}>
        <td>
        {{#link-to "index.historyQuery" item}}
          {{item.title}}
        {{/link-to}}
        </td>
        <td {{bind-attr class=item.uppercaseStatus}}>{{all-uppercase item.status}}</td>
        <td>{{date-binding item "dateSubmittedTimestamp"}}</td>
        <td>{{item.duration}}</td>
        <td>
          <a class="fa fa-expand pull-right"></a>
        </td>
      </tr>
      {{#if controller.expanded}}
        <tr class="secondary-row">
          <td {{bind-attr colspan=view.colspan}}>
            {{code-helper controller.file.fileContent}}

            {{#if controller.canStop}}
              <button type="button" class="btn btn-danger btn-sm pull-right" {{action "stop"}}>{{t "buttons.stopJob"}}</button>
            {{/if}}
          </td>
        </tr>
      {{/if}}
    {{/each}}
  </tbody>
</table>