<div *ngIf="object" class="fl-content" layoutDirection="column">
  <ng-container *ngIf="memberList && memberList.objects.length > 0; else noMembers">
    <table mat-table [dataSource]="memberList.objects" class="full-width fl-margin-bottom">
      <ng-container matColumnDef="name">
        <th mat-header-cell *matHeaderCellDef i18n>Name</th>
        <td mat-cell *matCellDef="let member">
          <a class="active-link"
             [routerLink]="[config.getPanelUrl('openstack/load-balancers'), loadBalancerId, 'pools', object.id, 'member', member.id]"
             [queryParamsHandling]="'merge'">
            {{member.name}}
          </a>
        </td>
      </ng-container>
      <ng-container matColumnDef="address">
        <th mat-header-cell *matHeaderCellDef i18n>IP address</th>
        <td mat-cell *matCellDef="let member">
          {{member.address}}
        </td>
      </ng-container>
      <ng-container matColumnDef="protocol_port">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Port</th>
        <td mat-cell *matCellDef="let member" class="hide-xs">
          {{member.protocol_port}}
        </td>
      </ng-container>
      <ng-container matColumnDef="weight">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Weight</th>
        <td mat-cell *matCellDef="let member" class="hide-xs">
          {{member.weight}}
        </td>
      </ng-container>
      <ng-container matColumnDef="backup">
        <th mat-header-cell *matHeaderCellDef class="hide-xs" i18n>Backup</th>
        <td mat-cell *matCellDef="let member" class="hide-xs">
          {{member.backup_display}}
        </td>
      </ng-container>
      <ng-container matColumnDef="operating_status">
        <th mat-header-cell *matHeaderCellDef i18n>Operating status</th>
        <td mat-cell *matCellDef="let member">
          {{member.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 member" class="hide-xs">
          {{member.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 member" class="hide-xs">
          {{member.admin_state_up_display}}
        </td>
      </ng-container>
      <ng-container matColumnDef="(actions)">
        <th mat-header-cell *matHeaderCellDef i18n></th>
        <td mat-cell *matCellDef="let member">
          <app-object-actions [objectActions]="memberActions[member.id]" [maxVisibleActions]="2">
          </app-object-actions>
        </td>
      </ng-container>
      <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
      <tr mat-row *matRowDef="let member; columns: displayedColumns;"></tr>
    </table>
  </ng-container>
  <ng-template #noMembers>
    <p *ngIf="memberList" class="fl-detail fl-margin-bottom" layoutAlign="center center" i18n>No members.</p>
    <p *ngIf="!memberList" class="fl-detail fl-margin-bottom" layoutAlign="center center" i18n>Loading members ...</p>
  </ng-template>
  <div layoutDirection="row" layoutAlign="center center">
    <a mat-fab fl-tooltip="Add member" i18n-fl-tooltip
       [routerLink]="[config.getPanelUrl('openstack/load-balancers', loadBalancerId), 'pools', object.id, 'members-create']"
       [queryParamsHandling]="'merge'">
      <mat-icon>add</mat-icon>
    </a>
  </div>
</div>
