From 2d8875c797f68a41e887248024a7f631d4b50d78 Mon Sep 17 00:00:00 2001 From: pranalidhanavade <137780597+pranalidhanavade@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:28:23 +0530 Subject: [PATCH] fix: error messages issue from create organization and create ecosystem modals. (#698) * fix:css issues Signed-off-by: pranalidhanavade * fix:sonarcloud issues Signed-off-by: pranalidhanavade * fix:clear error on pop-up close Signed-off-by: pranalidhanavade --------- Signed-off-by: pranalidhanavade --- src/components/CreateEcosystemOrgModal/index.tsx | 2 ++ src/components/RoleViewButton/index.tsx | 6 ++++-- src/components/organization/OrganizationsList.tsx | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/CreateEcosystemOrgModal/index.tsx b/src/components/CreateEcosystemOrgModal/index.tsx index 3343441bd..09558b114 100644 --- a/src/components/CreateEcosystemOrgModal/index.tsx +++ b/src/components/CreateEcosystemOrgModal/index.tsx @@ -261,6 +261,7 @@ const CreateEcosystemOrgModal = (props: IProps) => { }); props.setOpenModal(false); setImgError(' ') + setErrMsg(null); }} > Create {popupName} @@ -270,6 +271,7 @@ const CreateEcosystemOrgModal = (props: IProps) => { type={'failure'} onAlertClose={() => { setErrMsg(null); + }} /> { +const RoleViewButton = ({ title, buttonTitle, svgComponent, onClickEvent, feature, isOutline, isPadding, disabled }: RoleViewButtonProps) => { const [userRoles, setUserRoles] = useState([]) @@ -75,10 +76,11 @@ const RoleViewButton = ({ title, buttonTitle, svgComponent, onClickEvent, featur ? "!p-0 role-btn group flex h-min items-center justify-center text-center focus:z-10 focus:ring-2 ring-primary-700 bg-white-700 hover:bg-secondary-700 ring-2 text-black font-medium rounded-md text-sm dark:text-white dark:hover:text-primary-700" : `${isPadding ? "!p-0" : ""} text-base font-medium text-center text-white bg-primary-700 hover:!bg-primary-800 rounded-md hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 sm:w-auto dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800` }`} - disabled={!(isRoleAccess())} + disabled={disabled || !isRoleAccess()} > {svgComponent} {buttonTitle} + ) diff --git a/src/components/organization/OrganizationsList.tsx b/src/components/organization/OrganizationsList.tsx index 608e6ddb9..34b96050f 100644 --- a/src/components/organization/OrganizationsList.tsx +++ b/src/components/organization/OrganizationsList.tsx @@ -26,6 +26,7 @@ const initialPageState = { pageNumber: 1, pageSize: 9, total: 100, + totalCount: 0 }; const OrganizationsList = () => { @@ -59,10 +60,9 @@ const OrganizationsList = () => { searchText, ); const { data } = response as AxiosResponse; - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const totalPages = data?.data?.totalPages; - + const totalCount =data?.data?.totalCount; const orgList = data?.data?.organizations.map((userOrg: Organisation) => { const roles: string[] = userOrg.userOrgRoles.map( (role) => role.orgRole.name, @@ -75,6 +75,7 @@ const OrganizationsList = () => { setCurrentPage({ ...currentPage, total: totalPages, + totalCount: totalCount, }); } else { setError(response as string); @@ -267,6 +268,7 @@ const OrganizationsList = () => { } onClickEvent={createOrganizationModel} + disabled={currentPage.totalCount >= 10} />