Skip to content

Commit bacd478

Browse files
authored
Merge pull request #8812 from Autosde/host_initiator_form-group_selection_bug
host initiator creation: bug in the group/cluster field
2 parents 9bb3c00 + 2ef37a7 commit bacd478

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

app/javascript/components/host-initiator-form/host-initiator-form.schema.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ const loadStorages = (id) => API.get(`/api/providers/${id}?attributes=type,physi
2424
const loadGroups = (id) => API.get(`/api/physical_storages/${id}?attributes=host_initiator_groups`)
2525
// eslint-disable-next-line camelcase
2626
.then(({ host_initiator_groups }) => {
27-
const groupOptions = host_initiator_groups.map(({ id, name }) => ({ label: name, value: id }));
28-
groupOptions.unshift({ label: `<${__('None')}>`, value: '' });
27+
const groupOptions = host_initiator_groups.map(({ name }) => ({ label: name, value: name }));
28+
groupOptions.unshift(
29+
{ label: `<${__('Choose')}>`, value: '-1' },
30+
{ label: `<${__('None')}>`, value: 'none' }
31+
);
2932
return groupOptions;
3033
});
3134

@@ -284,9 +287,11 @@ const createSchema = (state, setState, ems, initialValues, storageId, setStorage
284287
name: 'host_initiator_group',
285288
label: __('Host Initiator Group:'),
286289
isRequired: true,
287-
validate: [{ type: validatorTypes.REQUIRED }],
290+
validate: [
291+
{ type: validatorTypes.REQUIRED },
292+
{ type: validatorTypes.PATTERN, pattern: '^(?!-)', message: __('Required') },
293+
],
288294
loadOptions: () => (storageId ? loadGroups(storageId) : Promise.resolve([])),
289-
isSearchable: true,
290295
condition: { and: [{ when: 'physical_storage_id', isNotEmpty: true }, { when: 'port_type', isNotEmpty: true }] },
291296
},
292297
],

0 commit comments

Comments
 (0)