mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
declutter config file
This commit is contained in:
@@ -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>
|
||||||
@@ -213,70 +219,77 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
|||||||
{...form.getInputProps('name')}
|
{...form.getInputProps('name')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
required
|
required
|
||||||
label="Icon URL"
|
label="Icon URL"
|
||||||
placeholder="/favicon.svg"
|
placeholder="/favicon.svg"
|
||||||
{...form.getInputProps('icon')}
|
{...form.getInputProps('icon')}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
required
|
required
|
||||||
label="Service URL"
|
label="Service URL"
|
||||||
placeholder="http://localhost:7575"
|
placeholder="http://localhost:7575"
|
||||||
{...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')}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
label="Service type"
|
label="Service type"
|
||||||
defaultValue="Other"
|
defaultValue="Other"
|
||||||
placeholder="Pick one"
|
placeholder="Pick one"
|
||||||
required
|
required
|
||||||
searchable
|
searchable
|
||||||
data={ServiceTypeList}
|
data={ServiceTypeList}
|
||||||
{...form.getInputProps('type')}
|
{...form.getInputProps('type')}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
label="Category"
|
label="Category"
|
||||||
data={categoryList}
|
data={categoryList}
|
||||||
placeholder="Select a category or create a new one"
|
placeholder="Select a category or create a new one"
|
||||||
nothingFound="Nothing found"
|
nothingFound="Nothing found"
|
||||||
searchable
|
searchable
|
||||||
clearable
|
clearable
|
||||||
creatable
|
creatable
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
getCreateLabel={(query) => `+ Create "${query}"`}
|
getCreateLabel={(query) => `+ Create "${query}"`}
|
||||||
onCreate={(query) => {}}
|
onCreate={(query) => {}}
|
||||||
{...form.getInputProps('category')}
|
{...form.getInputProps('category')}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={isLoading} />
|
<LoadingOverlay visible={isLoading} />
|
||||||
{(form.values.type === 'Sonarr' ||
|
{(form.values.type === 'Sonarr' ||
|
||||||
form.values.type === 'Radarr' ||
|
form.values.type === 'Radarr' ||
|
||||||
form.values.type === 'Lidarr' ||
|
form.values.type === 'Lidarr' ||
|
||||||
form.values.type === 'Readarr') && (
|
form.values.type === 'Readarr') && (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
required
|
required
|
||||||
label="API key"
|
label="API key"
|
||||||
placeholder="Your API key"
|
placeholder="Your API key"
|
||||||
value={form.values.apiKey}
|
value={form.values.apiKey}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('apiKey', event.currentTarget.value);
|
form.setFieldValue('apiKey', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.apiKey && 'Invalid API key'}
|
error={form.errors.apiKey && 'Invalid API key'}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
fontSize: '0.75rem',
|
fontSize: '0.75rem',
|
||||||
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"
|
||||||
|
|||||||
@@ -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} />;
|
||||||
|
|||||||
Reference in New Issue
Block a user