<div class="clr-row" style="padding-left: 20px">
  <div class="clr-row flex-items-xs-between flex-items-xs-top" style="padding-left: 15px; padding-right: 15px;">
    <h3 class="header-title">{{'PVC.CREATE_TMP' | translate}}</h3>
  </div>
  <form [formGroup]="currentForm" style="padding-right: 30px;width: 100%">
    <wayne-box class="form-block wrap">
      <div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
        <label class="clr-col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
        <span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'PVC.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
        <div *ngFor="let cluster of clusters;let i=index"
             style="padding-right: 15px" class="checkbox-inline"
             [formGroupName]="i">
          <input formControlName="checked"
                 type="checkbox"
                 id="{{cluster.id}}-check">
          <label for="{{cluster.id}}-check">{{cluster.name}}</label>
        </div>
      </div>
      <div class="form-group form-group-padding">
        <label class="clr-col-md-3 form-group-label-override required">{{'TEMPLATE.RELEASE_EXPLAIN' | translate}}</label>
        <textarea formControlName="description"
                  rows="3"
                  style="width: 65%"
                  required>
        </textarea>
      </div>
      <div class="form-group form-group-padding">
        <label class="clr-col-md-3 form-group-label-override required">{{'PVC.CONTAINER_NUM' | translate}}</label>
        <input type="number" style="width: 200px"
               required
               formControlName="storage"
               [placeholder]="'PVC.CONTAINER_NUM' | translate">
        <span style="padding-top: 2px">G</span>
      </div>
      <div class="form-group form-group-padding">
        <label class="clr-col-md-3 form-group-label-override required">{{'PVC.ACCESS_PATTERN' | translate}}</label>
        <clr-checkbox-wrapper  class="clr-col-md-8">
            <input type="checkbox" formControlName="readWriteOnce" clrCheckbox name="readWriteOnce" value="readWriteOnce" />
            <label>ReadWriteOnce</label>
          </clr-checkbox-wrapper>
          <clr-checkbox-wrapper  class="clr-col-md-8">
            <input type="checkbox" formControlName="readOnlyMany" clrCheckbox name="readOnlyMany" value="readOnlyMany" />
            <label>ReadOnlyMany</label>
          </clr-checkbox-wrapper>
          <clr-checkbox-wrapper  class="clr-col-md-8">
            <input type="checkbox" formControlName="readWriteMany" clrCheckbox name="readWriteMany" value="readWriteMany" />
            <label>ReadWriteMany</label>
          </clr-checkbox-wrapper>
      </div>
      <label class="label-level2">关联标签
        <button (click)="onAddSelector()" style="margin-left: 10px;" class="wayne-button primary">
          <clr-icon shape="add-text"></clr-icon>
          添加</button>
      </label>
      <div formArrayName="selectors">
        <div *ngFor="let selector of selectors.controls; let i = index"
             [formGroupName]="i"
             class="form-group form-group-padding">
          <label class="clr-col-md-3 form-group-label-override">{{'PVC.ASSOCIATED_LABEL' | translate}}</label>
          <input type="text" style="width: 300px"
                 formControlName="key"
                 required
                 [placeholder]="'PLACEHOLDER.SELECTOR_NAME' | translate">
          <input type="text" style="width: 300px"
                 formControlName="value"
                 required
                 [placeholder]="'PLACEHOLDER.SELECTOR_VALUE' | translate">
          <a href="javascript:void(0)">
            <clr-icon (click)="onDeleteSelector(i)"
                      shape="trash" [title]="'PVC.DELETE_LABEL' | translate" class="is-solid clr-icon"></clr-icon>
          </a>
          <a href="javascript:void(0)">
            <clr-icon (click)="onAddSelector()"
                      shape="plus-circle" [title]="'PVC.ADD_LABEL' | translate" class="is-solid clr-icon"></clr-icon>
          </a>
        </div>
      </div>
    </wayne-box>
    <div class="clr-wizard-footer-buttons tpl-bottom" [style.top.px]="top">
      <button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
      <button type="button" class="btn btn-primary"
              (click)="openModal()">{{'BUTTON.ADVANCED_CONFIG' | translate}}</button>
      <button type="button" class="btn btn-primary" [disabled]="!isValid"
              (click)="onSubmit()">{{'BUTTON.SUBMIT' | translate}}</button>
    </div>
  </form>
</div>
<wayne-ace-editor (outputObj)="savePvcTpl($event)"></wayne-ace-editor>
