]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / form-modal / form-modal.component.html
diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html
new file mode 100755 (executable)
index 0000000..651c68b
--- /dev/null
@@ -0,0 +1,65 @@
+<cd-modal [modalRef]="bsModalRef">
+  <ng-container *ngIf="titleText"
+                class="modal-title">
+    {{ titleText }}
+  </ng-container>
+  <ng-container class="modal-content">
+    <form [formGroup]="formGroup"
+          #formDir="ngForm"
+          novalidate>
+      <div class="modal-body">
+        <p *ngIf="message">{{ message }}</p>
+        <ng-container *ngFor="let field of fields">
+          <div class="form-group row cd-{{field.name}}-form-group">
+            <label *ngIf="field.label"
+                   class="cd-col-form-label"
+                   [for]="field.name">
+              {{ field.label }}
+            </label>
+            <div [ngClass]="{'cd-col-form-input': field.label, 'col-sm-12': !field.label}">
+              <input *ngIf="['text', 'number'].includes(field.type)"
+                     [type]="field.type"
+                     class="form-control"
+                     [id]="field.name"
+                     [name]="field.name"
+                     [formControlName]="field.name">
+              <input *ngIf="field.type === 'binary'"
+                     type="text"
+                     class="form-control"
+                     [id]="field.name"
+                     [name]="field.name"
+                     [formControlName]="field.name"
+                     cdDimlessBinary>
+              <select *ngIf="field.type === 'select'"
+                      class="form-control custom-select"
+                      [id]="field.name"
+                      [formControlName]="field.name">
+                <option *ngIf="field.placeholder"
+                        [ngValue]="null">
+                  {{ field.placeholder }}
+                </option>
+                <option *ngFor="let option of field.options"
+                        [value]="option.value">
+                  {{ option.text }}
+                </option>
+              </select>
+              <span *ngIf="formGroup.showError(field.name, formDir)"
+                    class="invalid-feedback">
+                {{ getError(field) }}
+              </span>
+            </div>
+          </div>
+        </ng-container>
+      </div>
+      <div class="modal-footer">
+        <div class="button-group text-right">
+          <cd-submit-button [form]="formGroup"
+                            (submitAction)="onSubmitForm(formGroup.value)">
+            {{ submitButtonText }}
+          </cd-submit-button>
+          <cd-back-button [back]="bsModalRef.hide"></cd-back-button>
+        </div>
+      </div>
+    </form>
+  </ng-container>
+</cd-modal>