2025-02-18 15:41:59 +01:00
|
|
|
import type {FormInstance} from 'antd'
|
2025-02-19 00:54:04 +01:00
|
|
|
import {Form, Input, Typography} from 'antd'
|
2025-02-18 15:41:59 +01:00
|
|
|
import React from 'react'
|
2025-02-18 17:20:33 +01:00
|
|
|
import type {Connector} from '../../api/connectors'
|
|
|
|
|
import {ConnectorProvider} from '../../api/connectors'
|
2025-02-18 15:41:59 +01:00
|
|
|
import {t} from 'ttag'
|
2025-02-18 21:42:15 +01:00
|
|
|
import DefaultConnectorFormItems from "./DefaultConnectorFormItems"
|
|
|
|
|
import {formItemLayoutWithOutLabel, providersConfig} from "../index"
|
2025-02-18 15:41:59 +01:00
|
|
|
|
2025-02-18 17:20:33 +01:00
|
|
|
export default function NamecheapConnectorForm({form, onCreate}: {
|
2025-02-18 15:41:59 +01:00
|
|
|
form: FormInstance,
|
|
|
|
|
onCreate: (values: Connector) => void
|
|
|
|
|
}) {
|
|
|
|
|
|
2025-02-18 17:32:34 +01:00
|
|
|
|
|
|
|
|
form.setFieldValue('provider', ConnectorProvider.Namecheap)
|
|
|
|
|
|
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`Username`}
|
|
|
|
|
name={['authData', 'ApiUser']}
|
2025-02-19 00:54:04 +01:00
|
|
|
help={<Typography.Link target='_blank' href='https://ap.www.namecheap.com/settings/tools/apiaccess/'>
|
|
|
|
|
{t`Retreive an API key and whitelist this instance's IP address on Namecheap's website`}
|
|
|
|
|
</Typography.Link>}
|
2025-02-18 15:41:59 +01:00
|
|
|
>
|
|
|
|
|
<Input autoComplete='off'/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
label={t`API key`}
|
|
|
|
|
name={['authData', 'ApiKey']}
|
|
|
|
|
>
|
|
|
|
|
<Input autoComplete='off'/>
|
|
|
|
|
</Form.Item>
|
2025-02-18 21:42:15 +01:00
|
|
|
<DefaultConnectorFormItems tosLink={providersConfig[ConnectorProvider.Namecheap].tosLink}/>
|
2025-02-18 15:41:59 +01:00
|
|
|
</Form>
|
|
|
|
|
)
|
|
|
|
|
}
|