Skip to content

Commit

Permalink
Merge pull request #8812 from Autosde/host_initiator_form-group_selec…
Browse files Browse the repository at this point in the history
…tion_bug

host initiator creation: bug in the group/cluster field
  • Loading branch information
agrare authored Jun 14, 2023
2 parents 9bb3c00 + 2ef37a7 commit bacd478
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ const loadStorages = (id) => API.get(`/api/providers/${id}?attributes=type,physi
const loadGroups = (id) => API.get(`/api/physical_storages/${id}?attributes=host_initiator_groups`)
// eslint-disable-next-line camelcase
.then(({ host_initiator_groups }) => {
const groupOptions = host_initiator_groups.map(({ id, name }) => ({ label: name, value: id }));
groupOptions.unshift({ label: `<${__('None')}>`, value: '' });
const groupOptions = host_initiator_groups.map(({ name }) => ({ label: name, value: name }));
groupOptions.unshift(
{ label: `<${__('Choose')}>`, value: '-1' },
{ label: `<${__('None')}>`, value: 'none' }
);
return groupOptions;
});

Expand Down Expand Up @@ -284,9 +287,11 @@ const createSchema = (state, setState, ems, initialValues, storageId, setStorage
name: 'host_initiator_group',
label: __('Host Initiator Group:'),
isRequired: true,
validate: [{ type: validatorTypes.REQUIRED }],
validate: [
{ type: validatorTypes.REQUIRED },
{ type: validatorTypes.PATTERN, pattern: '^(?!-)', message: __('Required') },
],
loadOptions: () => (storageId ? loadGroups(storageId) : Promise.resolve([])),
isSearchable: true,
condition: { and: [{ when: 'physical_storage_id', isNotEmpty: true }, { when: 'port_type', isNotEmpty: true }] },
},
],
Expand Down

0 comments on commit bacd478

Please sign in to comment.