]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Use forms in RGW user capability
authorStephan Müller <smueller@suse.com>
Tue, 19 Jun 2018 14:21:54 +0000 (16:21 +0200)
committerStephan Müller <smueller@suse.com>
Tue, 3 Jul 2018 15:42:32 +0000 (17:42 +0200)
Signed-off-by: Stephan Müller <smueller@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts

index 68770897ff1854a77a298caca2f512dc5bd1a0ac..642cb0b0f5ab74fa58c518fb4ebe579fec986c76 100644 (file)
@@ -17,7 +17,7 @@
 
     <!-- Type -->
     <div class="form-group"
-         [ngClass]="{'has-error': (frm.submitted || formGroup.controls.type.dirty) && formGroup.controls.type.invalid}">
+         [ngClass]="{'has-error': formGroup.showError('type', frm)}">
       <label class="control-label col-sm-3"
              for="type"
              i18n>Type
@@ -45,7 +45,7 @@
                   [value]="type">{{ type }}</option>
         </select>
         <span class="help-block"
-              *ngIf="(frm.submitted || formGroup.controls.type.dirty) && formGroup.controls.type.hasError('required')"
+              *ngIf="formGroup.showError('type', frm, 'required')"
               i18n>
           This field is required.
         </span>
@@ -54,7 +54,7 @@
 
     <!-- Permission -->
     <div class="form-group"
-         [ngClass]="{'has-error': (frm.submitted || formGroup.controls.perm.dirty) && formGroup.controls.perm.invalid}">
+         [ngClass]="{'has-error': formGroup.showError('perm', frm)}">
       <label class="control-label col-sm-3"
              for="perm"
              i18n>Permission
@@ -73,7 +73,7 @@
           </option>
         </select>
         <span class="help-block"
-              *ngIf="(frm.submitted || formGroup.controls.perm.dirty) && formGroup.controls.perm.hasError('required')"
+              *ngIf="formGroup.showError('perm', frm, 'required')"
               i18n>
           This field is required.
         </span>
index 2a4a282fddbe5f9d0de271fd725f14a3a174cea0..eacb9ca6ad6e93082cd5181950fe151cf119a38a 100644 (file)
@@ -1,9 +1,11 @@
 import { Component, EventEmitter, Output } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { Validators } from '@angular/forms';
 
 import * as _ from 'lodash';
 import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
 
+import { CdFormBuilder } from '../../../shared/forms/cd-form-builder';
+import { CdFormGroup } from '../../../shared/forms/cd-form-group';
 import { RgwUserCapability } from '../models/rgw-user-capability';
 
 @Component({
@@ -18,11 +20,11 @@ export class RgwUserCapabilityModalComponent {
    */
   @Output() submitAction = new EventEmitter();
 
-  formGroup: FormGroup;
+  formGroup: CdFormGroup;
   editing = true;
   types: string[] = [];
 
-  constructor(private formBuilder: FormBuilder, public bsModalRef: BsModalRef) {
+  constructor(private formBuilder: CdFormBuilder, public bsModalRef: BsModalRef) {
     this.createForm();
   }