<clr-modal [(clrModalOpen)]="createSecretOpened" [clrModalSize]="'lg'">
  <h3 class="modal-title">{{secretTitle}}</h3>
  <div class="modal-body">
    <form #secretForm="ngForm">
      <section class="form-block">
        <div class="form-group" style="padding-left: 135px;">
          <label for="app_id" class="clr-col-md-3 form-group-label-override required">应用</label>
          <div class="select form-control">
            <select id="app_id" [(ngModel)]="secret.appId" [disabled]="actionType==1" name="app_id">
              <option *ngFor="let app of apps" [ngValue]="app.id" [selected]="app.id === secret.appId">{{app.name}}
              </option>
            </select>
          </div>
        </div>
        <div class="form-group" style="padding-left: 135px;">
          <label for="name" class="clr-col-md-3 form-group-label-override required">{{'TITLE.NAME' | translate}}</label>
          <label for="name" aria-haspopup="true" role="tooltip" [class.invalid]="!isNameValid"
                 class="tooltip tooltip-validation tooltip-md tooltip-bottom-left form-control">
            <input class="form-control" type="text" id="name" [(ngModel)]="secret.name"
                   name="name" size="32"
                   required
                   [readonly]="actionType==1"
                   maxlength="32"
                   pattern="[a-z]([-a-z0-9]*[a-z0-9])?"
                   (keyup)='handleValidation()'>
            <span class="tooltip-content">
              加密文件名称不符合规范，验证规则[a-z]([-a-z0-9]*[a-z0-9])?
            </span>
          </label>
          <span class="spinner spinner-inline" [hidden]="!checkOnGoing"></span>
        </div>
        <div class="form-group" style="padding-left: 135px;">
          <label for="metaData" class="clr-col-md-3 form-group-label-override">元数据</label>
          <wayne-ace-editor-box></wayne-ace-editor-box>
        </div>
        <div class="form-group" style="padding-left: 135px;">
          <label for="description"
                 class="clr-col-md-3 form-group-label-override">{{'TITLE.DESCRIPTION' | translate}}</label>
          <textarea id="description" [(ngModel)]="secret.description"
                    name="description"
                    rows="3">
          </textarea>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
          <button type="button" class="btn btn-primary" [disabled]="!isValid"
                  (click)="onSubmit()">{{'BUTTON.SUBMIT' | translate}}</button>
        </div>
      </section>
    </form>
  </div>
</clr-modal>
