From 5d439749c04d932932645bee5128321ef86df656 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Thu, 7 Mar 2019 16:31:30 +0100 Subject: [PATCH 1/4] Allow setting default value for date/time picker in Dialog Editor modal fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1686077 --- .../modal-field-template/date-control.html | 88 +++++++++++++++++++ .../date-time-control.html | 10 +++ .../components/modal-field/field.html | 2 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/dialog-editor/components/modal-field-template/date-control.html diff --git a/src/dialog-editor/components/modal-field-template/date-control.html b/src/dialog-editor/components/modal-field-template/date-control.html new file mode 100644 index 0000000000..6c80617578 --- /dev/null +++ b/src/dialog-editor/components/modal-field-template/date-control.html @@ -0,0 +1,88 @@ +
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+ + + + +
+
+
+ +
+
+ +
+ + +
+ + + +
+
+
+
+
+ +
+
+ +
+
+
diff --git a/src/dialog-editor/components/modal-field-template/date-time-control.html b/src/dialog-editor/components/modal-field-template/date-time-control.html index badefb8f65..5cae96b724 100644 --- a/src/dialog-editor/components/modal-field-template/date-time-control.html +++ b/src/dialog-editor/components/modal-field-template/date-time-control.html @@ -7,6 +7,16 @@ switch-on-text="{{'Yes'|translate}}" switch-off-text="{{'No'|translate}}"> +
+
+ +
+
+ +
+
Edit Field Details modal-data="vm.modalData"> Date: Fri, 29 Mar 2019 12:41:16 +0000 Subject: [PATCH 2/4] Add a button to clear default value --- .../modal-field-template/date-control.html | 1 + .../modal-field-template/date-time-control.html | 1 + .../modalFieldTemplateComponent.ts | 16 +++++++++++++++- .../components/modal/modalComponent.ts | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/dialog-editor/components/modal-field-template/date-control.html b/src/dialog-editor/components/modal-field-template/date-control.html index 6c80617578..6a56264f63 100644 --- a/src/dialog-editor/components/modal-field-template/date-control.html +++ b/src/dialog-editor/components/modal-field-template/date-control.html @@ -6,6 +6,7 @@ pf-datepicker date="vm.modalData.default_value">
+
+
this.$element.find('select').selectpicker('refresh')); } + + /** + * Removes default value by setting `default_value` as + * `null` + * @memberof ModalFieldController + * @function clearDefaultValue + */ + public clearDefaultValue() { + this.$timeout(() => this.modalData.default_value = null, 0); + } + } /** @@ -69,4 +82,5 @@ export default class ModalFieldTemplate { showFullyQualifiedName: '<', treeOptions: '<', }; + } diff --git a/src/dialog-editor/components/modal/modalComponent.ts b/src/dialog-editor/components/modal/modalComponent.ts index dd413e5112..b323230eb2 100644 --- a/src/dialog-editor/components/modal/modalComponent.ts +++ b/src/dialog-editor/components/modal/modalComponent.ts @@ -318,6 +318,7 @@ class ModalController { categories="modalCtrl.parent.categories" add-entry="modalCtrl.parent.addEntry" remove-entry="modalCtrl.parent.removeEntry" + clear-default-value="modalCtrl.parent.clearDefaultValue" current-category-entries="modalCtrl.parent.currentCategoryEntries" resolve-categories="modalCtrl.parent.resolveCategories" modal-tab-is-set="modalCtrl.parent.modalTabIsSet" From e3243363ac9f77d98edb6902a04bd4120d6bab41 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Mon, 9 Sep 2019 12:02:23 +0000 Subject: [PATCH 3/4] Replaced pf-datepicker component for uib-datepicker --- src/dialog-editor/components/field/field.html | 37 +++++++++++++++---- .../modal-field-template/date-control.html | 19 ++++++++-- .../date-time-control.html | 20 ++++++++-- .../modalFieldTemplateComponent.ts | 13 ------- .../components/modal/modalComponent.ts | 1 - 5 files changed, 60 insertions(+), 30 deletions(-) diff --git a/src/dialog-editor/components/field/field.html b/src/dialog-editor/components/field/field.html index dfbfa904f1..abb61c2af2 100644 --- a/src/dialog-editor/components/field/field.html +++ b/src/dialog-editor/components/field/field.html @@ -24,17 +24,38 @@ type="checkbox"> - - +

+ + + + +

- +

+ + + + +

diff --git a/src/dialog-editor/components/modal-field-template/date-control.html b/src/dialog-editor/components/modal-field-template/date-control.html index 6a56264f63..7cee940dab 100644 --- a/src/dialog-editor/components/modal-field-template/date-control.html +++ b/src/dialog-editor/components/modal-field-template/date-control.html @@ -2,11 +2,22 @@
- +

+ + + + +

-
- +

+ + + + +

-
this.$element.find('select').selectpicker('refresh')); } - - /** - * Removes default value by setting `default_value` as - * `null` - * @memberof ModalFieldController - * @function clearDefaultValue - */ - public clearDefaultValue() { - this.$timeout(() => this.modalData.default_value = null, 0); - } - } /** @@ -82,5 +70,4 @@ export default class ModalFieldTemplate { showFullyQualifiedName: '<', treeOptions: '<', }; - } diff --git a/src/dialog-editor/components/modal/modalComponent.ts b/src/dialog-editor/components/modal/modalComponent.ts index b323230eb2..dd413e5112 100644 --- a/src/dialog-editor/components/modal/modalComponent.ts +++ b/src/dialog-editor/components/modal/modalComponent.ts @@ -318,7 +318,6 @@ class ModalController { categories="modalCtrl.parent.categories" add-entry="modalCtrl.parent.addEntry" remove-entry="modalCtrl.parent.removeEntry" - clear-default-value="modalCtrl.parent.clearDefaultValue" current-category-entries="modalCtrl.parent.currentCategoryEntries" resolve-categories="modalCtrl.parent.resolveCategories" modal-tab-is-set="modalCtrl.parent.modalTabIsSet" From e6f5aaef672f4ec78bcf3a1bbe5a8e3897374689 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Wed, 11 Sep 2019 14:46:19 +0000 Subject: [PATCH 4/4] Added missing option to set field as required --- .../modal-field-template/date-control.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dialog-editor/components/modal-field-template/date-control.html b/src/dialog-editor/components/modal-field-template/date-control.html index 7cee940dab..c2d39adad2 100644 --- a/src/dialog-editor/components/modal-field-template/date-control.html +++ b/src/dialog-editor/components/modal-field-template/date-control.html @@ -1,5 +1,12 @@
+
+ +

@@ -75,6 +82,14 @@

+
+ +
+