<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">{{'SECRET.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">{{'SECRET.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">
          {{'TEMPLATE.TYPE' | translate}}
          <a style="" role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
            <clr-icon shape="info-circle" size="24"></clr-icon>
            <span class="tooltip-content">
              类型说明：
              Opaque: 用户自定义数据
              <br>
              kubernetes.io/dockerconfigjson: ~/.docker/config.json格式
              <br>
              kubernetes.io/dockercfg: ~/.dockercfg 格式
              <br>
              kubernetes.io/service-account-token: 定义 service-account
              <br>
              kubernetes.io/basic-auth: 定义 basic authentication
              <br>
              kubernetes.io/ssh-auth: 定义 SSH authetication 认证
              <br>
              kubernetes.io/tls: SecretTypeTLS包含有关TLS客户端或服务器机密的信息。 它主要用于Ingress资源的TLS终止，但也可以用于其他类型。
              <br>
            </span>
          </a>
        </label>
        <div class="select">
          <select formControlName="type" required>
            <option value="Opaque" selected>Opaque</option>
            <option value="kubernetes.io/dockerconfigjson">kubernetes.io/dockerconfigjson</option>
            <option value="kubernetes.io/dockercfg">kubernetes.io/dockercfg</option>
            <option value="kubernetes.io/service-account-token">kubernetes.io/service-account-token</option>
            <option value="kubernetes.io/basic-auth">kubernetes.io/basic-auth</option>
            <option value="kubernetes.io/ssh-auth">kubernetes.io/ssh-auth</option>
            <option value="kubernetes.io/tls">kubernetes.io/tls</option>
          </select>
        </div>
      </div>
      <div formArrayName="datas">
        <div *ngFor="let data of datas.controls; let i = index"
             [formGroupName]="i">
          <div class="form-group form-group-padding">
            <label class="clr-col-md-3 form-group-label-override required">{{'MESSAGE.DATA_CONTENT' | translate}}</label>
            <input type="text"
                   size="45"
                   formControlName="dataName"
                   required
                   [placeholder]="'PLACEHOLDER.DICT_KEY' | translate">
            <a href="javascript:void(0)">
              <clr-icon (click)="onDeleteData(i)" shape="trash" [title]="'ACTION.DELETE_DATA' | translate"
                        class="is-solid clr-icon"></clr-icon>
            </a>
            <a href="javascript:void(0)">
              <clr-icon (click)="onAddData(i)" shape="plus-circle" [title]="'ACTION.ADD_DATA' | translate"
                        class="is-solid clr-icon"></clr-icon>
            </a>
          </div>
          <div class="form-group" style="padding-left: 170px;">
           <textarea class="textarea-font" style="width: 65%"
                     formControlName="dataValue"
                     required
                     [placeholder]="'PLACEHOLDER.DICT_VALUE' | translate">
          </textarea>
          </div>
        </div>
      </div>
    </wayne-box>
  </form>
</div>
<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>
<wayne-ace-editor (outputObj)="saveSecretTpl($event)"></wayne-ace-editor>
