1
1
import React , { useState , useEffect , useMemo } from 'react'
2
- import { showError , Progressing , VisibleModal , useAsync } from '@devtron-labs/devtron-fe-common-lib'
2
+ import { showError , Progressing , VisibleModal , useAsync , CustomInput } from '@devtron-labs/devtron-fe-common-lib'
3
3
import { Select , mapByKey , useKeyDown , Info , Pencil } from '../common'
4
4
import CodeEditor from '../CodeEditor/CodeEditor'
5
5
import { getEnvironmentListMin } from '../../services/service'
@@ -11,6 +11,7 @@ import { ReactComponent as LockIcon } from '../../assets/icons/ic-locked.svg'
11
11
import { ReactComponent as WarningIcon } from '../../assets/icons/ic-alert-triangle.svg' ;
12
12
import { useHistory } from 'react-router'
13
13
import { getSavedValuesListURL } from './charts.helper'
14
+ import { renderAdditionalErrorInfo } from './charts.util'
14
15
15
16
interface AdvancedConfig extends AdvancedConfigHelpers {
16
17
chart : ChartGroupEntry ;
@@ -141,14 +142,18 @@ const AdvancedConfig: React.FC<AdvancedConfig> = ({ chart, index, fetchChartValu
141
142
< div className = "advanced-config flex" >
142
143
< form action = "" className = "advanced-config__form" >
143
144
< h1 className = "form__title form__title--mb-24" data-testid = "advanced-option-heading" > { chartName } </ h1 >
144
- { handleNameChange && < div className = "flex column left top mb-16" >
145
- < label htmlFor = "" className = "form__label" data-testid = "advanced-option-app-name" > App name*</ label >
146
- < input type = "text" autoComplete = "off" className = { `form__input ${ appName ?. error ? 'form__input--error' : '' } ` } value = { appName . value } onChange = { e => handleNameChange ( index , e . target . value ) } data-testid = "advanced-option-app-name-box" />
147
- { appName ?. error &&
148
- < span className = "form__error flex left" >
149
- < WarningIcon className = "mr-5 icon-dim-16" /> { appName ?. error || "" }
150
- { appName . suggestedName && < span > . Suggested name: < span className = "anchor pointer" onClick = { e => handleNameChange ( index , appName . suggestedName ) } > { appName . suggestedName } </ span > </ span > }
151
- </ span > }
145
+ { handleNameChange && < div className = "mb-16" >
146
+ < CustomInput
147
+ name = "appName"
148
+ label = "App name"
149
+ rootClassName = { `${ appName ?. error ? 'form__input--error' : '' } ` }
150
+ value = { appName . value }
151
+ onChange = { ( e ) => handleNameChange ( index , e . target . value ) }
152
+ data-testid = "advanced-option-app-name-box"
153
+ isRequiredField = { true }
154
+ error = { appName ?. error }
155
+ additionalErrorInfo = { appName ?. error && appName ?. suggestedName && renderAdditionalErrorInfo ( handleNameChange , appName . suggestedName , index ) }
156
+ />
152
157
</ div > }
153
158
{ handleEnvironmentChange && < div className = "flex top mb-16" >
154
159
< div className = "flex column half left top" >
0 commit comments