-
Notifications
You must be signed in to change notification settings - Fork 67
/
ImportCommandForm.tsx
36 lines (32 loc) 路 1.04 KB
/
ImportCommandForm.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {Form} from 'antd';
import * as S from 'components/CreateTestPlugins/Default/steps/BasicDetails/BasicDetails.styled';
import CurlService from 'services/Triggers/Curl.service';
import Editor from 'components/Editor';
import {SupportedEditors} from 'constants/Editor.constants';
export const FORM_ID = 'create-test';
const ImportCommandForm = () => {
return (
<S.InputContainer>
<Form.Item
label="Paste the CURL command"
name="command"
rules={[
{required: true, message: 'Please enter a command'},
{
validator: (_, command) => {
if (!CurlService.getIsValidCommand(command)) {
return Promise.reject(new Error('Invalid CURL command'));
}
return Promise.resolve();
},
message: 'Invalid CURL command',
},
]}
style={{marginBottom: 0}}
>
<Editor type={SupportedEditors.CurlCommand} />
</Form.Item>
</S.InputContainer>
);
};
export default ImportCommandForm;