-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting default value for date/time picker in Dialog Editor modal #373
Conversation
Just wondering, I had originally reported this BZ, and like to understand, would this allow default date to be dynamically selected as |
@kedark3, what is your use case here.. |
@Loicavenel in CFME QE team, we are deploying a catalog item, where user can tell us name of provider, template to clone, VM name, service name, and retirement date. In case user does not choose retirement date, it should be set by default to whatever is current date+X hours. I was wondering if we can set that This is an attempt to make sure the VM is removed/retired automatically after certain time if user does not extend it. Does it make sense? I am not sure if we can design that in datetimepicker or in automate. |
@kedark3 this is more for Automate, you want to introduce a rules that say, if no Retirement selected, automatically take current order date + X |
@Loicavenel thanks for clarifying. Just wanted to make sure if this was not something that we should be doing in this PR/BZ. |
@romanblanco Are you sure about the BZ in description? The BZ linked from here says "I can't view bug 1598729", and is marked as closed and a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1676724. The bug mentioned in that BZs subject is a RHEL bug. The branch name seems most correct, https://bugzilla.redhat.com/show_bug.cgi?id=1686077 is indeed related to the code here :). Can you fix the description & commit message please, if that's the right bug? :) (Both description and the commit message have the wrong link.) |
Verified in UI both the date and datetime pickers can now have a default value, One nitpick, it's currently impossible to remove the default value using mouse, you have to select the date and press delete. Could we add an EDIT: and completely impossible for date&time |
The link was incorrect. It is correct now. Thanks! |
8d3ab25
to
c2613ff
Compare
I'm trying to fix this by using patternfly angular component introduced in patternfly/angular-patternfly#344, used in https://github.com/ManageIQ/manageiq/pull/12165/files#diff-f5af660797161cfea689526173ffec72R92 I'm working on this in WIP branches: |
* @function clearDefaultValue | ||
*/ | ||
public clearDefaultValue() { | ||
console.log(this.modalData.default_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the console.log
here?
ab3c212
to
5c4b290
Compare
TODO:
|
5c4b290
to
1eafad0
Compare
1eafad0
to
cf39349
Compare
cf39349
to
7b7f85a
Compare
<!-- date time control --> | ||
<div ng-switch-when="DialogFieldDateTimeControl"> | ||
<div class="col-sm-6 dateTimePadding"> | ||
<input ng-model="vm.fieldData.default_value" | ||
pf-datepicker options="vm.fieldData.dateOptions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dateOptions
is intentionally removed? (I'm not seeing it defined anywhere, so sounds about right, just checking :), line 33 does have datepicker-options
, line 53 doesn't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dateOptions is intentionally removed?
yes.
line 33 does have datepicker-options
Thanks! Removing 👍
7b7f85a
to
e324336
Compare
One last thing... diff between date-control and date-time-control: --- src/dialog-editor/components/modal-field-template/date-control.html 2019-09-11 13:08:07.824862101 +0000
+++ src/dialog-editor/components/modal-field-template/date-time-control.html 2019-09-11 13:08:07.824862101 +0000
@@ -1,5 +1,12 @@
<div ng-if="vm.modalTabIsSet('options') && !vm.modalData.dynamic">
<form class="form-horizontal">
+ <div pf-form-group pf-label="{{'Required'|translate}}">
+ <input bs-switch
+ ng-model="vm.modalData.required"
+ type="checkbox"
+ switch-on-text="{{'Yes'|translate}}"
+ switch-off-text="{{'No'|translate}}">
+ </div>
<div pf-form-group pf-label="{{'Default value'|translate}}">
<div class="dateTimePadding">
<p class="input-group">
@@ -8,16 +15,20 @@
class="form-control"
ng-model="vm.modalData.default_value"
is-open="open"
- close-text="{{'Close'|translate}}"/>
+ min-date="vm.minDate"
+ close-text="{{'Close'|translate}}"
+ id="{{ vm.dialogField.name }}"/>
<span class="input-group-btn">
<button type="button"
class="btn btn-default"
ng-click="open = !open">
- <i class="fa fa-calendar"></i>
- </button>
+ <i class="fa fa-calendar"></i></button>
</span>
</p>
</div>
+ <div >
+ <uib-timepicker ng-model="vm.modalData.default_value"></uib-timepicker>
+ </div>
</div>
<div pf-form-group pf-label="{{'Read only'|translate}}">
<input bs-switch
@@ -75,6 +86,14 @@
</dialog-editor-modal-field-template>
</div>
+ <div pf-form-group pf-label="{{'Required'|translate}}">
+ <input bs-switch
+ ng-model="vm.modalData.required"
+ type="checkbox"
+ switch-on-text="{{'Yes'|translate}}"
+ switch-off-text="{{'No'|translate}}">
+ </div>
+
<dialog-editor-tree-selector ng-if="vm.treeOptions.show"
tree-options="vm.treeOptions">
</dialog-editor-tree-selector> Specifically, it seems like date-time-control now has 2 copies of the Required switch, while date-control has none. (Comes from #380) I assume the only difference between the two should be the extra uib-timepicker? |
Checked commits romanblanco/ui-components@5d43974~...e6f5aae with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
LGTM, working :) thanks :) |
Allow setting default value for date/time picker in Dialog Editor modal (cherry picked from commit 8811c76) https://bugzilla.redhat.com/show_bug.cgi?id=1686077 https://bugzilla.redhat.com/show_bug.cgi?id=1706848
Ivanchuk backport details:
|
Adding an option to set default value for date/time picker in Dialog Editor modal:
fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1686077