<div grr-force-refresh refresh-trigger="controller.fileDetails">

  <div ng-if="controller.fileDetails === undefined">
    Loading...
  </div>

  <div ng-if="controller.fileDetails !== undefined">

    <div ng-if="controller.fileDetails.value.hash">
      <h4>Hash</h4>
      <span>
        <grr-semantic-value value="controller.fileDetails.value.hash" />
      </span>
    </div>

    <div ng-if="controller.fileDetails.value.last_collected">
      <h4>Last Collected</h4>
      <span>
        <grr-timestamp value="controller.fileDetails.value.last_collected" />
      </span>

      <h4>Download</h4>
      <p>
        <button class="btn btn-default"
                ng-click="controller.downloadFile()">
          Download ({$ controller.fileDetails.value.last_collected_size.value $} bytes)
        </button>
      </p>
      <p>
        Or by using command line export tool:
      </p>
      <div class="monospace">
        <pre>{$ controller.downloadCommand $}</pre>
      </div>
      <hr />
    </div>

    <div>
      <button class="btn btn-default"
              ng-click="controller.updateFile()"
              ng-disabled="controller.updateInProgress">
        <i class="fa fa-refresh"
           ng-class="{'fa-spin': controller.updateInProgress}"></i>
        {{ controller.fileDetails.value.last_collected ? 'Re-Collect' : 'Collect' }} from the client
      </button>
    </div>

  </div>

</div>
