Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 1 addition & 3 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import './scss/App.scss';
function App() {
return (
<ErrorBoundary>
<Suspense>
{/* <Suspense fallback={<FullPageLoader resourceName="Migration" />}> */}

<Suspense fallback={<FullPageLoader resourceName="Migration" />}>
<AppContextProvider>
<AppLayout>
<AppRouter />
Expand Down
342 changes: 176 additions & 166 deletions ui/src/components/Common/AddStack/addStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,172 +80,182 @@ const AddStack = (props: any): JSX.Element => {
}, []);

return (
<FinalForm
onSubmit={onSubmit}
keepDirtyOnReinitialize={true}
validate={(values): any => {
const errors: any = {};
if (!values.name || values.name.trim().lenght < 1) {
errors.name = 'Stack name required';
}
if (!values.locale || values.locale === '') {
errors.locale = 'Required';
}
return errors;
}}
initialValues={{
locale: { label: 'English - United States', value: 'en-us' }
}}
render={({ handleSubmit }): JSX.Element => {
return (
<>
<div className="ReactModal__add-stack">
<form onSubmit={handleSubmit}>
<ModalHeader title={addStackCMSData?.title} closeModal={props.closeModal} />
<ModalBody className="no-scroll">
<Field>
<ReactFinalField name="name" type="input">
{({ input, meta }): JSX.Element => {
return (
<>
<FieldLabel
required
testId="cs-stack-create-title"
version="v2"
error={meta.error && meta.touched && true}
htmlFor="name"
>
{addStackCMSData.stack_name}
</FieldLabel>
<TextInput
testId="cs-stack-create-title-input"
version="v2"
{...input}
onChange={(event: any): any => {
input.onChange(event);
}}
name="name"
autoComplete="off"
type="text"
placeholder={addStackCMSData.stack_name_placeholder}
error={(meta.error || meta.submitError) && meta.touched}
/>
{meta.error && meta.touched && (
<ValidationMessage
version="v2"
testId="cs-stack-create-title-validation"
>
{meta.error}
</ValidationMessage>
)}
</>
);
}}
</ReactFinalField>
</Field>
<Field>
<ReactFinalField name={'description'} type="textarea">
{({ input }): any => {
return (
<div className="input-description">
<Field>
<FieldLabel
testId="cs-stack-create-description"
version="v2"
htmlFor="description"
>
{addStackCMSData.stack_description}
</FieldLabel>
<Textarea
testId="cs-stack-create-description-input"
version="v2"
className="Description-field"
{...input}
name="description"
onChange={(event: any): any => {
input.onChange(event);
}}
placeholder={addStackCMSData.stack_description_placeholder}
/>
</Field>
</div>
);
}}
</ReactFinalField>
</Field>
<Field>
<ReactFinalField name={'locale'}>
{({ input, meta }): any => {
return (
<>
<FieldLabel
required
testId="cs-stack-create-language"
version="v2"
error={meta.error && meta.touched && true}
htmlFor="locale"
>
{addStackCMSData.stack_locales}
</FieldLabel>
<Select
value={input.value}
isSearchable={true}
onChange={(event: any): any => {
input.onChange(event);
}}
name="locale"
width="300px"
options={props.locales}
isClearable={true}
version={'v2'}
placeholder={addStackCMSData.stack_locale_description}
/>
{meta.error && meta.touched && (
<ValidationMessage
testId="cs-stack-create-language-validation"
version="v2"
>
{meta.error}
</ValidationMessage>
)}
</>
);
}}
</ReactFinalField>
</Field>
</ModalBody>
<ModalFooter>
<ButtonGroup>
<Button
aria-label="Cancel"
version="v2"
testId="cs-cancel-create-stack"
buttonType="tertiary"
onClick={(): any => {
props.closeModal();
}}
>
{addStackCMSData.secondary_cta.title}
</Button>
<Button
aria-label="Create New Stack"
version="v2"
testId="cs-create-stack"
buttonType="primary"
name="submit"
type="submit"
loading={isProcessing}
>
{addStackCMSData.primary_cta.title}
</Button>
</ButtonGroup>
</ModalFooter>
</form>
</div>
</>
);
}}
/>
<>
{isLoading ? (
<div className="row">
<div className="col-12 text-center ">
<CircularLoader />
</div>
</div>
) : (
<FinalForm
onSubmit={onSubmit}
keepDirtyOnReinitialize={true}
validate={(values): any => {
const errors: any = {};
if (!values.name || values.name.trim().lenght < 1) {
errors.name = 'Stack name required';
}
if (!values.locale || values.locale === '') {
errors.locale = 'Required';
}
return errors;
}}
initialValues={{
locale: { label: 'English - United States', value: 'en-us' }
}}
render={({ handleSubmit }): JSX.Element => {
return (
<>
<div className="ReactModal__add-stack">
<form onSubmit={handleSubmit}>
<ModalHeader title={addStackCMSData?.title} closeModal={props.closeModal} />
<ModalBody className="no-scroll">
<Field>
<ReactFinalField name="name" type="input">
{({ input, meta }): JSX.Element => {
return (
<>
<FieldLabel
required
testId="cs-stack-create-title"
version="v2"
error={meta.error && meta.touched && true}
htmlFor="name"
>
{addStackCMSData.stack_name}
</FieldLabel>
<TextInput
testId="cs-stack-create-title-input"
version="v2"
{...input}
onChange={(event: any): any => {
input.onChange(event);
}}
name="name"
autoComplete="off"
type="text"
placeholder={addStackCMSData.stack_name_placeholder}
error={(meta.error || meta.submitError) && meta.touched}
/>
{meta.error && meta.touched && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<ValidationMessage
version="v2"
testId="cs-stack-create-title-validation"
>
{meta.error}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</ValidationMessage>
)}
</>
);
}}
</ReactFinalField>
</Field>
<Field>
<ReactFinalField name={'description'} type="textarea">
{({ input }): any => {
return (
<div className="input-description">
<Field>
<FieldLabel
testId="cs-stack-create-description"
version="v2"
htmlFor="description"
>
{addStackCMSData.stack_description}
</FieldLabel>
<Textarea
testId="cs-stack-create-description-input"
version="v2"
className="Description-field"
{...input}
name="description"
onChange={(event: any): any => {
input.onChange(event);
}}
placeholder={addStackCMSData.stack_description_placeholder}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/>
</Field>
</div>
);
}}
</ReactFinalField>
</Field>
<Field>
<ReactFinalField name={'locale'}>
{({ input, meta }): any => {
return (
<>
<FieldLabel
required
testId="cs-stack-create-language"
version="v2"
error={meta.error && meta.touched && true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

htmlFor="locale"
>
{addStackCMSData.stack_locales}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

</FieldLabel>
<Select
value={input.value}
isSearchable={true}
onChange={(event: any): any => {
input.onChange(event);
}}
name="locale"
width="300px"
options={props.locales}
isClearable={true}
version={'v2'}
placeholder={addStackCMSData.stack_locale_description}
/>
{meta.error && meta.touched && (
<ValidationMessage
testId="cs-stack-create-language-validation"
version="v2"
>
{meta.error}
</ValidationMessage>
)}
</>
);
}}
</ReactFinalField>
</Field>
</ModalBody>
<ModalFooter>
<ButtonGroup>
<Button
aria-label="Cancel"
version="v2"
testId="cs-cancel-create-stack"
buttonType="tertiary"
onClick={(): any => {
props.closeModal();
}}
>
{addStackCMSData.secondary_cta.title}
</Button>
<Button
aria-label="Create New Stack"
version="v2"
testId="cs-create-stack"
buttonType="primary"
name="submit"
type="submit"
loading={isProcessing}
>
{addStackCMSData.primary_cta.title}
</Button>
</ButtonGroup>
</ModalFooter>
</form>
</div>
</>
);
}}
/>
)}
</>
);
};

Expand Down
Loading