From 163ed97eb339d19174188739ca85e5b1fb0d0241 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Fri, 20 Oct 2023 17:31:44 +0530 Subject: [PATCH] comments addressed --- apps/console/src/features/roles/api/roles.ts | 9 +++++---- .../roles/components/wizard-updated/role-basics.tsx | 13 ++----------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/apps/console/src/features/roles/api/roles.ts b/apps/console/src/features/roles/api/roles.ts index a897657dd0f..b9f5d7975bc 100644 --- a/apps/console/src/features/roles/api/roles.ts +++ b/apps/console/src/features/roles/api/roles.ts @@ -111,7 +111,7 @@ export const searchRoleList = (searchData: SearchRoleInterface): Promise => * Delete a selected role with a given role ID. * * @param roleId - Id of the role which needs to be deleted. - * @returns `Promise` a promise containing the status of the delete. + * @returns A promise containing the status of the delete. */ export const deleteRoleById = (roleId: string): Promise => { const requestConfig: RequestConfigInterface = { @@ -183,7 +183,7 @@ export const updateRolePermissions = (roleId: string, data: unknown): Promise` a promise containing the permission list + * @returns A promise containing the permission list */ export const getPermissionList = (): Promise => { const requestConfig: RequestConfigInterface = { @@ -256,7 +256,7 @@ export const updateRole = (roleId: string, roleData: PatchRoleDataInterface): Pr * TODO: Return `response.data` rather than `response` and stop returning any. * * @param domain - User store domain. - * @returns `Promise` + * @returns A promise containing the roles list. * @throws `IdentityAppsApiException` * @deprecated - Use `useRolesList` instead. */ @@ -303,7 +303,7 @@ export const getRolesList = (domain: string): Promise = * * @param domain - User store domain. * @param filter - Search filter. - * @returns `RequestResultInterface` + * @returns The object containing the roles list. */ export const useRolesList = ( domain: string, @@ -312,6 +312,7 @@ export const useRolesList = = (props: RoleBasicPr const [ applicationSearchQuery, setApplicationSearchQuery ] = useState(undefined); const [ assignedApplicationsSearching, setAssignedApplicationsSearching ] = useState(false); const [ applicationListOptions, setApplicationListOptions ] = useState([]); - const noApplicationsAvailable: MutableRefObject = useRef(false); const { @@ -104,11 +101,10 @@ export const RoleBasics: FunctionComponent = (props: RoleBasicPr } = useApplicationList("clientId", null, null, applicationSearchQuery); useEffect(() => { - if (applicationListFetchRequestError) { setIsDisplayNoAppScopeApplicatioError(true); setIsDisplayApplicationList(false); - + return; } @@ -146,11 +142,7 @@ export const RoleBasics: FunctionComponent = (props: RoleBasicPr } }); - if (options.length === 0) { - noApplicationsAvailable.current = true; - } else { - noApplicationsAvailable.current = false; - } + noApplicationsAvailable.current = (options.length === 0); setApplicationListOptions(options); }, [ applicationList ]); @@ -183,7 +175,6 @@ export const RoleBasics: FunctionComponent = (props: RoleBasicPr */ const searchApplications: DebouncedFunc<(query: string) => void> = useCallback(debounce((query: string) => { - query = !isEmpty(query) ? query : null; setApplicationSearchQuery(query ? `name co ${query}` : null); mutateApplicationListFetchRequest().finally(() => { setAssignedApplicationsSearching(false);