From 20ed4d4e5408f00fef17ac1954fc349cd4b433fd Mon Sep 17 00:00:00 2001 From: snehalsankhe Date: Fri, 3 May 2024 15:39:39 +0530 Subject: [PATCH 1/2] added project status and ui issue --- ui/src/components/Card/index.tsx | 3 ++- ui/src/components/Common/AddStack/addStack.scss | 4 ++++ ui/src/components/Common/AddStack/addStack.tsx | 4 ++-- .../DestinationStack/Actions/LoadStacks.tsx | 16 ++++++++-------- ui/src/components/DestinationStack/index.tsx | 4 ++-- .../components/LegacyCms/Actions/LoadPrefix.tsx | 1 + ui/src/components/LegacyCms/index.tsx | 4 ++-- ui/src/components/LegacyCms/legacyCms.scss | 6 +++++- ui/src/services/api/service.interface.ts | 4 ++-- ui/src/utilities/constants.interface.ts | 3 +++ ui/src/utilities/constants.ts | 16 ++++++++++------ 11 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 ui/src/utilities/constants.interface.ts diff --git a/ui/src/components/Card/index.tsx b/ui/src/components/Card/index.tsx index 4c33db929..9657208c7 100644 --- a/ui/src/components/Card/index.tsx +++ b/ui/src/components/Card/index.tsx @@ -3,6 +3,7 @@ import { useContext, useEffect, useState } from 'react'; import { Tooltip } from '@contentstack/venus-components'; import { useNavigate } from 'react-router-dom'; // Utilities +import { PROJECT_STATUS } from '../../utilities/constants'; import { getDays, isEmptyString } from '../../utilities/functions'; import { AppContext } from '../../context/app/app.context'; // Interface @@ -42,7 +43,7 @@ const CardList = ({ project }: ProjectType) => {
Project Status - {project?.status} + {PROJECT_STATUS?.[project?.status !== undefined ? project?.status : 0]}
diff --git a/ui/src/components/Common/AddStack/addStack.scss b/ui/src/components/Common/AddStack/addStack.scss index 78f88743a..5eba81072 100644 --- a/ui/src/components/Common/AddStack/addStack.scss +++ b/ui/src/components/Common/AddStack/addStack.scss @@ -6,3 +6,7 @@ width: 200px !important; } } +.ReactModal__Overlay .ReactModal__Content .ReactModal__Content__body.selectWrapperBody { + overflow: visible; +} + diff --git a/ui/src/components/Common/AddStack/addStack.tsx b/ui/src/components/Common/AddStack/addStack.tsx index d53755f05..4c0a466a3 100644 --- a/ui/src/components/Common/AddStack/addStack.tsx +++ b/ui/src/components/Common/AddStack/addStack.tsx @@ -78,7 +78,6 @@ const AddStack = (props: any): JSX.Element => { setIsLoading(false); }); }, []); - return ( <> {isLoading ? ( @@ -110,7 +109,7 @@ const AddStack = (props: any): JSX.Element => {
- + {({ input, meta }): JSX.Element => { @@ -204,6 +203,7 @@ const AddStack = (props: any): JSX.Element => { name="locale" width="300px" options={props?.locales} + maxMenuHeight={200} isClearable={true} version={'v2'} placeholder={addStackCMSData?.stack_locale_description} diff --git a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx index 1f8573402..b3ffac3b3 100644 --- a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx +++ b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx @@ -141,8 +141,9 @@ const LoadStacks = (props: LoadFileFormatProps) => { newMigrationData?.destination_stack?.selectedOrg?.value ); //org id will always be there + //fetch all locales - const response = await getAllLocales(newMigrationData?.destination_stack?.selectedOrg?.value); //org id will always be there + const response = await getAllLocales(selectedOrganisation?.value); //org id will always be there const rawMappedLocalesMapped = validateObject(response?.data) && response?.data?.locales ? Object?.keys(response?.data?.locales)?.map((key) => ({ @@ -153,7 +154,6 @@ const LoadStacks = (props: LoadFileFormatProps) => { created_at: key })) : []; - setAllLocales(rawMappedLocalesMapped); const stackArray = validateArray(stackData?.data?.stacks) @@ -193,6 +193,12 @@ const LoadStacks = (props: LoadFileFormatProps) => { updateNewMigrationData(newMigrationDataObj); }; + + /**** ALL USEEffects HERE ****/ + useEffect(() => { + fetchData(); + }, []); + const handleCreateNewStack = () => { cbModal({ component: (props: LoadFileFormatProps) => ( @@ -216,12 +222,6 @@ const LoadStacks = (props: LoadFileFormatProps) => { } }); }; - /**** ALL USEEffects HERE ****/ - - useEffect(() => { - fetchData(); - }, []); - return (
diff --git a/ui/src/components/DestinationStack/index.tsx b/ui/src/components/DestinationStack/index.tsx index 538011d71..65a97d136 100644 --- a/ui/src/components/DestinationStack/index.tsx +++ b/ui/src/components/DestinationStack/index.tsx @@ -163,8 +163,8 @@ const DestinationStackComponent = ({ //Check for migration Status and lock. // Status where Migration is to be Locked: setIsMigrationLocked( - projectData.status === PROJECT_STATUS.INPROGRESS || - projectData.status === PROJECT_STATUS.SUCCESS + projectData.status === 2 || + projectData.status === 5 ); }; fetchCMSData(); diff --git a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx index 2d1addbec..19142fafa 100644 --- a/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx +++ b/ui/src/components/LegacyCms/Actions/LoadPrefix.tsx @@ -128,6 +128,7 @@ const LoadPreFix = (props: LoadSelectCmsProps) => { version="v2" error={isError} /> + {isError &&

Project Name should not be more than 5 chars

}