<clr-datagrid (clrDgRefresh)="refresh($event)">
  <clr-dg-column [clrDgField]="'name'">
    <ng-container *clrDgHideableColumn="showState['name']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.NAME' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['label']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.LABEL' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['type']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.TYPE' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['clusterIP']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.CLUSTERIP' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['port']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.PORT' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['externalIP']">
      {{'ADMIN.KUBERNETES.SERVICE.LIST.EXTERNALIP' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'creationTimestamp'">
    <ng-container *clrDgHideableColumn="showState['age']">
      {{'ADMIN.KUBERNETES.SERVICE.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> {{ obj.metadata.name }} </clr-dg-cell>
    <clr-dg-cell class="col-version">
      <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.type }}</clr-dg-cell>
    <clr-dg-cell> {{ obj.spec.clusterIP }}</clr-dg-cell>
    <clr-dg-cell title = "targetPort:port:nodePort/protocol"> {{ getPort(obj) }} </clr-dg-cell>
    <clr-dg-cell>
      <div *ngFor="let externalIP of obj.spec.externalIPs">
        {{ externalIP }}
      </div>
    </clr-dg-cell>
    <clr-dg-cell> {{ obj.metadata.creationTimestamp | relativeTime}} </clr-dg-cell>
    <service-detail *clrIfExpanded [obj]="obj" [cluster]="cluster" ngProjectAs="clr-dg-row-detail">
    </service-detail>
  </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>
