Skip to content

Commit

Permalink
(fix) enable custom user store managers
Browse files Browse the repository at this point in the history
  • Loading branch information
Achintha Isuru committed Nov 15, 2023
1 parent ce60d2e commit 73c8fa5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
7 changes: 4 additions & 3 deletions apps/console/src/features/userstores/models/user-stores.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2020-2023, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down Expand Up @@ -103,11 +103,12 @@ export interface TypeProperty {
* The type of object returned by the type meta endpoint
*/
export interface UserstoreType {
name: string;
name?: string;
typeName: string;
typeId: string;
isLocal?: boolean;
className: string;
description: string;
description?: string;
properties: {
Mandatory: TypeProperty[];
Optional: TypeProperty[];
Expand Down
21 changes: 11 additions & 10 deletions apps/console/src/features/userstores/pages/userstores-templates.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2020-2023, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -19,6 +19,7 @@
import { AlertLevels, TestableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { EmptyPlaceholder, PageLayout, TemplateGrid } from "@wso2is/react-components";
import { AxiosError } from "axios";
import React, { FunctionComponent, ReactElement, SyntheticEvent, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
Expand Down Expand Up @@ -91,14 +92,13 @@ const UserstoresTemplates: FunctionComponent<UserstoresTemplatesPageInterface> =
useEffect(() => {
getUserstoreTypes().then(async (response: TypeResponse[]) => {
setIsLoading(true);
const typeRequests: Promise<any>[] = response.map((type: TypeResponse) => {
const typeRequests: Promise<UserstoreType>[] = response.map((type: TypeResponse) => {
return getAType(type.typeId, null);
});
const results: UserstoreType[] = await Promise.all(
typeRequests.map(response => response.catch(error => {
const results: (void | UserstoreType)[] = await Promise.all(
typeRequests.map((response: Promise<UserstoreType>) => response.catch((error: AxiosError) => {
dispatch(addAlert({
description: error?.description
|| t("console:manage.features.userstores.notifications." +
description: t("console:manage.features.userstores.notifications." +
"fetchUserstoreTemplates.genericError.description"),
level: AlertLevels.ERROR,
message: error?.message
Expand Down Expand Up @@ -140,9 +140,9 @@ const UserstoresTemplates: FunctionComponent<UserstoresTemplatesPageInterface> =
});
setUserstoreTypes(uniqueUserstoreTypes.concat(userstoreTypes));
setRawUserstoreTypes(rawUserstoreTypes);
}).catch(error => {
}).catch((error: AxiosError) => {
dispatch(addAlert({
description: error?.description || t("console:manage.features.userstores.notifications." +
description: t("console:manage.features.userstores.notifications." +
"fetchUserstoreTypes.genericError.description"),
level: AlertLevels.ERROR,
message: error?.message || t("console:manage.features.userstores.notifications." +
Expand Down Expand Up @@ -193,15 +193,16 @@ const UserstoresTemplates: FunctionComponent<UserstoresTemplatesPageInterface> =
type="userstore"
templates={ userstoreTypes }
onTemplateSelect={ (e: SyntheticEvent, { id }: { id: string }) => {
setSelectedType(rawUserstoreTypes.find((type) => type.typeId === id));
setSelectedType(rawUserstoreTypes.find(
(type: UserstoreType) => type.typeId === id));
} }
templateIcons={ getUserstoreTemplateIllustrations() as any }
templateIconOptions={ {
fill: "primary"
} }
templateIconSize="tiny"
paginate={ true }
paginationLimit={ 4 }
paginationLimit={ userstoreTypes?.length ? userstoreTypes.length : 0 }
paginationOptions={ {
showLessButtonLabel: t("common:showLess"),
showMoreButtonLabel: t("common:showMore")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73c8fa5

Please sign in to comment.