diff --git a/api/src/constants/index.ts b/api/src/constants/index.ts index 4042ff6e..757db739 100644 --- a/api/src/constants/index.ts +++ b/api/src/constants/index.ts @@ -70,7 +70,10 @@ export const HTTP_TEXTS = { "Reseting the content mapping is restricted. Please verify the status and review preceding actions.", CONTENTMAPPER_NOT_FOUND: "Sorry, the requested content mapper id does not exists.", + ADMIN_LOGIN_ERROR: + "Sorry, You Don't have admin access in any of the Organisation" }; + export const HTTP_RESPONSE_HEADERS = { "Access-Control-Allow-Origin": "*", "Content-Type": "application/json", diff --git a/api/src/services/auth.service.ts b/api/src/services/auth.service.ts index 8aba3358..5b551ff1 100644 --- a/api/src/services/auth.service.ts +++ b/api/src/services/auth.service.ts @@ -24,7 +24,7 @@ const login = async (req: Request): Promise => { method: "POST", url: `${config.CS_API[ userData?.region as keyof typeof config.CS_API - ]!}/user-session`, + ]!}/user-session?include_orgs_roles=true`, headers: { "Content-Type": "application/json", }, @@ -48,6 +48,12 @@ const login = async (req: Request): Promise => { status: err?.response?.status, }; } + const orgs = (res?.data?.user?.organizations || []) + ?.filter((org: any) => org?.org_roles?.some((item: any) => item.admin)) + ?.map(({ uid, name }: any) => ({ org_id: uid, org_name: name })); + if (!orgs.length) { + throw new BadRequestError(HTTP_TEXTS.ADMIN_LOGIN_ERROR); + } if (res?.status === HTTP_CODES.SUPPORT_DOC) return { diff --git a/ui/public/index.html b/ui/public/index.html index 4e8e345f..ff2a7cd3 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -46,9 +46,27 @@ src="https://ui.contentstack.com/contentstack.min.js" async > + + + Skip to main content +
diff --git a/ui/src/components/Card/index.tsx b/ui/src/components/Card/index.tsx index 4c33db92..9657208c 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 78f88743..5eba8107 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 d53755f0..4c0a466a 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 1f857340..b3ffac3b 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 538011d7..fa5ed3ea 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 2d1addbe..e308b6cf 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 &&

Affix should not be more than 5 chars

}