Description of problem: when custom buttons are attached to VM/Instance and launched from the Classic UI, there is no issues, but fails when calling it from the Service UI. it fails on the first line to get the current vm using $evm.root['vm'] the below error is displayed in the automation.log The following error occurred during method evaluation: RuntimeError: VM is nil from $evm.root['vm'] VM is nil from $evm.root['vm'] (RuntimeError) Version-Release number of selected component (if applicable): cfme-appliance-common-5.10.1.2-1.el7cf.x86_64 cfme-gemset-5.10.1.2-2.el7cf.x86_64 cfme-5.10.1.2-3.el7cf.x86_64 cfme-appliance-5.10.1.2-1.el7cf.x86_64 rubygem-redhat_access_cfme-2.0.3-1.el7cf.noarch How reproducible: always Steps to Reproduce: 1. create custom button on the VM/Instance level which uses a dynamic dialog 2. the code of the dynamic dialog should start with $evm.root['vm'] to get the current VM 3. Actual results: it fails when trying to get the current VM with the error displayed at the top Expected results: should work as it works in the classic UI Additional info:
Is this a regression?
I first tested the custom from the service UI with version 5.9 which failed, then I upgraded to 5.10 with latest hot fixes and still the same issue. I could see there was a similar bug for the custom button on a service where the user was not able to get the current service. the bug states that it was fixed.
Loic, Yes we do test Dynamic Dialog in both UI Classic UI and SUI. also we have test Dynamic Dialog with custom button on Classic UI. This issue is Dynamic Dialog with custom button on SUI. Nikhil added the test for that.
Created attachment 1551485 [details] issue displayed attached is a video recording of the issue and this is a sample code that you can use to test @vm = $evm.root['vm'] dialog_hash = {} dialog_hash[@vm.id] = @vm.name $evm.object['default_value'] = dialog_hash.first[0] $evm.object['values'] = dialog_hash the video first shows that code then how it is working fine from the Classic UI, then how it is not working on the Service UI with the error from the automation log.
I suspect the SUI is using the wrong API call for the VM.
New commit detected on ManageIQ/manageiq-ui-service/master: https://github.com/ManageIQ/manageiq-ui-self_service/commit/41a30d5d3a34c76ecb9d9b19ec7b5351f7fc6158 commit 41a30d5d3a34c76ecb9d9b19ec7b5351f7fc6158 Author: Martin Hradil <mhradil> AuthorDate: Tue Apr 30 11:45:48 2019 -0400 Commit: Martin Hradil <mhradil> CommitDate: Tue Apr 30 11:45:48 2019 -0400 VM custom button dialog - use the VM instead of the parent service Triggering a VM-based custom button on a Service's VM Resource causes the right dialog to appear.. But the inital data assumes the associated resource is the service, not the VM. Subsequent field refresh requests and submit already use the VM, but the initial load was missed in https://github.com/ManageIQ/manageiq-ui-service/pull/1022. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1687061 client/app/states/services/custom_button_details/custom_button_details.state.js | 4 + 1 file changed, 4 insertions(+)