ManageIQ / manageiq-automation_engine

Automation engine for ManageIQ
Apache License 2.0
11 stars 74 forks source link

Multiselect value is stored in a different format. #501

Closed kTipSSIoYv closed 2 years ago

kTipSSIoYv commented 2 years ago

In Morphy release, multiselect array is storing data as ["118\u001F119"] instead of ["118", "119"]. I'm unable to retrieve data by index.

Any workaround to fix this?

image

Fryguy commented 2 years ago

This is intentional as part of https://github.com/ManageIQ/manageiq-automation_engine/issues/480 / https://github.com/ManageIQ/manageiq-automation_engine/pull/484. Previously, arrays were were stored comma separated, but that prevented actual commas in the data field. It's possible this might just need some UI changes to present it as multiple values. @jeffibm who can look at this one?

Fryguy commented 2 years ago

@kTipSSIoYv Is this only a presentation problem, or is this an actual problem where the data gets sent to AWX? It's hard to tell what the issue is here aside from presentation.

kTipSSIoYv commented 2 years ago

@Fryguy I'm unable to retrieve the data by index 0 or 1. When I try to retrieve index 0 I get both values with a special character in between.

              job_template_array = prov.get_option_array(:job_template_id)   
              job_template_array = job_template_array[0]

[----] I, [2022-07-06T09:05:14.492607 ManageIQ/manageiq#314:2aad21d5b6fc]  INFO -- automation: Q-task_id([r745_miq_provision_1962]) <AEMethod launch_ansible_job> job_template_by_id is 118▼119
kTipSSIoYv commented 2 years ago

@Fryguy Is there any workaround I can try? I'm kind of stuck due to this issue.

Fryguy commented 2 years ago

Looks like there's a bug with get_option_array not splitting the new character - @akhilkr128 can you take a look at this one?

jeffibm commented 2 years ago

Hey @kTipSSIoYv , I am not able to identify the page from which this issue is reported. Could you please post a full page screenshot with breadcrumbs?

kTipSSIoYv commented 2 years ago

Create a service dialog. Choose any multiselect and it'll display the value in a weird format in the request section.

image

image

Create a method to retrieve the dialog first value.

image

You'll see that the output retrieves both value with a special character in between.

[----] I, [2022-07-06T09:05:14.492607 ManageIQ/manageiq#314:2aad21d5b6fc]  INFO -- automation: Q-task_id([r745_miq_provision_1962]) <AEMethod launch_ansible_job> job_template_by_id is 118▼119
akhilkr128 commented 2 years ago

Looking into the issue.

Fryguy commented 2 years ago

@jeffibm This is a custom dialog with a multiselect.

Fryguy commented 2 years ago

Is there any workaround I can try? I'm kind of stuck due to this issue.

@kTipSSIoYv Yes, in your automate code you can do:

- job_template_array = prov.get_option_array(:job_template_id)
+ job_template_array = prov.get_option_array(:job_template_id).split("\x1F")
  job_template_array = job_template_array[0]
akhilkr128 commented 2 years ago

I have created the service dialogue on Morphy branch with multi-select dropdowns and added a dynamic dropdown also which is working fine. Can you tell me more information about populating this data on dropdown? So that I can reproduce this.

Screenshot 2022-07-12 at 4 52 43 PM
kTipSSIoYv commented 2 years ago

It seems like its working only for you.

I just created a new docker image using latest morphy and I still see the same issue.

image

akhilkr128 commented 2 years ago

@kTipSSIoYv How you are creating this request using order button or by API?

akhilkr128 commented 2 years ago

Got the issue in the safari browser, I was checking in chrome and firefox.

Fryguy commented 2 years ago

Fixed in https://github.com/ManageIQ/manageiq-ui-classic/pull/8362