<cd-table *ngIf="hostname || osdId !== null"
          [data]="devices"
          [columns]="columns"></cd-table>

<cd-alert-panel type="warning"
                *ngIf="hostname === '' && osdId === null"
                i18n>Neither hostname nor OSD ID given</cd-alert-panel>

<ng-template #deviceLocation
             let-value="data.value">
  <ng-container *ngFor="let location of value">
    <cd-label *ngIf="location.host === hostname"
              [value]="location.dev"></cd-label>
  </ng-container>
</ng-template>

<ng-template #daemonName
             let-value="data.value">
  <ng-container [ngTemplateOutlet]="osdId !== null ? osdIdDaemon : readableDaemons"
                [ngTemplateOutletContext]="{daemons: value}">
  </ng-container>
</ng-template>

<ng-template #osdIdDaemon
             let-daemons="daemons">
  <ng-container *ngFor="let daemon of daemons">
    <cd-label *ngIf="daemon.includes(osdId)"
              [value]="daemon"></cd-label>
  </ng-container>
</ng-template>

<ng-template #readableDaemons
             let-daemons="daemons">
  <ng-container *ngFor="let daemon of daemons">
    <cd-label class="me-1"
              [value]="daemon"></cd-label>
  </ng-container>
</ng-template>


<ng-template #lifeExpectancy
             let-value="data.value">
  <span *ngIf="!value?.life_expectancy_enabled"
        i18n>{{ "" | notAvailable }}</span>
  <span *ngIf="value?.min && !value?.max">&gt; {{value.min | i18nPlural: translationMapping}}</span>
  <span *ngIf="value?.max && !value?.min">&lt; {{value.max | i18nPlural: translationMapping}}</span>
  <span *ngIf="value?.max && value?.min">{{value.min}} to {{value.max | i18nPlural: translationMapping}}</span>
</ng-template>

<ng-template #lifeExpectancyTimestamp
             let-value="data.value">
  {{value}}
</ng-template>
