Skip to content

Commit

Permalink
Reposition internal notification sending feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JayaShakthi97 committed Dec 19, 2024
1 parent c318991 commit 1b6f5b5
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 39 deletions.
45 changes: 11 additions & 34 deletions apps/console/src/configs/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,17 @@ export const getAppViewRoutes = (): RouteInterface[] => {
path: AppConstants.getPaths().get("ALTERNATIVE_LOGIN_IDENTIFIER_EDIT"),
protected: true,
showOnSidePanel: false
},
{
component: lazy(() =>
import("@wso2is/admin.server.v1/pages/internal-notification-sending-page")
),
exact: true,
id: "internalNotificationSending",
name: "Internal Notification Sending",
path: AppConstants.getPaths().get("INTERNAL_NOTIFICATION_SENDING"),
protected: true,
showOnSidePanel: false
}
],
component: lazy(() =>
Expand Down Expand Up @@ -1071,40 +1082,6 @@ export const getAppViewRoutes = (): RouteInterface[] => {
protected: true,
showOnSidePanel: false
},
{
category: "extensions:manage.sidePanel.categories.settings",
children: [
{
component: lazy(() =>
import("@wso2is/admin.server.v1/pages/internal-notification-sending-page")
),
exact: true,
icon: {
icon: getSidePanelIcons().childIcon
},
id: "internal-notification-sending",
name: "Internal Notification Sending",
path: AppConstants.getPaths().get("INTERNAL_NOTIFICATION_SENDING"),
protected: true,
showOnSidePanel: false
}
],
component: lazy(() =>
import(
"@wso2is/admin.server.v1/pages/server"
)
),
exact: true,
icon: {
icon: getSidePanelIcons().userStore
},
id: "server",
name: "Server",
order: 25,
path: AppConstants.getPaths().get("SERVER"),
protected: true,
showOnSidePanel: true
},
{
category: "extensions:manage.sidePanel.categories.userManagement",
component: lazy(() => import("@wso2is/admin.workflow-approvals.v1/pages/approvals")),
Expand Down
17 changes: 17 additions & 0 deletions apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,23 @@
"enabled": false,
"scopes": {}
},
"internalNotificationSending": {
"disabledFeatures": [],
"enabled": true,
"scopes": {
"create": [],
"delete": [],
"feature": [
"console:loginAndRegistration"
],
"read": [
"internal_governance_view"
],
"update": [
"internal_governance_update"
]
}
},
"loginAndRegistration": {
"disabledFeatures": [],
"enabled": true,
Expand Down
3 changes: 1 addition & 2 deletions features/admin.core.v1/constants/app-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class AppConstants {
[ "SERVER",
`${AppConstants.getAdminViewBasePath()}/server` ],
[ "INTERNAL_NOTIFICATION_SENDING",
`${AppConstants.getAdminViewBasePath()}/server/internal-notification-sending` ],
`${AppConstants.getAdminViewBasePath()}/login-and-registration/internal-notification-sending` ],
[ "OUTBOUND_PROVISIONING_SETTINGS",
`${AppConstants.getAdminViewBasePath()}/outbound-provisioning-settings` ],
[ "IMPERSONATION", `${AppConstants.getAdminViewBasePath()}/login-and-registration/impersonation` ],
Expand Down Expand Up @@ -509,7 +509,6 @@ export class AppConstants {
public static readonly SUPER_ADMIN_ONLY_ROUTES: string[] = [
"admin-session-advisory-banner-edit",
"remote-logging",
"internal-notification-sending",
"server"
];

Expand Down
4 changes: 4 additions & 0 deletions features/admin.core.v1/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export interface FeatureConfigInterface {
* Connection management feature.
*/
connections?: ConnectionConfigInterface;
/**
* Notification sending feature.
*/
internalNotificationSending?: FeatureAccessConfigInterface;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ const GovernanceConnectorCategoriesGrid: FunctionComponent<GovernanceConnectorCa
return (
<EnvelopeMagnifyingGlassIcon className="icon" />
);
case ServerConfigurationsConstants.NOTIFICATION_SETTINGS_CONNECTOR_ID:
return (
<ArrowLoopRightUserIcon className="icon" />
);
default:
return <GearIcon className="icon" />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ export class ServerConfigurationsConstants {
public static readonly LOGIN_SECURITY_SETTINGS_CATEGORY_ID: string = "login-security";
public static readonly PROVISIONING_SETTINGS_CATEGORY_ID: string = "provider-settings";
public static readonly OUTBOUND_PROVISIONING_SETTINGS_CONNECTOR_ID: string = "outbound-provisioning-settings";
public static readonly NOTIFICATION_SETTINGS_CATEGORY_ID: string = "notification-settings";
public static readonly NOTIFICATION_SETTINGS_CONNECTOR_ID: string = "internal-notification-settings";

/**
* Multi Attribute Login Constants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
const hasResidentOutboundProvisioningFeaturePermission: boolean = useRequiredScopes(
featureConfig?.residentOutboundProvisioning?.scopes?.feature
);
const hasInternalNotificationSendingReadPermission: boolean = useRequiredScopes(
[
...featureConfig?.internalNotificationSending?.scopes?.feature,
...featureConfig?.internalNotificationSending?.scopes?.read
]
);

const predefinedCategories: any = useMemo(() => {
const originalConnectors: Array<any> = GovernanceConnectorUtils.getPredefinedConnectorCategories();
Expand All @@ -93,6 +99,9 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
const isResidentOutboundProvisioningEnabled: boolean = featureConfig?.residentOutboundProvisioning?.enabled
&& hasResidentOutboundProvisioningFeaturePermission;

const isInternalNotificationSendingConfigurationEnabled: boolean = featureConfig?.
internalNotificationSending?.enabled && hasInternalNotificationSendingReadPermission;

for (const category of originalConnectors) {
if (!isOrganizationDiscoveryEnabled
&& category.id === ServerConfigurationsConstants.ORGANIZATION_SETTINGS_CATEGORY_ID) {
Expand All @@ -104,6 +113,11 @@ export const ConnectorListingPage: FunctionComponent<ConnectorListingPageInterfa
continue;
}

if (!isInternalNotificationSendingConfigurationEnabled
&& category.id === ServerConfigurationsConstants.NOTIFICATION_SETTINGS_CATEGORY_ID) {
continue;
}

const filteredConnectors: Array<any> = category.connectors.
filter((connector: any) => !serverConfigurationConfig.connectorsToHide.includes(connector.id));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,22 @@ export class GovernanceConnectorUtils {
displayOrder: 0,
id: ServerConfigurationsConstants.PROVISIONING_SETTINGS_CATEGORY_ID,
title: "Provisioning Settings"
},
{
connectors: [
{
description: I18n.instance.t(
"console:manage.features.serverConfigs.manageNotificationSendingInternally.description"),
header: I18n.instance.t(
"console:manage.features.serverConfigs.manageNotificationSendingInternally.title"),
id: ServerConfigurationsConstants.NOTIFICATION_SETTINGS_CONNECTOR_ID,
route: AppConstants.getPaths().get("INTERNAL_NOTIFICATION_SENDING"),
testId: "internal-notification-settings-card"
}
],
displayOrder: 0,
id: ServerConfigurationsConstants.NOTIFICATION_SETTINGS_CATEGORY_ID,
title: "Notification Settings"
}
];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2024, 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 @@ -348,7 +348,7 @@ export const InternalNotificationSendingPage: FC<InternalNotificationSendingPage
* Handles the back button click event.
*/
const handleBackButtonClick = (): void => {
history.push(AppConstants.getPaths().get("SERVER"));
history.push(AppConstants.getPaths().get("LOGIN_AND_REGISTRATION"));
};

/**
Expand All @@ -368,7 +368,7 @@ export const InternalNotificationSendingPage: FC<InternalNotificationSendingPage
backButton={ {
"data-testid": `${ componentId }-page-back-button`,
onClick: handleBackButtonClick,
text: t("pages:rolesEdit.backButton", { type: "Server" })
text: t("governanceConnectors:goBackLoginAndRegistration")
} }
bottomMargin={ false }
contentTopMargin={ true }
Expand Down

0 comments on commit 1b6f5b5

Please sign in to comment.