2022-12-04 21:19:40 +01:00
|
|
|
import { Alert, Divider, Tabs, Text } from '@mantine/core';
|
|
|
|
|
import { UseFormReturnType } from '@mantine/form';
|
|
|
|
|
import { IconAlertTriangle } from '@tabler/icons';
|
|
|
|
|
import { useTranslation } from 'next-i18next';
|
2022-12-18 22:27:01 +01:00
|
|
|
import { AppType } from '../../../../../../types/app';
|
2022-12-04 21:19:40 +01:00
|
|
|
import { IntegrationSelector } from './Components/InputElements/IntegrationSelector';
|
|
|
|
|
import { IntegrationOptionsRenderer } from './Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer';
|
|
|
|
|
|
|
|
|
|
interface IntegrationTabProps {
|
2022-12-18 22:27:01 +01:00
|
|
|
form: UseFormReturnType<AppType, (values: AppType) => AppType>;
|
2022-12-04 21:19:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const IntegrationTab = ({ form }: IntegrationTabProps) => {
|
|
|
|
|
const { t } = useTranslation('');
|
2022-12-17 00:28:46 +09:00
|
|
|
const hasIntegrationSelected = form.values.integration?.type;
|
2022-12-04 21:19:40 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Tabs.Panel value="integration" pt="lg">
|
|
|
|
|
<IntegrationSelector form={form} />
|
|
|
|
|
|
|
|
|
|
{hasIntegrationSelected && (
|
|
|
|
|
<>
|
|
|
|
|
<Divider label="Integration Configuration" labelPosition="center" mt="xl" mb="md" />
|
2022-12-16 19:44:57 +01:00
|
|
|
<Text size="sm" color="dimmed" mb="lg">
|
|
|
|
|
To update a secret, enter a value and click the save button. To remove a secret, use the
|
|
|
|
|
clear button.
|
|
|
|
|
</Text>
|
2022-12-04 21:19:40 +01:00
|
|
|
<IntegrationOptionsRenderer form={form} />
|
|
|
|
|
<Alert icon={<IconAlertTriangle />} color="yellow">
|
|
|
|
|
<Text>
|
|
|
|
|
Please note that Homarr removes secrets from the configuration for security reasons.
|
|
|
|
|
Thus, you can only either define or unset any credentials. Your credentials act as the
|
|
|
|
|
main access for your integrations and you should <b>never</b> share them with anybody
|
|
|
|
|
else. Make sure to <b>store and manage your secrets safely</b>.
|
|
|
|
|
</Text>
|
|
|
|
|
</Alert>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Tabs.Panel>
|
|
|
|
|
);
|
|
|
|
|
};
|