<clr-datagrid (clrDgRefresh)="refresh($event)">
  <clr-dg-column class="col-app-name" [clrDgField]="'name'">
    <ng-container *clrDgHideableColumn="showState['name']">
      {{'ADMIN.KUBERNETES.HPA.LIST.NAME' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'namespace'">
    <ng-container *clrDgHideableColumn="showState['namespace']">
      {{'ADMIN.KUBERNETES.HPA.LIST.NAMESPACE' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['label']">
      {{'ADMIN.KUBERNETES.HPA.LIST.LABEL' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['reference']">
      {{'ADMIN.KUBERNETES.HPA.LIST.REFERENCE' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['targets']">
      {{'ADMIN.KUBERNETES.HPA.LIST.TARGETS' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['minpods']">
      {{'ADMIN.KUBERNETES.HPA.LIST.MINPODS' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['maxpods']">
      {{'ADMIN.KUBERNETES.HPA.LIST.MAXPODS' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['replicas']">
      {{'ADMIN.KUBERNETES.HPA.LIST.REPLICAS' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'creationTimestamp'">
    <ng-container *clrDgHideableColumn="showState['age']">
      {{'ADMIN.KUBERNETES.HPA.LIST.AGE' | translate}}
    </ng-container>
  </clr-dg-column>


  <clr-dg-row *ngFor="let obj of resources" [clrDgItem]="obj">
    <clr-dg-action-overflow>
      <button class="action-item" (click)="onEditEvent(obj)">{{'ADMIN.KUBERNETES.ACTION.EDIT' | translate}}</button>
      <button class="action-item" (click)="onDeleteEvent(obj)">{{'ADMIN.KUBERNETES.ACTION.DELETE' | translate}}</button>
      <button class="action-item" (click)="migrationResource(obj)">{{'ADMIN.KUBERNETES.ACTION.MIGRATION' | translate}}</button>
    </clr-dg-action-overflow>
    <clr-dg-cell class="col-app-name"> {{ obj.metadata.name }} </clr-dg-cell>
    <clr-dg-cell> {{ obj.metadata.namespace }} </clr-dg-cell>
    <clr-dg-cell>
      <div *ngFor="let label of obj.metadata.labels | keyvalue" class="version-text">
        <a href="javascript:" (click)="versionDetail(label.key + ': ' + label.value)">{{label.key}}: {{label.value}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell> {{ obj.spec.scaleTargetRef?.kind}}/{{ obj.spec.scaleTargetRef?.name}} </clr-dg-cell>
    <clr-dg-cell> {{ obj.status.currentCPUUtilizationPercentage !== undefined ? obj.status.currentCPUUtilizationPercentage + '%' : 'unknown'}}/{{ obj.spec.targetCPUUtilizationPercentage }}% </clr-dg-cell>
    <clr-dg-cell> {{ obj.spec.minReplicas}}</clr-dg-cell>
    <clr-dg-cell> {{ obj.spec.maxReplicas}}</clr-dg-cell>
    <clr-dg-cell> {{ obj.status.currentReplicas}}</clr-dg-cell>
    <clr-dg-cell> {{ obj.metadata.creationTimestamp | relativeTime}} </clr-dg-cell>
  </clr-dg-row>
  <clr-dg-footer>
    <wayne-paginate
      [(currentPage)]="currentPage"
      [total]="page.totalCount"
      [pageSizes]="[10, 20, 50]"
      (sizeChange)="pageSizeChange($event)">
    </wayne-paginate>
  </clr-dg-footer>
</clr-datagrid>
