<div *ngIf="object" class="fl-content" layoutDirection="column">
  <ng-container *ngIf="poolList && poolList.objects.length > 0; else noPools">
    <table mat-table [dataSource]="poolList.objects" class="full-width fl-margin-bottom">
      <ng-container matColumnDef="name">
        <th mat-header-cell *matHeaderCellDef i18n>Name</th>
        <td mat-cell *matCellDef="let pool" class="pool-name">
          <a class="active-link"
             [routerLink]="[config.getPanelUrl('openstack/load-balancers'), object.id, 'pools', pool.id]"
             [queryParamsHandling]="'merge'">
            {{pool.name | nullValue }}
          </a>
        </td>
      </ng-container>
      <ng-container matColumnDef="protocol">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Protocol</th>
        <td mat-cell *matCellDef="let pool" class="hide-xs">
          {{pool.protocol}}
        </td>
      </ng-container>
      <ng-container matColumnDef="lb_algorithm">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Algorithm</th>
        <td mat-cell *matCellDef="let pool" class="hide-xs">
          {{pool.lb_algorithm}}
        </td>
      </ng-container>
      <ng-container matColumnDef="operating_status">
        <th mat-header-cell *matHeaderCellDef i18n>Operating status</th>
        <td mat-cell *matCellDef="let pool">
          {{pool.operating_status}}
        </td>
      </ng-container>
      <ng-container matColumnDef="provisioning_status">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Provisioning status</th>
        <td mat-cell *matCellDef="let pool" class="hide-xs">
          {{pool.provisioning_status}}
        </td>
      </ng-container>
      <ng-container matColumnDef="admin_state_up">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Admin state up</th>
        <td mat-cell *matCellDef="let pool" class="hide-xs">
          {{pool.admin_state_up | yesNo}}
        </td>
      </ng-container>
      <ng-container matColumnDef="(actions)">
        <th mat-header-cell *matHeaderCellDef i18n></th>
        <td mat-cell *matCellDef="let pool" i18n>
          <app-object-actions [objectActions]="poolActions[pool.id]" [maxVisibleActions]="2">
          </app-object-actions>
        </td>
      </ng-container>
      <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
      <tr mat-row *matRowDef="let pool; columns: displayedColumns;"></tr>
    </table>
  </ng-container>
  <ng-template #noPools>
    <p *ngIf="poolList" class="fl-detail fl-margin-bottom" layoutAlign="center center" i18n>No pools.</p>
    <p *ngIf="!poolList && !cannotRetrieve" class="fl-detail fl-margin-bottom" layoutAlign="center center"
       i18n>Loading pools ...</p>
    <p *ngIf="!poolList && cannotRetrieve" class="fl-detail fl-margin-bottom fl-red-color" layoutAlign="center center"
       i18n>Unable to retrieve pools, please contact support.</p>
  </ng-template>
  <div layoutDirection="row" layoutAlign="center center">
    <a mat-fab [disabled]="cannotRetrieve" fl-tooltip="Create pool" i18n-fl-tooltip
       [routerLink]="[config.getPanelUrl('openstack/load-balancers', object.id), 'pools', 'create']"
       [queryParamsHandling]="'merge'">
      <mat-icon>add</mat-icon>
    </a>
  </div>
</div>
