<clr-datagrid (clrDgRefresh)="refresh($event)" [(clrDgSelected)]="selectedTemplate" class="wayne-clr-datagrid">
  <clr-dg-placeholder>暂无数据！</clr-dg-placeholder>
  <clr-dg-column class="col-id" [clrDgSortBy]="'id'">
    <ng-container *clrDgHideableColumn="showState['id']">
      #
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-time" [clrDgSortBy]="'createTime'">
    <ng-container *clrDgHideableColumn="showState['createTime']">
      {{'TITLE.CREATE_TIME' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-cluster">
    <ng-container *clrDgHideableColumn="showState['cluster']">
      {{'TITLE.ONLINE_CLUSTER' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-description">
    <ng-container *clrDgHideableColumn="showState['description']">
      {{'TITLE.RELEASE_EXPLAIN' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['user']">
      {{'TITLE.CREATE_USER' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-column class="col-operate">
    <ng-container *clrDgHideableColumn="showState['action']">
      {{'TITLE.ACTION' | translate}}
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let template of templates" [clrDgItem]="template">
    <clr-dg-cell class="col-id">{{template.id}}</clr-dg-cell>
    <clr-dg-cell class="col-time">{{template.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
    <clr-dg-cell class="col-cluster" >
      <div class="form-group" style="padding-bottom: 2px"
           *ngFor="let status of template.status">
        <a href="javascript:void(0)" (click)="showResourceState(status,template)" title="{{'HPA.TIP.VIEW_STATUS' | translate}}" class="label"
           [class.clickable]="status.state!=2"
           [class.label-success]="status.state==0"
           [class.label-warning]="status.state==1">
          {{status.cluster}}
        </a>
      </div>
    </clr-dg-cell>
    <clr-dg-cell class="col-description">{{template.description}}</clr-dg-cell>
    <clr-dg-cell class="col-user">{{template.user}}</clr-dg-cell>
    <clr-dg-cell class="col-operate">
      <button class="wayne-button text"
              (click)="onPublishResourceTemplate(template)"
              *ngIf="authService.currentAppPermission.autoscale.deploy || authService.currentUser.admin">
        {{'BUTTON.RELEASE' | translate}}</button>
      <button class="wayne-button text"
              (click)="onViewTemplate(template)"
              *ngIf="authService.currentAppPermission.autoscale.read || authService.currentUser.admin">
        {{'BUTTON.DETAIL' | translate}}</button>
      <button class="wayne-button text"
              (click)="oncloneTemplate(template)"
              *ngIf="authService.currentAppPermission.autoscale.create || authService.currentUser.admin">
        {{'BUTTON.CLONE' | translate}}</button>
      <button class="wayne-button text"
              *ngIf="!template.status && (authService.currentAppPermission.autoscale.delete || authService.currentUser.admin)"
              (click)="onDeleteTemplate('删除 HPA 模版确认', '你确认删除 HPA 模版', template)">
        {{'BUTTON.DELETE' | translate}}</button>
      <button class="wayne-button text"
              (click)="onOfflineResourceTemplate(template)"
              *ngIf="template.status && (authService.currentAppPermission.autoscale.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>
<wayne-publish-tpl [appId]="appId" (published)="onPublishEvent($event)"></wayne-publish-tpl>
<wayne-status></wayne-status>

