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

View File

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