Bug 1744413

Summary: Date picker takes a date previous to what is selected in the dialog
Product: Red Hat CloudForms Management Engine Reporter: Khushbu Borole <kborole>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED EOL QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.6CC: bmidwood, dmetzger, gmccullo, hkataria, lavenel, mhradil, mpovolny, nansari, obarenbo, simaishi, smallamp
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.12.0Flags: mfeifer: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1768456 1768457 (view as bug list) Environment:
Last Closed: 2020-03-25 18:02:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1768456, 1768457    
Attachments:
Description Flags
Services -> Requests -> DialogDetails none

Description Khushbu Borole 2019-08-22 06:29:35 UTC
Created attachment 1606823 [details]
Services -> Requests -> DialogDetails

Description of problem:
Date Picker and DateTime Picker not returning proper values.


Version-Release number of selected component (if applicable):
Red Hat CloudForms Management Engine Version 5.10.6.

How reproducible:
Always

Steps to Reproduce:
1. Create Dialog with Date picker
2. Create Service with the dialog and order the service
3. Mention a date for the date picker
4. Navigate to Services -> Requests -> [your_service] -> Dialog Options

Actual results:
You will notice the date of the previous day that you mentioned while ordering the service

Expected results:
Date picker should work properly

Additional info:
~~~
[----] I, [2019-08-22T11:30:01.017458 #32394:10ed354]  INFO -- : Q-task_id([r1000000000044_service_template_provision_task_1000000000044]) <AEMethod dialog_parser> dialog_options: {"dialog_date_control_1"=>"2019-08-30", "request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>1000000000020}
~~~

I mentioned date '2019-08-31' but the date picker processed date '2019-08-30'

Comment 2 Dave Johnson 2019-08-22 08:03:26 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 12 CFME Bot 2019-11-04 07:22:57 UTC
New commits detected on ManageIQ/ui-components/master:

https://github.com/ManageIQ/ui-components/commit/47dd10607a4452585d2635c8c7aa2b5630642285
commit 47dd10607a4452585d2635c8c7aa2b5630642285
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:52:31 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:52:31 2019 -0400

    DialogUser - add DialogData#outputConversion

    to be called from the ui to get dialogData suitable for API consumption.
    Right now, on submit, they just JSON.strigify the actual data and send it to the API.

    Which leaves Date instances to auto conversion, and that breaks Date parsing.
    Adding an explicit output conversion function and separate ui-classic and ui-service PRs to use it.

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 src/dialog-user/services/dialogData.ts | 6 +
 1 file changed, 6 insertions(+)


https://github.com/ManageIQ/ui-components/commit/53d63fc8abcccc53d85d0f9caf4f11ce48f51e55
commit 53d63fc8abcccc53d85d0f9caf4f11ce48f51e55
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 17 09:11:16 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 17 09:11:16 2019 -0400

    DialogData#outputConversion - convert date to YYYY-MM-DD, datetime to iso datetime with timezone

    the function is used to convert date before submitting to API,
    and serializes Date fields back to strings,

    to prevent a date field from being first converted to utc, submitted to the api, and then cut to 10 characters,
    we're doing the cutting before such conversion can occur

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 src/dialog-user/services/dialogData.ts | 30 +-
 1 file changed, 28 insertions(+), 2 deletions(-)

Comment 15 CFME Bot 2019-11-04 15:01:31 UTC
New commits detected on ManageIQ/manageiq-ui-service/master:

https://github.com/ManageIQ/manageiq-ui-self_service/commit/247665ad5666e0087bab94ba96b5f8b8525869a5
commit 247665ad5666e0087bab94ba96b5f8b8525869a5
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:25:25 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:25:25 2019 -0400

    DialogUser - use DialogData.outputConversion before submit

    right now, when submitting a service dialog,
    we simply take the dialogData object, convert to JSON and send to the API.

    To allow for output conversions, adding a DialogData.outputConversion method,
    which should return the dialogData in a suitable format.

    (Right now, all this really means is that it converts Dates to strings before JSON stringification.)

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 client/app/states/catalogs/details/details.state.js | 10 +-
 client/app/states/services/custom_button_details/custom_button_details.state.js | 15 +-
 client/app/states/services/reconfigure/reconfigure.state.js | 15 +-
 3 files changed, 21 insertions(+), 19 deletions(-)


https://github.com/ManageIQ/manageiq-ui-self_service/commit/1ea47e693829d81213f91e68eff3569d44102269
commit 1ea47e693829d81213f91e68eff3569d44102269
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Oct 22 19:10:45 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Oct 22 19:10:45 2019 -0400

    DialogFieldRefreshFactory#refreshDialogField - use outputConversion

    also, we can get rid of the API angular promise to Promise conversion
    with the $scope.$apply() removal in dialogUser.ts in ui-components

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 client/app/core/dialog-field-refresh.service.js | 36 +-
 1 file changed, 14 insertions(+), 22 deletions(-)

Comment 16 CFME Bot 2019-11-04 15:01:55 UTC
New commits detected on ManageIQ/manageiq-ui-classic/master:

https://github.com/ManageIQ/manageiq-ui-classic/commit/8261b82b980d16226fe94668126fc52f80b3ecf9
commit 8261b82b980d16226fe94668126fc52f80b3ecf9
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:27:45 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:27:45 2019 -0400

    DialogUser - use DialogData.outputConversion before submit

    right now, when submitting a service dialog,
    we simply take the dialogData object, convert to JSON and send to the API.

    To allow for output conversions, adding a DialogData.outputConversion method,
    which should return the dialogData in a suitable format.

    (Right now, all this really means is that it converts Dates to strings before JSON stringification.)

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js | 12 +-
 app/assets/javascripts/controllers/dialog_user/dialog_user_reconfigure_controller.js | 7 +-
 2 files changed, 11 insertions(+), 8 deletions(-)


https://github.com/ManageIQ/manageiq-ui-classic/commit/178a2835479ce7c5f855564f632ae8bbafbaa96d
commit 178a2835479ce7c5f855564f632ae8bbafbaa96d
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Oct 22 18:57:34 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Oct 22 18:57:34 2019 -0400

    dialogFieldRefreshService#refreshField - use outputConversion, try to unify with SUI

    also, we can get rid of the API angular promise to Promise conversion
    with the $scope.$apply() removal in dialogUser.ts in ui-components

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 app/assets/javascripts/services/dialog_field_refresh_service.js | 28 +-
 1 file changed, 16 insertions(+), 12 deletions(-)

Comment 17 CFME Bot 2019-11-05 16:41:20 UTC
New commits detected on ManageIQ/manageiq-ui-service/ivanchuk:

https://github.com/ManageIQ/manageiq-ui-service/commit/03804904db74d0fd5405037119d56b4eab72aea6
commit 03804904db74d0fd5405037119d56b4eab72aea6
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:25:25 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:25:25 2019 -0400

    DialogUser - use DialogData.outputConversion before submit

    right now, when submitting a service dialog,
    we simply take the dialogData object, convert to JSON and send to the API.

    To allow for output conversions, adding a DialogData.outputConversion method,
    which should return the dialogData in a suitable format.

    (Right now, all this really means is that it converts Dates to strings before JSON stringification.)

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 client/app/states/catalogs/details/details.state.js | 10 +-
 client/app/states/services/custom_button_details/custom_button_details.state.js | 15 +-
 client/app/states/services/reconfigure/reconfigure.state.js | 15 +-
 3 files changed, 21 insertions(+), 19 deletions(-)


https://github.com/ManageIQ/manageiq-ui-service/commit/05b05ecffa9ece01b9fac699683012e32ea71a6b
commit 05b05ecffa9ece01b9fac699683012e32ea71a6b
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Oct 22 19:10:45 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Oct 22 19:10:45 2019 -0400

    DialogFieldRefreshFactory#refreshDialogField - use outputConversion

    also, we can get rid of the API angular promise to Promise conversion
    with the $scope.$apply() removal in dialogUser.ts in ui-components

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413

 client/app/core/dialog-field-refresh.service.js | 36 +-
 1 file changed, 14 insertions(+), 22 deletions(-)

Comment 18 CFME Bot 2019-11-18 13:50:47 UTC
New commit detected on ManageIQ/manageiq-ui-service/hammer:

https://github.com/ManageIQ/manageiq-ui-service/commit/f69bcad8e3f39472d027fa81c9043a7f27424307
commit f69bcad8e3f39472d027fa81c9043a7f27424307
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:25:25 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:25:25 2019 -0400

    DialogUser - use DialogData.outputConversion before submit

    right now, when submitting a service dialog,
    we simply take the dialogData object, convert to JSON and send to the API.

    To allow for output conversions, adding a DialogData.outputConversion method,
    which should return the dialogData in a suitable format.

    (Right now, all this really means is that it converts Dates to strings before JSON stringification.)

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413
    (cherry picked from commit 247665ad5666e0087bab94ba96b5f8b8525869a5)

 client/app/states/catalogs/details/details.state.js | 10 +-
 client/app/states/services/custom_button_details/custom_button_details.state.js | 15 +-
 client/app/states/services/reconfigure/reconfigure.state.js | 15 +-
 3 files changed, 21 insertions(+), 19 deletions(-)


https://github.com/ManageIQ/manageiq-ui-service/commit/b6a9f27bb06a3cc56cee67ff5eba4db6b1479284
commit b6a9f27bb06a3cc56cee67ff5eba4db6b1479284
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Oct 22 19:10:45 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Oct 22 19:10:45 2019 -0400

    DialogFieldRefreshFactory#refreshDialogField - use outputConversion

    also, we can get rid of the API angular promise to Promise conversion
    with the $scope.$apply() removal in dialogUser.ts in ui-components

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413
    (cherry picked from commit 1ea47e693829d81213f91e68eff3569d44102269)

 client/app/core/dialog-field-refresh.service.js | 36 +-
 1 file changed, 14 insertions(+), 22 deletions(-)

Comment 19 CFME Bot 2019-11-18 15:11:35 UTC
New commits detected on ManageIQ/manageiq-ui-classic/hammer:

https://github.com/ManageIQ/manageiq-ui-classic/commit/40b825d55b3b6661b73faaf674efe201a64158af
commit 40b825d55b3b6661b73faaf674efe201a64158af
Author:     Martin Hradil <mhradil>
AuthorDate: Thu Oct 10 08:27:45 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Thu Oct 10 08:27:45 2019 -0400

    DialogUser - use DialogData.outputConversion before submit

    right now, when submitting a service dialog,
    we simply take the dialogData object, convert to JSON and send to the API.

    To allow for output conversions, adding a DialogData.outputConversion method,
    which should return the dialogData in a suitable format.

    (Right now, all this really means is that it converts Dates to strings before JSON stringification.)

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413
    (cherry picked from commit 8261b82b980d16226fe94668126fc52f80b3ecf9)

 app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js | 12 +-
 app/assets/javascripts/controllers/dialog_user/dialog_user_reconfigure_controller.js | 7 +-
 2 files changed, 11 insertions(+), 8 deletions(-)


https://github.com/ManageIQ/manageiq-ui-classic/commit/f946b09cdbf75ad7fee4e6f3d6f2f8cde5d7f99e
commit f946b09cdbf75ad7fee4e6f3d6f2f8cde5d7f99e
Author:     Martin Hradil <mhradil>
AuthorDate: Tue Oct 22 18:57:34 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Tue Oct 22 18:57:34 2019 -0400

    dialogFieldRefreshService#refreshField - use outputConversion, try to unify with SUI

    also, we can get rid of the API angular promise to Promise conversion
    with the $scope.$apply() removal in dialogUser.ts in ui-components

    https://bugzilla.redhat.com/show_bug.cgi?id=1744413
    (cherry picked from commit 178a2835479ce7c5f855564f632ae8bbafbaa96d)

 app/assets/javascripts/services/dialog_field_refresh_service.js | 28 +-
 1 file changed, 16 insertions(+), 12 deletions(-)