<clr-modal [(clrModalOpen)]="modalOpened" [clrModalSize]="'xl'">
  <h3 class="modal-title">
    {{'POD.LIST' | translate}}
  </h3>
  <div class="modal-body">
    <hr>
    <div class="toggle-switch">
      <input type="checkbox" id="toggle_4" [(ngModel)]="whetherHotReflash">
      <label for="toggle_4">{{'POD.DATA_UPDATE' | translate}}</label>
    </div>
    <clr-datagrid>
      <clr-dg-placeholder>{{'MESSAGE.NO_MESSAGE' | translate}}</clr-dg-placeholder>
      <clr-dg-column [clrDgField]="'name'">
        <ng-container *clrDgHideableColumn="{hidden: false}">
         {{'TITLE.NAME' | translate}}
        </ng-container>
      </clr-dg-column>
      <clr-dg-column [clrDgSortBy]="stateComparator">
        <ng-container *clrDgHideableColumn="{hidden: false}">
          {{'TITLE.STATUS' | translate}}
        </ng-container>
      </clr-dg-column>
      <clr-dg-column [clrDgField]="'podIp'">
        <ng-container *clrDgHideableColumn="{hidden: false}">
          PODIP
        </ng-container>
      </clr-dg-column>
      <clr-dg-column *ngIf="authService.currentUser.admin">
        <ng-container *clrDgHideableColumn="{hidden: false}">
          NodeName
        </ng-container>
      </clr-dg-column>
      <clr-dg-column>
        <ng-container *clrDgHideableColumn="{hidden: false}">
          {{'POD.RESTART_NUM' | translate}}
        </ng-container>
      </clr-dg-column>
      <clr-dg-column [clrDgSortBy]="timeComparator" [(clrDgSortOrder)]="sortOrder">
        <ng-container *clrDgHideableColumn="{hidden: false}">
          Age
        </ng-container>
      </clr-dg-column>
      <clr-dg-column>
        <ng-container *clrDgHideableColumn="{hidden: false}">
          {{'TITLE.ACTION' | translate}}
        </ng-container>
      </clr-dg-column>
      <clr-dg-row *clrDgItems="let pod of pods">
        <clr-dg-cell class="copy">{{pod.name}}</clr-dg-cell>
        <clr-dg-cell>
          <span class="label label-light-blue"
                [class.label-danger]="pod.state!=='Running' && pod.state!=='Pending'"
                [class.label-success]="pod.state==='Running'"
                [class.label-warning]="pod.state==='Pending'">{{pod.state}}</span>
        </clr-dg-cell>
        <clr-dg-cell>{{pod.podIp}}</clr-dg-cell>
        <clr-dg-cell *ngIf="authService.currentUser.admin">{{pod.nodeName}}</clr-dg-cell>
        <clr-dg-cell>
          <span *ngFor="let state of pod.containerStatus" class="label label-light-blue"
                [class.label-danger]="state.restartCount > 10"
                [class.label-success]="state.restartCount === 0"
                [class.label-warning]="state.restartCount > 0 && state.restartCount <= 10"
          >
            {{state.name}} : {{state.restartCount}}
          </span>
        </clr-dg-cell>
        <clr-dg-cell>{{pod.startTime | relativeTime}}</clr-dg-cell>
        <clr-dg-cell>
          <button class="wayne-button text" (click)="enterContainer(pod)"> {{'POD.ENTER_CONTAINER' | translate}}</button>
          <button *ngIf="logSource" class="wayne-button text" (click)="copyLogCommand(pod)">{{'POD.LOG_COMMAND' | translate}}</button>
          <button class="wayne-button text" (click)="podLog(pod)"> {{'POD.LOG' | translate}}</button>
          <button class="wayne-button text" (click)="deletePod(pod)">{{'BUTTON.DELETE' | translate}}</button>
        </clr-dg-cell>
      </clr-dg-row>
      <clr-dg-footer>
        {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} of {{pagination.totalItems}}
        <clr-dg-pagination #pagination [clrDgPageSize]="10"></clr-dg-pagination>
      </clr-dg-footer>
    </clr-datagrid>
  </div>
</clr-modal>
