Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions ui/src/components/Common/AddStack/addStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const AddStack = (props: any): JSX.Element => {
});
props?.closeModal();
} else {
Notification({ notificationContent: { text: 'Failed to create the stack' }, type: 'error' });
Notification({ notificationContent: { text: 'Stack creation failed. Please try again.' }, type: 'error' });
}
setIsProcessing(false);
};
Expand Down Expand Up @@ -102,6 +102,7 @@ const AddStack = (props: any): JSX.Element => {
});
//org id will always be there
}, []);

return (
<>
{isLoading ? (
Expand All @@ -116,9 +117,15 @@ const AddStack = (props: any): JSX.Element => {
keepDirtyOnReinitialize={true}
validate={(values): any => {
const errors: any = {};
if (!values?.name || values?.name?.trim().lenght < 1) {
if (!values?.name || values?.name?.trim().length < 1) {
errors.name = 'Stack name required';
}
if (values?.name && values?.name?.length > 255) {
errors.name = 'Stack name should have a maximum length of 255 character(s).';
}
if (values?.description && values?.description?.length > 512) {
errors.description = 'Description should have a maximum length of 512 character(s).';
}
if (!values?.locale || values?.locale === '') {
errors.locale = 'Required';
}
Expand Down Expand Up @@ -152,7 +159,7 @@ const AddStack = (props: any): JSX.Element => {
testId="cs-stack-create-title-input"
version="v2"
{...input}
onChange={(event: any): any => {
onChange={(event: React.ChangeEvent<HTMLInputElement>): void => {
input?.onChange(event);
}}
name="name"
Expand All @@ -176,7 +183,7 @@ const AddStack = (props: any): JSX.Element => {
</Field>
<Field>
<ReactFinalField name={'description'} type="textarea">
{({ input }): any => {
{({ input, meta }): JSX.Element => {
return (
<div className="input-description">
<Field>
Expand All @@ -193,11 +200,20 @@ const AddStack = (props: any): JSX.Element => {
className="Description-field"
{...input}
name="description"
onChange={(event: any): any => {
onChange={(event: React.ChangeEvent<HTMLInputElement>): void => {
input?.onChange(event);
}}
placeholder={addStackCMSData?.stack_description_placeholder}
error={(meta?.error || meta?.submitError) && meta?.touched}
/>
{meta?.error && meta?.touched && (
<ValidationMessage
version="v2"
testId="cs-stack-create-description-validation"
>
{meta?.error}
</ValidationMessage>
)}
</Field>
</div>
);
Expand All @@ -206,7 +222,7 @@ const AddStack = (props: any): JSX.Element => {
</Field>
<Field>
<ReactFinalField name={'locale'}>
{({ input, meta }): any => {
{({ input, meta }): JSX.Element => {
return (
<>
<FieldLabel
Expand All @@ -221,7 +237,7 @@ const AddStack = (props: any): JSX.Element => {
<Select
value={input?.value}
isSearchable={true}
onChange={(event: any): any => {
onChange={(event: React.ChangeEvent<HTMLInputElement>): void => {
input?.onChange(event);
}}
name="locale"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ const ContentMapper = () => {
</span>
<span className='ml-10'>
<Tooltip content="Schema Preview" position="bottom">
<Icon icon="LivePreview" version="v2" onClick={handleSchemaPreview} />
<Icon icon="LivePreview" version="v2" onClick={() => handleSchemaPreview(content?.otherCmsTitle)} />
</Tooltip>
</span>
</div>
Expand Down