<div *ngVar="(contentSource$ |async) as contentSource">
  @if (shouldShow) {
    <div class="container-fluid space-children-mr">
      <h3>{{ 'collection.source.controls.head' | translate }}</h3>
      <div>
        <span class="fw-bold">{{'collection.source.controls.harvest.status' | translate}}</span>
        <span>{{contentSource?.harvestStatus}}</span>
      </div>
      <div>
        <span class="fw-bold">{{'collection.source.controls.harvest.start' | translate}}</span>
        <span>{{contentSource?.harvestStartTime ? contentSource?.harvestStartTime : 'collection.source.controls.harvest.no-information'|translate }}</span>
      </div>
      <div>
        <span class="fw-bold">{{'collection.source.controls.harvest.last' | translate}}</span>
        <span>{{contentSource?.lastHarvested ? contentSource?.lastHarvested : 'collection.source.controls.harvest.no-information'|translate }}</span>
      </div>
      <div>
        <span class="fw-bold">{{'collection.source.controls.harvest.message' | translate}}</span>
        <span>{{contentSource?.message ? contentSource?.message: 'collection.source.controls.harvest.no-information'|translate }}</span>
      </div>
      @if ((testConfigRunning$ |async) !== true) {
        <button class="btn btn-secondary"
          [dsBtnDisabled]="!(isEnabled)"
          (click)="testConfiguration(contentSource)">
          <span>{{'collection.source.controls.test.submit' | translate}}</span>
        </button>
      }
      @if ((testConfigRunning$ |async)) {
        <button class="btn btn-secondary"
          [dsBtnDisabled]="true">
          <span class="spinner-border spinner-border-sm spinner-button" role="status" aria-hidden="true"></span>
          <span>{{'collection.source.controls.test.running' | translate}}</span>
        </button>
      }
      @if ((importRunning$ |async) !== true) {
        <button class="btn btn-primary"
          [dsBtnDisabled]="!(isEnabled)"
          (click)="importNow()">
          <span class="d-none d-sm-inline">{{'collection.source.controls.import.submit' | translate}}</span>
        </button>
      }
      @if ((importRunning$ |async)) {
        <button class="btn btn-primary"
          [dsBtnDisabled]="true">
          <span class="spinner-border spinner-border-sm spinner-button" role="status" aria-hidden="true"></span>
          <span class="d-none d-sm-inline">{{'collection.source.controls.import.running' | translate}}</span>
        </button>
      }
      @if ((reImportRunning$ |async) !== true) {
        <button class="btn btn-primary"
          [dsBtnDisabled]="!(isEnabled)"
          (click)="resetAndReimport()">
          <span class="d-none d-sm-inline">&nbsp;{{'collection.source.controls.reset.submit' | translate}}</span>
        </button>
      }
      @if ((reImportRunning$ |async)) {
        <button class="btn btn-primary"
          [dsBtnDisabled]="true">
          <span class="spinner-border spinner-border-sm spinner-button" role="status" aria-hidden="true"></span>
          <span class="d-none d-sm-inline">&nbsp;{{'collection.source.controls.reset.running' | translate}}</span>
        </button>
      }
    </div>
  }
</div>
