]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/dimless-binary.directive.ts
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / directives / dimless-binary.directive.ts
index 1c27ae1cecf42c5b3f888f2d9270383839e4ada9..12db3ad0b6f036b5ba418e7dd787d5062db1c8f1 100644 (file)
@@ -7,7 +7,7 @@ import {
   OnInit,
   Output
 } from '@angular/core';
-import { NgControl } from '@angular/forms';
+import { NgControl, Validators } from '@angular/forms';
 
 import _ from 'lodash';
 
@@ -86,6 +86,12 @@ export class DimlessBinaryDirective implements OnInit {
   setValue(value: string) {
     if (/^[\d.]+$/.test(value)) {
       value += this.defaultUnit || 'm';
+    } else {
+      if (value) {
+        this.control.control.setValue(value);
+        this.control.control.addValidators(Validators.pattern(/^[a-zA-Z\d. ]+$/));
+        this.control.control.updateValueAndValidity();
+      }
     }
     const size = this.formatter.toBytes(value);
     const roundedSize = this.round(size);