Skip to content

Commit 6d85142

Browse files
authored
Merge pull request #854 from contentstack/dev
Dev
2 parents facb12d + 9e59c3d commit 6d85142

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

ui/src/components/AdvancePropertise/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,8 @@
184184
}
185185
}
186186
}
187+
188+
.errorMessage {
189+
color: $color-brand-warning-medium;
190+
font-size: 12px;
191+
}

ui/src/components/AdvancePropertise/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const AdvancePropertise = (props: SchemaProps) => {
8787
const [options, setOptions] = useState(props?.value?.options || []);
8888
const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
8989

90+
const [isError, setIsError] = useState(false);
91+
const [errorMessage, setErrorMessage] = useState('');
92+
9093
useEffect(() => {
9194
if (props?.data?.refrenceTo && Array.isArray(props?.data?.refrenceTo)) {
9295
const updatedReferencedItems = props?.data?.refrenceTo.map((item: string) => ({
@@ -142,6 +145,16 @@ const AdvancePropertise = (props: SchemaProps) => {
142145
[field]: (event.target as HTMLInputElement)?.value
143146
}));
144147

148+
if(field === 'validationRegex') {
149+
if(event.target.value?.trim()?.length > 0) {
150+
setIsError(true);
151+
setErrorMessage('Adding a regex could impact entry creation.');
152+
}
153+
else {
154+
setIsError(false);
155+
setErrorMessage('');
156+
}
157+
}
145158
const currentToggleStates = {
146159
...toggleStates,
147160
[field]: (event.target as HTMLInputElement)?.value
@@ -490,6 +503,7 @@ const AdvancePropertise = (props: SchemaProps) => {
490503
handleOnChange('validationRegex', e, true))
491504
}
492505
/>
506+
{isError && <p className="errorMessage">{errorMessage}</p>}
493507
</Field>
494508
</>
495509
)}

0 commit comments

Comments
 (0)