6
6
getTeamListMin as getProjectListMin ,
7
7
Drawer ,
8
8
copyToClipboard ,
9
+ CustomInput ,
9
10
} from '@devtron-labs/devtron-fe-common-lib'
10
11
import { ViewType } from '../../config/constants' ;
11
12
import { toast } from 'react-toastify' ;
@@ -18,6 +19,7 @@ import { ReactComponent as Clipboard } from '../../assets/icons/ic-copy.svg'
18
19
import CodeEditor from '../CodeEditor/CodeEditor' ;
19
20
import { WebhhookConfigModalState , WebhookConfigModalProps } from './types' ;
20
21
import CreateHeaderDetails from './CreateHeaderDetails' ;
22
+ import { REQUIRED_FIELD_MSG } from '../../config/constantMessaging' ;
21
23
22
24
export class WebhookConfigModal extends Component < WebhookConfigModalProps , WebhhookConfigModalState > {
23
25
@@ -306,32 +308,37 @@ export class WebhookConfigModal extends Component<WebhookConfigModalProps, Webhh
306
308
< div className = "flex" style = { { height : 'calc(100vh - 120px' } } >
307
309
< div className = "w-600 p-20 flex column dc__align-start dc__content-start dc__overflow-scroll" style = { { height : 'calc(100vh - 120px)' } } >
308
310
< label className = "form__row w-100-imp" >
309
- < span className = "form__label dc__required-field" > Configuration name</ span >
310
- < input data-testid = "add-webhook-config-name" className = "form__input" type = "text" name = "app-name"
311
- value = { this . state . form . configName } onChange = { this . handleWebhookConfigNameChange }
311
+ < CustomInput
312
+ label = "Configuration name"
313
+ data-testid = "add-webhook-config-name"
314
+ name = "app-name"
315
+ value = { this . state . form . configName }
316
+ onChange = { this . handleWebhookConfigNameChange }
312
317
data-field = "configName"
313
- onBlur = { this . onBlur }
314
- placeholder = "Enter name" autoFocus = { true } tabIndex = { 1 } />
315
- < span className = "form__error" data-testid = "webhook-config-name-error" >
316
- { ! this . state . isValid . configName
317
- ? < > < Error className = "form__icon form__icon-- error" /> This is required field. < br /> </ >
318
- : null }
319
- </ span >
318
+ handleOnBlur = { this . onBlur }
319
+ placeholder = "Enter name"
320
+ autoFocus = { true }
321
+ tabIndex = { 1 }
322
+ error = { ! this . state . isValid . configName && REQUIRED_FIELD_MSG }
323
+ isRequiredField = { true }
324
+ / >
320
325
</ label >
321
326
< label className = "form__row w-100-imp" >
322
- < span className = "form__label dc__required-field" > Webhook URL
323
- </ span >
324
- < input data-testid = "add-webhook-url" className = "form__input" type = "text" name = "app-name"
327
+ < CustomInput
328
+ label = "Webhook URL"
329
+ type = "text"
330
+ name = "app-name"
325
331
value = { this . state . form . webhookUrl }
326
332
autoFocus = { true }
327
- placeholder = "Enter Incoming Webhook URL" tabIndex = { 2 } onChange = { this . handleWebhookUrlChange }
333
+ placeholder = "Enter Incoming Webhook URL"
334
+ tabIndex = { 2 }
335
+ onChange = { this . handleWebhookUrlChange }
328
336
data-field = "webhookUrl"
329
- onBlur = { this . onBlur } />
330
- < span className = "form__error" data-testid = "webhook-url-error" >
331
- { ! this . state . isValid . webhookUrl
332
- ? < > < Error className = "form__icon form__icon--error" /> This is a required field. < br /> </ >
333
- : null }
334
- </ span >
337
+ handleOnBlur = { this . onBlur }
338
+ isRequiredField = { true }
339
+ error = { ! this . state . isValid . webhookUrl && REQUIRED_FIELD_MSG }
340
+ data-testid = "webhook-url-error"
341
+ />
335
342
</ label >
336
343
< div className = "form__row w-100-imp" >
337
344
< div className = "flex ml-0 dc__content-space" >
0 commit comments