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:
Created attachment 1539842 [details] Automate domain
Created attachment 1539844 [details] Dialog export
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.
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.
Please disregard comment 4. That issue is being tracked here: https://bugzilla.redhat.com/show_bug.cgi?id=1684575
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
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
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(+)
https://github.com/ManageIQ/manageiq/pull/18645
Verified in Version 5.11.0.3.20190507174347_a77bd90
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(+)
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