domain-watchdog/assets/utils/providers/forms/GandiConnectorForm.tsx

52 lines
1.9 KiB
TypeScript
Raw Normal View History

2025-02-18 15:41:59 +01:00
import type {FormInstance} from 'antd'
import {Form, Input, Typography} from 'antd'
import React from 'react'
import type {Connector} from '../../api/connectors'
import {ConnectorProvider} from '../../api/connectors'
import {t} from 'ttag'
2025-02-18 21:42:15 +01:00
import DefaultConnectorFormItems from "./DefaultConnectorFormItems"
2025-02-18 21:53:04 +01:00
import {formItemLayoutWithOutLabel, providersConfig} from "../index"
2025-02-18 15:41:59 +01:00
2025-02-18 17:20:33 +01:00
export default function GandiConnectorForm({form, onCreate}: {
form: FormInstance,
onCreate: (values: Connector) => void
}) {
2025-02-18 15:41:59 +01:00
2025-02-18 17:32:34 +01:00
form.setFieldValue('provider', ConnectorProvider.Gandi)
2025-02-18 15:41:59 +01:00
return (
<Form
{...formItemLayoutWithOutLabel}
form={form}
layout='horizontal'
labelCol={{span: 6}}
wrapperCol={{span: 14}}
onFinish={onCreate}
>
<Form.Item
label={t`Personal Access Token (PAT)`}
name={['authData', 'token']}
2025-02-19 00:54:04 +01:00
help={<Typography.Link target='_blank' href='https://admin.gandi.net/organizations/account/pat'>
{t`Retrieve a Personal Access Token from your customer account on the Provider's website`}
</Typography.Link>}
2025-02-18 15:41:59 +01:00
rules={[{required: true, message: t`Required`}]}
>
<Input autoComplete='off'/>
</Form.Item>
<Form.Item
label={t`Organization sharing ID`}
name={['authData', 'sharingId']}
help={<Typography.Text
type='secondary'
>{t`It indicates the organization that will pay for the ordered product`}
</Typography.Text>}
required={false}
>
<Input autoComplete='off' placeholder='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'/>
</Form.Item>
2025-02-18 21:42:15 +01:00
<DefaultConnectorFormItems tosLink={providersConfig[ConnectorProvider.Gandi].tosLink}/>
2025-02-18 15:41:59 +01:00
</Form>
)
}