🚸 Improves case matching for auto-fill

This commit is contained in:
WalkxCode
2022-06-12 16:34:24 +02:00
parent 6ac82bda40
commit 58ec74bb68

View File

@@ -65,7 +65,7 @@ function MatchIcon(name: string, form: any) {
} }
function MatchService(name: string, form: any) { function MatchService(name: string, form: any) {
const service = ServiceTypeList.find((s) => s === name); const service = ServiceTypeList.find((s) => s.toLowerCase() === name.toLowerCase());
if (service) { if (service) {
form.setFieldValue('type', service); form.setFieldValue('type', service);
} }
@@ -73,16 +73,16 @@ function MatchService(name: string, form: any) {
function MatchPort(name: string, form: any) { function MatchPort(name: string, form: any) {
const portmap = [ const portmap = [
{ name: 'qBittorrent', value: '8080' }, { name: 'qbittorrent', value: '8080' },
{ name: 'Sonarr', value: '8989' }, { name: 'sonarr', value: '8989' },
{ name: 'Radarr', value: '7878' }, { name: 'radarr', value: '7878' },
{ name: 'Lidarr', value: '8686' }, { name: 'lidarr', value: '8686' },
{ name: 'Readarr', value: '8686' }, { name: 'readarr', value: '8686' },
{ name: 'Deluge', value: '8112' }, { name: 'deluge', value: '8112' },
{ name: 'Transmission', value: '9091' }, { name: 'transmission', value: '9091' },
]; ];
// Match name with portmap key // Match name with portmap key
const port = portmap.find((p) => p.name === name); const port = portmap.find((p) => p.name === name.toLowerCase());
if (port) { if (port) {
form.setFieldValue('url', `http://localhost:${port.value}`); form.setFieldValue('url', `http://localhost:${port.value}`);
} }