Bug 1684567 - A service dialog element's dynamic method always runs when the dialog loads despite load_values_on_init for the element being false
Summary: A service dialog element's dynamic method always runs when the dialog loads d...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.10.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: GA
: 5.11.0
Assignee: Martin Hradil
QA Contact: Niyaz Akhtar Ansari
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-01 14:47 UTC by Peter McGowan
Modified: 2019-12-12 13:36 UTC (History)
9 users (show)

Fixed In Version: 5.11.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-12 13:35:55 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Automate domain (3.17 KB, application/zip)
2019-03-01 14:51 UTC, Peter McGowan
no flags Details
Dialog export (2.41 KB, text/plain)
2019-03-01 14:51 UTC, Peter McGowan
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:4199 0 None None None 2019-12-12 13:36:08 UTC

Description Peter McGowan 2019-03-01 14:47:21 UTC
Description of problem:
A service dialog can have elements populated by dynamic methods. If the element definition contains the values "show_refresh_button: false" and "load_values_on_init: false" then the dynamic method should not run when the dialog first loads, however dynamic dialogs always seem to run in this scenario. 

A service dialog element's dynamic method always runs when the dialog loads if "show_refresh_button: false" is defined, despite "load_values_on_init" for the element being false. 

Version-Release number of selected component (if applicable):
5.10.0.33

How reproducible:
every time

Steps to Reproduce:
1. Import the attached yaml dialog export and automate domains.
2. Add the dialog to a service or custom button.
3. Launch the service or custom button to display the dialog

Actual results:
Observe that both dialog elements have been populated from the dynamic method.

Expected results:
The dialog elements should not be populated as the method should not have run as "load_values_on_init: false" is set in the element definition.


Additional info:

Comment 2 Peter McGowan 2019-03-01 14:51:27 UTC
Created attachment 1539842 [details]
Automate domain

Comment 3 Peter McGowan 2019-03-01 14:51:51 UTC
Created attachment 1539844 [details]
Dialog export

Comment 4 Tina Fitzgerald 2019-03-13 16:14:51 UTC
The following notes are from a conversation I had with Erik about this RFE:

Editor needs to be changed so that when you select "dynamic" both the "show refresh button" and "load values on init" option boxes are shown instead of just "show refresh button".
"load values on init" probably should be set to "enabled" by default. This is how it works today unless you check the "show refresh button" box, so I don't think we should be changing that behavior. (Tina confirmed this with Loic)
If it is to be enabled by default (and again I think it should), we will need to write a data migration to make sure all old dialog fields that need to have it set will have it set.
There is logic that will need to be changed in a few of the models since the two options are no longer dependent upon one another.

Comment 5 Peter McGowan 2019-03-13 16:39:11 UTC
This BZ is about dialogs imported from yaml rather than created using the editor. If the import yaml contains both "show_refresh_button: false" and "load_values_on_init: false", then these should both be honoured when the resulting dialog runs.

Comment 6 Tina Fitzgerald 2019-03-13 17:44:49 UTC
Please disregard comment 4. That issue is being tracked here: https://bugzilla.redhat.com/show_bug.cgi?id=1684575

Comment 7 Tina Fitzgerald 2019-03-27 16:42:52 UTC
Hi Martin,

Although this ticket isn't a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1684575, I believe your changes will resolve this issue.
Can you move this to POST once your PRs have been merged?

Thanks,
Tina

Comment 8 Martin Hradil 2019-03-28 14:16:54 UTC
Agreed Tina,

the same fix will fix this BZ as well,
will do :)


PRs:

https://github.com/ManageIQ/manageiq-schema/pull/357
https://github.com/ManageIQ/manageiq/pull/18600

Comment 9 CFME Bot 2019-04-01 13:37:23 UTC
New commit detected on ManageIQ/manageiq-schema/master:

https://github.com/ManageIQ/manageiq-schema/commit/e8c1faa5dbbf46ae3d4c2ac2ac462da64dd988c2
commit e8c1faa5dbbf46ae3d4c2ac2ac462da64dd988c2
Author:     Martin Hradil <mhradil>
AuthorDate: Wed Mar 27 09:37:01 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Wed Mar 27 09:37:01 2019 -0400

    Dialog field - set load_values_on_init to true where show_refresh_button was not enabled

    Replaces code that was previously hardcoded in the model..

        def load_values_on_init?
          return true unless show_refresh_button
          load_values_on_init
        end

    Needed to make it posssible to set both these fields to false,
    without breaking all the old fields where the value of `load_values_on_init` previously didn't matter.

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

 db/migrate/20190327132620_dialog_field_load_values_on_init.rb | 11 +
 1 file changed, 11 insertions(+)

Comment 14 Niyaz Akhtar Ansari 2019-05-14 19:23:38 UTC
Verified in Version 5.11.0.3.20190507174347_a77bd90

Comment 15 CFME Bot 2019-06-03 09:40:51 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/79da7dbe6c7edd35d65adaa52e65d73a11ecfe16
commit 79da7dbe6c7edd35d65adaa52e65d73a11ecfe16
Author:     Martin Hradil <mhradil>
AuthorDate: Wed Apr 10 08:09:10 2019 -0400
Commit:     Martin Hradil <mhradil>
CommitDate: Wed Apr 10 08:09:10 2019 -0400

    DialogFieldImporter - set `load_values_on_init` when importing from version 1 export

    Applies the same change as ManageIQ/manageiq-schema#357 when importing older exported service dialogs.

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

 app/models/dialog_field_importer.rb | 12 +
 1 file changed, 12 insertions(+)

Comment 17 errata-xmlrpc 2019-12-12 13:35:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:4199


Note You need to log in before you can comment on or make changes to this bug.