<div class="row" ng-controller="Developer.JenkinsJobsController">
  <script type="text/ng-template" id="jenkinsJobNameTemplate.html">
    <div class="ngCellText" title="{{row.entity.fullDisplayName}} {{row.entity.result}}">
      <a href="{{row.entity.$buildsLink}}">
        <i class="{{row.entity.$iconClass}}"></i>&nbsp;&nbsp;{{row.entity.displayName}}
      </a>
    </div>
  </script>
  <script type="text/ng-template" id="jenkinsJobButtonsTemplate.html">
    <div class="ngCellText">
      <a class="btn btn-default" href="{{row.entity.$pipelinesLink}}" ng-show="row.entity.$pipelinesLink" title="View the pipelines for this build">
        <i class="fa fa-tasks"></i> Pipelines
      </a>
    </div>
  </script>
  <script type="text/ng-template" id="jenkinsBuildTimestampTemplate.html">
    <div class="ngCellText" title="Build started at: {{row.entity.$timestamp}}">
      {{row.entity.$timestamp.relative()}}
    </div>
  </script>
  <script type="text/ng-template" id="jenkinsBuildDurationTemplate.html">
    <div class="ngCellText" title="Build took {{row.entity.$duration}} milliseconds">
      {{row.entity.$duration.duration()}}
    </div>
  </script>
  <script type="text/ng-template" id="jenkinsLastSuccessTemplate.html">
    <div class="ngCellText"  ng-init="success=row.entity.lastSuccessfulBuild">
      <span title="Build took {{success.$duration.duration()}} milliseconds">
      <span ng-show="success">
        {{success.$timestamp.relative()}}
      </span>
      <span ng-show="success.$buildLink">
        -
        <a href="{{success.$buildLink}}" target="build" title="View the builds">
          {{success.displayName}}
        </a>
      </span>
      </span>
    </div>
  </script>
  <script type="text/ng-template" id="jenkinsLastFailureTemplate.html">
    <div class="ngCellText" ng-init="fail=row.entity.lastFailedBuild">
      <span title="Build took {{fail.$duration.duration()}} milliseconds">
      <span ng-show="fail">
        {{fail.$timestamp.relative()}}
      </span>
      <span ng-show="fail.$buildLink">
        -
        <a href="{{fail.$buildLink}}" target="build" title="View the builds">
          {{fail.displayName}}
        </a>
      </span>
      </span>
    </div>
  </script>


  <div class="row">
    <div hawtio-breadcrumbs></div>
  </div>

  <div class="row">
    <div hawtio-tabs></div>
  </div>

  <div class="row filter-header">
    <div class="col-md-12">
      <span>
        <hawtio-filter ng-show="jenkins.jobs.length"
                       ng-model="tableConfig.filterOptions.filterText"
                       css-class="input-xxlarge"
                       placeholder="Filter jobs..."></hawtio-filter>
      </span>
      <a class="btn btn-primary pull-right" ng-click="triggerBuild()"
         title="Trigger this build">
        <i class="fa fa-play-circle-o"></i>  Trigger</a>
      </a>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <div ng-hide="model.fetched">
        <div class="align-center">
          <i class="fa fa-spinner fa-spin"></i>
        </div>
      </div>
      <div ng-show="model.fetched">
        <div ng-hide="jenkins.jobs.length" class="align-center">
          <p class="alert alert-info">There are no jobs in this jenkins.</p>
        </div>
        <div ng-show="jenkins.jobs.length">
          <table class="table table-bordered table-striped" hawtio-simple-table="tableConfig"></table>
        </div>
      </div>
    </div>
  </div>
</div>
