manageiq icon indicating copy to clipboard operation
manageiq copied to clipboard

Multiselect dialogs doesn't select the first item as their default.

Open kTipSSIoYv opened this issue 3 years ago • 3 comments

When multiselect is enabled for a dialog, and if the dialog is refreshed by another dialog then the dialogs doesn't select first item as their default.

image

If I disable the multiselect, then it automatically selects the first item.

image

kTipSSIoYv avatar Jun 11 '22 19:06 kTipSSIoYv

@Fryguy Any idea where the code is for the above issue? I want to see if I can patch it in our environment so it has a default value.

kTipSSIoYv avatar Jun 11 '22 19:06 kTipSSIoYv

Which screen is this on or is this a custom dialog?

Fryguy avatar Jun 15 '22 18:06 Fryguy

@Fryguy It's a custom dialog.

kTipSSIoYv avatar Jul 12 '22 02:07 kTipSSIoYv

@Fryguy @agrare Any idea why the default select is not working? It works for other ruby methods such as availability zone but when I try that in a custom method it doesn't work. The only difference with availability zone and this code is the dialog_hash.first[0]["name"].

image

def set_values_and_exit(dialog_hash)
  $evm.object["values"] = dialog_hash
  log(:info, "$evm.object['values']: #{$evm.object['values'].inspect}")
  $evm.object['default_value'] = dialog_hash.first[0]["name"]
  puts dialog_hash.first[0]["name"]
end

kTipSSIoYv avatar Aug 24 '22 19:08 kTipSSIoYv

Figured out how to fix this issue. With the help of log(:info, "$evm.object['values']: #{$evm.object['values'].inspect}") I was able to find that the key had issues. After resolving that the default select is working.

kTipSSIoYv avatar Aug 25 '22 14:08 kTipSSIoYv