1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-24 22:36:19 -04:00

Created generic Hinted EnhancedSelectInput components and use it instead of SelectInput

This commit is contained in:
Taloth Saldono
2019-06-16 15:36:11 +02:00
committed by Taloth
parent d3662f2302
commit 1af3e0bd93
11 changed files with 175 additions and 22 deletions
@@ -61,7 +61,7 @@ function EditRemotePathMappingModalContent(props) {
<FormLabel>Host</FormLabel>
<FormInputGroup
type={inputTypes.AUTO_COMPLETE}
type={inputTypes.SELECT}
name="host"
helpText="The same host you specified for the remote Download Client"
{...host}
@@ -16,17 +16,27 @@ const newRemotePathMapping = {
const selectDownloadClientHosts = createSelector(
(state) => state.settings.downloadClients.items,
(downloadClients) => {
return downloadClients.reduce((acc, downloadClient) => {
const hosts = downloadClients.reduce((acc, downloadClient) => {
const name = downloadClient.name;
const host = downloadClient.fields.find((field) => {
return field.name === 'host';
});
if (host && !acc.includes(host.value)) {
acc.push(host.value);
if (host) {
const group = acc[host.value] = acc[host.value] || [];
group.push(name);
}
return acc;
}, []);
}, {});
return Object.keys(hosts).map((host) => {
return {
key: host,
value: host,
hint: `${hosts[host].join(', ')}`
};
});
}
);