<clr-datagrid (clrDgRefresh)="refresh($event)" [(clrDgSelected)]="selected" class="wayne-clr-datagrid">
  <clr-dg-placeholder>{{'MESSAGE.NO_MESSAGE' | translate}}</clr-dg-placeholder>
  <clr-dg-column [clrDgField]="'id'" class="col-id">
    <ng-container>
      ID
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgSortBy]="'createTime'" class="col-time">
    <ng-container *clrDgHideableColumn="showState['create_time']">
      {{'TITLE.CREATE_TIME' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-version">
    <ng-container *clrDgHideableColumn="showState['version']">
      {{'TITLE.VERSION' | translate}}
    </ng-container>
  </clr-dg-column>
  <!-- 防止事件图标换行-->
  <clr-dg-column class="col-cluster">
    <ng-container *clrDgHideableColumn="showState['online_cluster']">
      {{'TITLE.ONLINE_CLUSTER' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'description'">
    <ng-container *clrDgHideableColumn="showState['release_explain']">
      {{'TITLE.RELEASE_EXPLAIN' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'user'" class="col-user">
    <ng-container *clrDgHideableColumn="showState['create_user']">
      {{'TITLE.CREATE_USER' | translate}}
    </ng-container>
  </clr-dg-column>
  <!-- 防止操作图标换行-->
  <clr-dg-column style="min-width: 145px">
    <ng-container *clrDgHideableColumn="showState['action']">
      {{'TITLE.ACTION' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let daemonSetTpl of daemonSetTpls" [clrDgItem]="daemonSetTpl">
    <clr-dg-cell class="col-id">{{daemonSetTpl.id}}</clr-dg-cell>
    <clr-dg-cell class="col-time">{{daemonSetTpl.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    <clr-dg-cell class="col-version">
      <div *ngFor="let version of daemonSetTpl.containerVersions" class="version-text">
        <a href="javascript:;" (click)="versionDetail(version)">
          {{version}}
        </a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-cluster">
      <div class="form-group" style="padding-bottom: 2px"
           *ngFor="let status of daemonSetTpl.status">
        <a href="javascript:void(0)" (click)="listPod(status,daemonSetTpl)" class="label clickable"
           [class.clickable]="status.state!=2"
           [class.label-success]="status.state==0"
           [class.label-warning]="status.state==1">
          {{status.cluster}}
          <span *ngIf="status.desired">({{status.current}}/{{status.desired}})</span>
        </a>
        <a href="javascript:void(0)"
           *ngIf="status.warnings"
           (click)="listEvent(status.warnings)"
           style="color:#a32100">
          <clr-icon shape="error-standard"></clr-icon>
        </a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell>
      <div class="text-overflow"><a href="javascript:void(0)"
                                    (click)="tplDetail(daemonSetTpl)">{{daemonSetTpl.description}}</a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-user">{{daemonSetTpl.user}}</clr-dg-cell>
    <clr-dg-cell>
      <button class="wayne-button text"
              (click)="publishTpl(daemonSetTpl)"
              *ngIf="authService.currentAppPermission.daemonSet?.deploy || authService.currentUser.admin">
        {{'BUTTON.RELEASE' | translate}}</button>
      <button class="wayne-button text"
              (click)="daemonSetTplDetail(daemonSetTpl)"
              *ngIf="authService.currentAppPermission.daemonSet?.read || authService.currentUser.admin">
        {{'BUTTON.DETAIL' | translate}}</button>
      <button class="wayne-button text"
              (click)="cloneDaemonSetTpl(daemonSetTpl)"
              *ngIf="authService.currentAppPermission.daemonSet?.create || authService.currentUser.admin">
        {{'BUTTON.CLONE' | translate}}</button>
      <button class="wayne-button text"
              *ngIf="!daemonSetTpl.status && (authService.currentAppPermission.daemonSet?.delete || authService.currentUser.admin)"
              (click)="deleteDaemonSetTpl(daemonSetTpl)">
        {{'BUTTON.DELETE' | translate}}</button>
      <button class="wayne-button text"
              (click)="offlineDaemonSet(daemonSetTpl)"
              *ngIf="daemonSetTpl.status && (authService.currentAppPermission.daemonSet?.offline || authService.currentUser.admin)">
        {{'BUTTON.DROP' | translate}}</button>
    </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>
<wayne-ace-editor></wayne-ace-editor>
<list-event></list-event>
<list-pod [Type]="'daemonSet'"></list-pod>
<daemonset-publish-tpl (published)="published($event)"></daemonset-publish-tpl>
