declutter config file

This commit is contained in:
Larvey
2022-06-16 16:54:07 -04:00
committed by ajnart
parent 544fae3808
commit 6ee7d6ec8d
2 changed files with 80 additions and 66 deletions

View File

@@ -178,6 +178,12 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
</Center> </Center>
<form <form
onSubmit={form.onSubmit(() => { onSubmit={form.onSubmit(() => {
if (JSON.stringify(form.values.status) === JSON.stringify(['200'])) {
form.values.status = undefined;
}
if (form.values.target === '_blank') {
form.values.target = undefined;
}
// If service already exists, update it. // If service already exists, update it.
if (config.services && config.services.find((s) => s.id === form.values.id)) { if (config.services && config.services.find((s) => s.id === form.values.id)) {
setConfig({ setConfig({
@@ -202,7 +208,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
form.reset(); form.reset();
})} })}
> >
<Tabs position="apart"> <Tabs position="center">
<Tabs.Tab label="Options"> <Tabs.Tab label="Options">
<ScrollArea style={{height:'42vh'}} scrollbarSize={4}> <ScrollArea style={{height:'42vh'}} scrollbarSize={4}>
<Group direction="column" grow> <Group direction="column" grow>
@@ -226,7 +232,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
{...form.getInputProps('url')} {...form.getInputProps('url')}
/> />
<TextInput <TextInput
label="New tab URL" label="On Click URL"
placeholder="http://sonarr.example.com" placeholder="http://sonarr.example.com"
{...form.getInputProps('openedUrl')} {...form.getInputProps('openedUrl')}
/> />
@@ -277,6 +283,13 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
textAlign: 'center', textAlign: 'center',
color: 'gray', color: 'gray',
}} }}
>
Tip: Get your API key{' '}
<Anchor
target="_blank"
weight="bold"
style={{ fontStyle: 'inherit', fontSize: 'inherit' }}
href={`${hostname}/settings/general`}
> >
here. here.
</Anchor> </Anchor>
@@ -332,12 +345,12 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
placeholder="Select valid status codes" placeholder="Select valid status codes"
clearButtonLabel="Clear selection" clearButtonLabel="Clear selection"
nothingFound="Nothing found" nothingFound="Nothing found"
defaultValue={['200']}
clearable clearable
searchable searchable
{...form.getInputProps('status')} {...form.getInputProps('status')}
/> />
<Select <Select
required
label="Open Tab in: " label="Open Tab in: "
data={targets} data={targets}
defaultValue="_blank" defaultValue="_blank"

View File

@@ -12,6 +12,7 @@ const service: serviceItem = {
icon: 'https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/youtube.png', icon: 'https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/youtube.png',
url: 'https://youtube.com/', url: 'https://youtube.com/',
status: ['200'], status: ['200'],
target: "_blank",
}; };
export const Default = (args: any) => <PingComponent service={service} />; export const Default = (args: any) => <PingComponent service={service} />;