From 50b5dfcc5e3edb314734fb7b5f4b560a94c5f79d Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Fri, 3 May 2024 12:26:34 +0530 Subject: [PATCH 1/5] Refactor: h1 font size --- ui/src/pages/Home/index.tsx | 2 +- ui/src/pages/RegionalLogin/index.tsx | 2 +- ui/src/scss/App.scss | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/pages/Home/index.tsx b/ui/src/pages/Home/index.tsx index dddf7c0ae..18497eda7 100644 --- a/ui/src/pages/Home/index.tsx +++ b/ui/src/pages/Home/index.tsx @@ -34,7 +34,7 @@ const Home = () => { return (
- {heading && } + {heading && } {description && parse(description)} {cta && cta?.title && ( diff --git a/ui/src/pages/RegionalLogin/index.tsx b/ui/src/pages/RegionalLogin/index.tsx index 31125391a..2a19cba05 100644 --- a/ui/src/pages/RegionalLogin/index.tsx +++ b/ui/src/pages/RegionalLogin/index.tsx @@ -62,7 +62,7 @@ const RegionalLogin = () => {
- {heading && } + {heading && } {description && description != '' && (
{parse(description as string)}
)} diff --git a/ui/src/scss/App.scss b/ui/src/scss/App.scss index 3a558d9c2..8cde76082 100644 --- a/ui/src/scss/App.scss +++ b/ui/src/scss/App.scss @@ -303,8 +303,10 @@ p { // overflow: hidden; } h1 { - font-size: 2.125rem; - font-weight: $font-weight-bold; + &.large-font { + font-size: 2.125rem; + font-weight: $font-weight-bold; + } } .pb-32 { padding-bottom: $px-32; From 47a3139480b6dd042f19295df8d01bf09fbd3ae8 Mon Sep 17 00:00:00 2001 From: Shristi Sinha Date: Fri, 3 May 2024 13:43:44 +0530 Subject: [PATCH 2/5] apply cond on login api if user don't have admin role, then user is not able to login --- api/src/constants/index.ts | 3 +++ api/src/services/auth.service.ts | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api/src/constants/index.ts b/api/src/constants/index.ts index 4042ff6e6..757db7391 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 8aba3358c..5b551ff1c 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 { From db89b3b23d81fc736b44423b5b68a34f3da584b4 Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Fri, 3 May 2024 14:56:36 +0530 Subject: [PATCH 3/5] ADA: Added Skip to Main Content --- ui/public/index.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ui/public/index.html b/ui/public/index.html index 4e8e345f5..ff2a7cd3d 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 +
From 20ed4d4e5408f00fef17ac1954fc349cd4b433fd Mon Sep 17 00:00:00 2001 From: snehalsankhe Date: Fri, 3 May 2024 15:39:39 +0530 Subject: [PATCH 4/5] 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

}