Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the multi attribute login connector to the login & registration page #4355

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silver-beans-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/console": patch
---

Move Multi Attribute Login connector to Login & Registration
8 changes: 5 additions & 3 deletions apps/console/src/extensions/configs/server-configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ export const serverConfigurationConfig: ServerConfigurationConfig = {
],
connectorToggleName: {},
connectorsToHide: [
"analytics-engine",
"elastic-analytics-engine",
"pii-controller"
ServerConfigurationsConstants.WSO2_ANALYTICS_ENGINE_CONNECTOR_CATEGORY_ID,
ServerConfigurationsConstants.ELK_ANALYTICS_CONNECTOR_ID,
ServerConfigurationsConstants.LITE_USER_REGISTRATION_CONNECTOR_ID,
ServerConfigurationsConstants.MULTI_ATTRIBUTE_LOGIN_CONNECTOR_ID,
ServerConfigurationsConstants.CONSENT_INFO_CONNECTOR_ID
],
connectorsToShow: [ "all" ],
customConnectors: [
Expand Down
35 changes: 20 additions & 15 deletions apps/console/src/features/core/configs/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import {
ArrowRightToBracketPencilIcon,
BoltIcon,
EnvelopeGearIcon,
EnvelopeIcon,
HierarchyIcon,
LightbulbOnIcon,
LinearNodesIcon,
UserCircleDotIcon,
UserGroupIcon
} from "@oxygen-ui/react-icons";
import { RouteInterface } from "@wso2is/core/models";
Expand Down Expand Up @@ -124,17 +128,6 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
protected: true,
showOnSidePanel: true
},
{
component: lazy(() => import("../../server-configurations/pages/governance-connectors")),
exact: true,
icon: null,
id: "governanceConnectors",
name: "console:manage.features.sidePanel.governanceConnectors",
order: 11,
path: AppConstants.getPaths().get("GOVERNANCE_CONNECTORS"),
protected: true,
showOnSidePanel: false
},
{
category: "console:develop.features.sidePanel.categories.application",
children: [
Expand Down Expand Up @@ -351,7 +344,7 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
component: lazy(() => import("../../oidc-scopes/pages/oidc-scopes")),
exact: true,
icon: {
icon: getSidePanelIcons().scopes
icon: <UserCircleDotIcon fill="black" className="icon" />
},
id: "oidcScopes",
name: "console:develop.features.sidePanel.oidcScopes",
Expand Down Expand Up @@ -458,7 +451,7 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
import("../../../features/email-management/" + "pages/email-customization")
),
exact: true,
icon: { icon: getSidePanelIcons().emailTemplates },
icon: { icon: <EnvelopeIcon fill="black" className="icon" /> },
id: "communication-management",
name: "Email",
order: 14,
Expand Down Expand Up @@ -876,7 +869,7 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
featureStatus: "BETA",
featureStatusLabel: "common:beta",
icon: {
icon: getSidePanelIcons().insights
icon: <LightbulbOnIcon fill="black" className="icon" />
},
id: "insights",
name: "Insights",
Expand All @@ -894,7 +887,7 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
),
exact: true,
icon: {
icon: getSidePanelIcons().insights
icon: <LinearNodesIcon fill="black" className="icon" />
},
id: "analytics",
name: "Analytics",
Expand Down Expand Up @@ -990,6 +983,18 @@ export const getAppViewRoutes = (useExtendedRoutes: boolean = false): RouteInter
path: AppConstants.getPaths().get("GOVERNANCE_CONNECTORS"),
protected: true,
showOnSidePanel: false
},
{
component: lazy(() => import("../../server-configurations/pages/multi-attribute-login-edit")),
exact: true,
icon: null,
id: "multiAttributeLogin",
name: "console:manage.features.governanceConnectors.connectorCategories.accountManagement." +
"connectors.multiattributeLoginHandler.friendlyName",
order: 999,
path: AppConstants.getPaths().get("MULTI_ATTRIBUTE_LOGIN"),
protected: true,
showOnSidePanel: false
}
]),
"id"
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/features/core/constants/app-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export class AppConstants {
[ "ROLE_EDIT", `${ AppConstants.getAdminViewBasePath() }/roles/:id` ],
[ "ROOT", "/" ],
[ "GOVERNANCE_CONNECTORS", `${AppConstants.getAdminViewBasePath()}/governance-connectors/:id` ],
[ "MULTI_ATTRIBUTE_LOGIN", `${AppConstants.getAdminViewBasePath()}/multi-attribute-login` ],
[ "UNAUTHORIZED", `${AppConstants.getMainViewBasePath()}/unauthorized` ],
[ "USERS", `${AppConstants.getAdminViewBasePath()}/users` ],
[ "USER_EDIT", `${AppConstants.getAdminViewBasePath()}/users/:id` ],
Expand Down
9 changes: 7 additions & 2 deletions apps/console/src/features/core/utils/route-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import {
BuildingGearIcon,
DatabaseDocumentIcon,
PaletteIcon,
SquareUserIcon
} from "@oxygen-ui/react-icons";
Expand Down Expand Up @@ -262,7 +263,7 @@ export class RouteUtils {
};

const userAttributesAndStores: Omit<RouteInterface, "showOnSidePanel"> = {
icon: BuildingGearIcon,
icon: DatabaseDocumentIcon,
id: "userAttributesAndStores",
name: "User Attributes & Stores"
};
Expand Down Expand Up @@ -315,7 +316,8 @@ export class RouteUtils {
AppConstants.getPaths().get("LOGIN_AND_REGISTRATION"),
AppConstants.getPaths().get("USERNAME_VALIDATION_EDIT"),
AppConstants.getPaths().get("ALTERNATIVE_LOGIN_IDENTIFIER_EDIT"),
AppConstants.getPaths().get("ADMIN_ADVISORY_BANNER_EDIT")
AppConstants.getPaths().get("ADMIN_ADVISORY_BANNER_EDIT"),
AppConstants.getPaths().get("MULTI_ATTRIBUTE_LOGIN")
];

const CategoryMappedRoutes: Omit<RouteInterface, "showOnSidePanel">[] = [
Expand Down Expand Up @@ -370,16 +372,19 @@ export class RouteUtils {
{
category: manage,
id: "userStores",
order: 2,
parent: userAttributesAndStores
},
{
category: manage,
id: "attributeDialects",
order: 1,
parent: userAttributesAndStores
},
{
category: manage,
id: "oidcScopes",
order: 3,
parent: userAttributesAndStores
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const DynamicGovernanceConnector: FunctionComponent<DynamicGovernanceConn
const data: UpdateGovernanceConnectorConfigInterface = {
operation: "UPDATE",
properties: []
};
};

for (const key in values) {
data.properties.push({
Expand All @@ -149,14 +149,14 @@ export const DynamicGovernanceConnector: FunctionComponent<DynamicGovernanceConn

setIsSubmitting(true);

updateGovernanceConnector(data, connector.categoryId, connector.id)
updateGovernanceConnector(data, connector?.categoryId, connector?.id)
.then(() => {
dispatch(
addAlert({
description: t(
"console:manage.features.governanceConnectors.notifications." +
"updateConnector.success.description",
{ name: connector.friendlyName }
{ name: connector?.friendlyName }
),
level: AlertLevels.SUCCESS,
message: t(
Expand Down Expand Up @@ -197,15 +197,15 @@ export const DynamicGovernanceConnector: FunctionComponent<DynamicGovernanceConn
onSubmit={ handleSubmit }
connector={ connector }
props={ {
properties: connector.properties.filter(
properties: connector?.properties.filter(
((property: ConnectorPropertyInterface) =>
serverConfigurationConfig.connectorPropertiesToShow.includes(property.name)
|| serverConfigurationConfig.connectorPropertiesToShow
.includes(ServerConfigurationsConstants.ALL)))
} }
form={ kebabCase(connector.friendlyName) + "-form" }
form={ kebabCase(connector?.friendlyName) + "-form" }
initialValues={ getConnectorInitialValues(connector) }
data-testid={ `${ testId }-${ connector.name }-form` }
data-testid={ `${ testId }-${ connector?.name }-form` }
isSubmitting={ isSubmitting }
/>
);
Expand Down Expand Up @@ -245,7 +245,7 @@ export const DynamicGovernanceConnector: FunctionComponent<DynamicGovernanceConn
return null;
}

let connectorName: string = connector.friendlyName;
let connectorName: string = connector?.friendlyName;

if (connectorName.includes(ServerConfigurationsConstants.DEPRECATION_MATCHER)) {
connectorName = connectorName.replace(ServerConfigurationsConstants.DEPRECATION_MATCHER, "");
Expand All @@ -268,12 +268,12 @@ export const DynamicGovernanceConnector: FunctionComponent<DynamicGovernanceConn
return null;
}

if (connector.id === ServerConfigurationsConstants.WSO2_ANALYTICS_ENGINE_CONNECTOR_CATEGORY_ID) {
if (connector?.id === ServerConfigurationsConstants.WSO2_ANALYTICS_ENGINE_CONNECTOR_CATEGORY_ID) {
return (
<Message
warning
className="mb-5 connector-info"
data-componentid={ `${ componentId }-${ connector.id }-deprecation-warning` }
data-componentid={ `${ componentId }-${ connector?.id }-deprecation-warning` }
>
<Icon name="warning sign" />
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { I18n } from "@wso2is/i18n";
import { PageLayout } from "@wso2is/react-components";
import { AxiosError } from "axios";
import camelCase from "lodash-es/camelCase";
import lowerCase from "lodash-es/lowerCase";
import React, { FunctionComponent, MutableRefObject, ReactElement, useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
Expand Down Expand Up @@ -320,6 +321,10 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
}
};

const handleMultiAttributeLoginAction = () => {
history.push(AppConstants.getPaths().get("MULTI_ATTRIBUTE_LOGIN"));
};

/**
* Get connector categories which generate the connector forms dynamically.
*/
Expand Down Expand Up @@ -387,6 +392,11 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
return getStaticConnectors();
};

const multiAttributeLoginDescription: string = t("console:manage.features.governanceConnectors." +
"connectorSubHeading", { name: lowerCase(t("console:manage.features.governanceConnectors.connectorCategories." +
"accountManagement.connectors.multiattributeLoginHandler.friendlyName"))
});

return (
<PageLayout
pageTitle= { t("console:common.sidePanel.loginAndRegistration.label") }
Expand All @@ -406,9 +416,26 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
{
serverConfigurationConfig.dynamicConnectors
? (
<Grid xs={ 12 } lg={ 6 }>
<AdminAdvisoryBannerSection />
</Grid>
<>
<Grid xs={ 12 } lg={ 6 }>
<AdminAdvisoryBannerSection />
</Grid>
<Grid xs={ 12 } lg={ 6 }>
<SettingsSection
data-componentid={ "multi-attribute-login-section" }
data-testid={ "multi-attribute-login-section" }
description={ multiAttributeLoginDescription }
icon={ <GearIcon className="icon" /> }
header={
t("console:manage.features.governanceConnectors." +
"connectorCategories.accountManagement.connectors." +
"multiattributeLoginHandler.friendlyName")
}
onPrimaryActionClick={ handleMultiAttributeLoginAction }
primaryAction={ t("common:configure") }
/>
</Grid>
</>
) : (
<>
<Grid xs={ 12 } lg={ 6 }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { Grid, Menu, Rail, Ref, Sticky } from "semantic-ui-react";
import { serverConfigurationConfig } from "../../../extensions";
import { AppConstants, AppState, FeatureConfigInterface, UIConstants, history } from "../../core";
import { OrganizationUtils } from "../../organizations/utils";
import { getConnectorCategory } from "../api";
import { getConnectorCategory } from "../api/governance-connectors";
import { DynamicGovernanceConnector } from "../components";
import { ServerConfigurationsConstants } from "../constants";
import { GovernanceConnectorCategoryInterface, GovernanceConnectorInterface } from "../models";
Expand Down Expand Up @@ -206,7 +206,7 @@ export const GovernanceConnectorsPage: FunctionComponent<GovernanceConnectorsPag
|| serverConfigurationConfig.connectorsToShow.includes(
ServerConfigurationsConstants.ALL) &&
!serverConfigurationConfig.connectorsToHide.includes(
connector.name
connector.id
) ) {
const connectorElement: ReactElement = (
<Grid.Row ref={ connector.ref }>
Expand Down
Loading
Loading