Skip to content
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

Form Field Not Displaying Correctly When Using "Copy original Request" Button in ManageIQ #9284

Open
rabah-beldi opened this issue Oct 16, 2024 · 2 comments
Labels

Comments

@rabah-beldi
Copy link

rabah-beldi commented Oct 16, 2024

When using the "Copy Request" button in ManageIQ to reload a service request form, some fields fail to display correctly. Specifically, the dropdown values that were correctly populated during the initial request from the catalog are not displayed when copying the request.

Actual Behavior:
After using the "Copy Request" button, the following error appears in the console:

SyntaxError: Unexpected token 'G', "GRP_All_FR" is not valid JSON at JSON.parse (<anonymous>)

Additionally, the form fails to display certain fields (e.g., dynamic dropdowns) that were initially populated correctly.

Relevant Code (Dynamic Dropdown Logic):

dialog_field = $evm.object
dialog_field['values'] = nil

service_template = $evm.vmdb(:service_template).find_by_id($evm.root.attributes['service_template_id'])

if service_template['name'] !~ /RDS|AURORA/ 
  passhport_grp = "/Config/PaSSHPort/Groups/GRP_*"
else
  passhport_grp = "/Config/PaSSHPort/Groups/GRPBDD_*"
end

template_hash = { nil => "<Choose>" }

$evm.instance_find("#{passhport_grp}").each do |k, v|
  template_hash[v['name']] = "#{v['description']}"
end

dialog_field['values'] = template_hash unless template_hash.length == 0

Additional Notes:
This issue does not occur when loading the form for the first time via the catalog. It only happens after copying the request.
There are no error logs generated on the server side related to this behavior.
Can you confirm if this is a known issue or if there are any workarounds for dynamic dropdowns in this context?

Steps to Reproduce:

Create a service request via the catalog where dropdown fields are populated dynamically (e.g., based on external resources like groups or instances).
Use the "Copy Request" button to copy the service request.
Observe that some fields (such as dropdowns) are not displayed or populated correctly after the copy.

  1. Describe environment, including
    • Quinteros
    • Environment
      • EC2 appliance
@rabah-beldi
Copy link
Author

here is the complete error trace in the console:
SyntaxError: Unexpected token 'G', "GRP_All_FR" is not valid JSON at JSON.parse (<anonymous>) at e.setDefaultValue (ui-components.js:4278:41) at e.setupField (ui-components.js:4206:36) at t.initField (ui-components.js:4545:60) at t.$onInit (ui-components.js:4538:26) at angular.js:10029:34 at C (angular.js:426:18) at oe (angular.js:10018:9) at angular.js:9311:13 at angular.js:9314:13 (anonyme) @ angular.js:14961 (anonyme) @ angular.js:11281 (anonyme) @ angular.js:10031 C @ angular.js:426 oe @ angular.js:10018 (anonyme) @ angular.js:9311 (anonyme) @ angular.js:9314 (anonyme) @ angular.js:9176 (anonyme) @ angular.js:9567 r @ angular.js:9354 A @ angular.js:10121 (anonyme) @ angular.js:28487 $digest @ angular.js:18542 (anonyme) @ angular.js:18835 p @ angular.js:6439 (anonyme) @ angular.js:6718 setTimeout (asynchrone) o.defer @ angular.js:6716 $evalAsync @ angular.js:18833 (anonyme) @ angular.js:17202 u @ angular.js:17378 e @ angular.js:17405 n @ angular.js:17414 Promise.then (asynchrone) e @ angular.js:17401 m @ angular.js:17389 b @ angular.js:17534 (anonyme) @ miq_api.js:10 (anonyme) @ dialog_user_controller.js:11 b.$onInit @ dialog_user_controller.js:5 (anonyme) @ angular.js:10029 C @ angular.js:426 oe @ angular.js:10018 (anonyme) @ angular.js:9311 (anonyme) @ angular.js:9176 (anonyme) @ angular.js:1970 $eval @ angular.js:18796 $apply @ angular.js:18895 (anonyme) @ angular.js:1968 invoke @ angular.js:5117 o @ angular.js:1966 Pe @ angular.js:1986 window.miq_bootstrap @ miq_angular_application.js:73 (anonyme) @ prov_copy?org_controller=service&prov_type=ServiceTemplateProvisionRequest&req_id=24198:138 Afficher 37 autres frames Afficher moins 6miq_api.js:10 TypeError: Cannot read properties of undefined (reading 'fieldBeingRefreshed') at e.setupField (ui-components.js:4201:43) at e.setup (ui-components.js:4844:41) at e.$onInit (ui-components.js:4829:14) at angular.js:10029:34 at C (angular.js:426:18) at oe (angular.js:10018:9) at angular.js:9311:13 at angular.js:9314:13 at angular.js:9176:30 at angular.js:9567:25 (anonyme) @ angular.js:14961 (anonyme) @ angular.js:11281 (anonyme) @ angular.js:10031 C @ angular.js:426 oe @ angular.js:10018 (anonyme) @ angular.js:9311 (anonyme) @ angular.js:9314 (anonyme) @ angular.js:9176 (anonyme) @ angular.js:9567 r @ angular.js:9354 A @ angular.js:10121 (anonyme) @ angular.js:32418 (anonyme) @ angular.js:18403 $digest @ angular.js:18542 (anonyme) @ angular.js:18835 p @ angular.js:6439 (anonyme) @ angular.js:6718 setTimeout (asynchrone) o.defer @ angular.js:6716 $evalAsync @ angular.js:18833 (anonyme) @ angular.js:17202 u @ angular.js:17378 e @ angular.js:17405 n @ angular.js:17414 Promise.then (asynchrone) e @ angular.js:17401 m @ angular.js:17389 b @ angular.js:17534 (anonyme) @ miq_api.js:10 (anonyme) @ dialog_user_controller.js:11 b.$onInit @ dialog_user_controller.js:5 (anonyme) @ angular.js:10029 C @ angular.js:426 oe @ angular.js:10018 (anonyme) @ angular.js:9311 (anonyme) @ angular.js:9176 (anonyme) @ angular.js:1970 $eval @ angular.js:18796 $apply @ angular.js:18895 (anonyme) @ angular.js:1968 invoke @ angular.js:5117 o @ angular.js:1966 Pe @ angular.js:1986 window.miq_bootstrap @ miq_angular_application.js:73 (anonyme) @ prov_copy?org_controller=service&prov_type=ServiceTemplateProvisionRequest&req_id=24198:138 Afficher 38 autres frames Afficher moins

@rabah-beldi rabah-beldi changed the title Form Field Not Displaying Correctly When Using "Copy Request" Button in ManageIQ Form Field Not Displaying Correctly When Using "Copy original Request" Button in ManageIQ Oct 17, 2024
@rabah-beldi
Copy link
Author

I believe I've isolated the problem to the multi-select option in the field. It seems that enabling this feature is causing the form loading issue. I've confirmed that disabling it resolves the problem. Could this be a known issue with the multi-select functionality, or is there a specific configuration that needs to be adjusted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant