🔀 Merge pull request #258 from ajnart/ajnart/issue256

🐛 Allow anything in the input for the form.
This commit is contained in:
Thomas Camlong
2022-06-24 13:39:18 +02:00
committed by GitHub

View File

@@ -123,13 +123,9 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
validate: { validate: {
apiKey: () => null, apiKey: () => null,
// Validate icon with a regex // Validate icon with a regex
icon: (value: string) => { icon: (value: string) =>
// Regex to match everything that ends with and icon extension // Disable matching to allow any values
if (!value.match(/\.(png|jpg|jpeg|gif|svg)$/)) { null,
return 'Please enter a valid icon URL';
}
return null;
},
// Validate url with a regex http/https // Validate url with a regex http/https
url: (value: string) => { url: (value: string) => {
try { try {
@@ -298,64 +294,64 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
</> </>
)} )}
{form.values.type === 'qBittorrent' && ( {form.values.type === 'qBittorrent' && (
<> <>
<TextInput <TextInput
required required
label="Username" label="Username"
placeholder="admin" placeholder="admin"
value={form.values.username} value={form.values.username}
onChange={(event) => { onChange={(event) => {
form.setFieldValue('username', event.currentTarget.value); form.setFieldValue('username', event.currentTarget.value);
}} }}
error={form.errors.username && 'Invalid username'} error={form.errors.username && 'Invalid username'}
/> />
<TextInput <TextInput
required required
label="Password" label="Password"
placeholder="adminadmin" placeholder="adminadmin"
value={form.values.password} value={form.values.password}
onChange={(event) => { onChange={(event) => {
form.setFieldValue('password', event.currentTarget.value); form.setFieldValue('password', event.currentTarget.value);
}} }}
error={form.errors.password && 'Invalid password'} error={form.errors.password && 'Invalid password'}
/> />
</> </>
)} )}
{form.values.type === 'Deluge' && ( {form.values.type === 'Deluge' && (
<> <>
<TextInput <TextInput
label="Password" label="Password"
placeholder="password" placeholder="password"
value={form.values.password} value={form.values.password}
onChange={(event) => { onChange={(event) => {
form.setFieldValue('password', event.currentTarget.value); form.setFieldValue('password', event.currentTarget.value);
}} }}
error={form.errors.password && 'Invalid password'} error={form.errors.password && 'Invalid password'}
/> />
</> </>
)} )}
{form.values.type === 'Transmission' && ( {form.values.type === 'Transmission' && (
<> <>
<TextInput <TextInput
label="Username" label="Username"
placeholder="admin" placeholder="admin"
value={form.values.username} value={form.values.username}
onChange={(event) => { onChange={(event) => {
form.setFieldValue('username', event.currentTarget.value); form.setFieldValue('username', event.currentTarget.value);
}} }}
error={form.errors.username && 'Invalid username'} error={form.errors.username && 'Invalid username'}
/> />
<TextInput <TextInput
label="Password" label="Password"
placeholder="adminadmin" placeholder="adminadmin"
value={form.values.password} value={form.values.password}
onChange={(event) => { onChange={(event) => {
form.setFieldValue('password', event.currentTarget.value); form.setFieldValue('password', event.currentTarget.value);
}} }}
error={form.errors.password && 'Invalid password'} error={form.errors.password && 'Invalid password'}
/> />
</> </>
)} )}
</Group> </Group>
</ScrollArea> </ScrollArea>
</Tabs.Tab> </Tabs.Tab>