From 0341c785f9487c1508f61d30631bf10bd74e0642 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Tue, 19 Nov 2019 09:28:26 +0100 Subject: [PATCH] mgr/dashboard: Make form modal more flexible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Now any input type is supported and the special binary type which will use the cd-binary input and automatically format the binary size into bytes when submitting. Now any field can have custom validators and error messages. The form will fallback on predefined error messages if not configured. It will use the error messages provided by the binary min and max validators. It still provides the error message for a required field. Fixes: https://tracker.ceph.com/issues/38287 Signed-off-by: Stephan Müller --- .../form-modal/form-modal.component.html | 83 ++++++++-------- .../form-modal/form-modal.component.spec.ts | 76 +++++++++++++- .../form-modal/form-modal.component.ts | 99 ++++++++++++++----- .../models/cd-form-modal-field-config.ts | 19 ++++ 4 files changed, 204 insertions(+), 73 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-form-modal-field-config.ts diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html index 35fedeb5f6d..a7c76941afd 100755 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.html @@ -5,54 +5,49 @@