Skip to content

Commit

Permalink
Merge pull request #6980 from pavinduLakshan/console_settings_bug_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan authored Oct 14, 2024
2 parents 27f6385 + 5e492dc commit dcb30c1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-rivers-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/console": patch
---

Add administrator settings route under console settings route config
12 changes: 12 additions & 0 deletions apps/console/src/configs/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,18 @@ export const getAppViewRoutes = (): RouteInterface[] => {
path: AppConstants.getPaths().get("CONSOLE_ADMINISTRATORS_EDIT"),
protected: true,
showOnSidePanel: false
},
{
component: lazy(() => import("@wso2is/admin.administrators.v1/pages/administrator-settings")),
exact: true,
icon: {
icon: getSidePanelIcons().childIcon
},
id: "administrator-settings-edit",
name: "administrator-settings-edit",
path: AppConstants.getPaths().get("ADMINISTRATOR_SETTINGS"),
protected: true,
showOnSidePanel: false
}
],
component: lazy(() => import("@wso2is/admin.console-settings.v1/pages/console-settings-page")),
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/extensions/i18n/models/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3326,6 +3326,7 @@ export interface Extensions {
administratorSettingsSubtitle: string;
administratorSettingsTitle: string;
backButton: string;
backButtonConsoleSettings: string;
disableToggleMessage: string;
enableToggleMessage: string;
error: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4026,6 +4026,7 @@ export const extensions: Extensions = {
administratorSettingsSubtitle: "Settings related to organizational administrators.",
administratorSettingsTitle: "Administrator Settings",
backButton: "Go back to administrators",
backButtonConsoleSettings: "Go back to console settings",
disableToggleMessage: "Enable users to manage the organization",
enableToggleMessage: "Disable users to manage the organization",
error: {
Expand Down
21 changes: 17 additions & 4 deletions features/admin.administrators.v1/pages/administrator-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
* under the License.
*/

import { history, store } from "@wso2is/admin.core.v1";
import { FeatureAccessConfigInterface } from "@wso2is/access-control";
import { AppConstants, AppState, history, store } from "@wso2is/admin.core.v1";
import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { DocumentationLink, PageLayout, useDocumentation } 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";
import { useDispatch, useSelector } from "react-redux";
import { Dispatch } from "redux";
import { Checkbox, CheckboxProps, Icon, Message } from "semantic-ui-react";
import { updateOrganizationConfigV2 } from "../api/updateOrganizationConfigV2";
Expand Down Expand Up @@ -55,6 +56,14 @@ export const AdminSettingsPage: FunctionComponent<AdminSettingsPageInterface> =

const dispatch: Dispatch = useDispatch();

const consoleSettingsFeatureConfig: FeatureAccessConfigInterface = useSelector(
(state: AppState) => state?.config?.ui?.features?.consoleSettings
);
const isPrivilegedUsersInConsoleSettingsEnabled: boolean = !consoleSettingsFeatureConfig
?.disabledFeatures?.includes(
"consoleSettings.privilegedUsers"
);

const useOrgConfig: UseOrganizationConfigType = useOrganizationConfigV2;
const updateOrgConfig: (isEnterpriseLoginEnabled: OrganizationInterface) =>
Promise<any> = updateOrganizationConfigV2;
Expand Down Expand Up @@ -155,7 +164,9 @@ export const AdminSettingsPage: FunctionComponent<AdminSettingsPageInterface> =
* This handles back button navigation
*/
const handleBackButtonClick = () => {
history.push(AdministratorConstants.getPaths().get("COLLABORATOR_USERS_PATH"));
history.push(isPrivilegedUsersInConsoleSettingsEnabled
? AppConstants.getPaths().get("CONSOLE_SETTINGS")
: AdministratorConstants.getPaths().get("COLLABORATOR_USERS_PATH"));
};

/**
Expand Down Expand Up @@ -197,7 +208,9 @@ export const AdminSettingsPage: FunctionComponent<AdminSettingsPageInterface> =
backButton={ {
"data-componentid": `${ testId }-page-back-button`,
onClick: handleBackButtonClick,
text: t("extensions:manage.users.administratorSettings.backButton")
text: isPrivilegedUsersInConsoleSettingsEnabled
? t("extensions:manage.users.administratorSettings.backButtonConsoleSettings")
: t("extensions:manage.users.administratorSettings.backButton")
} }
bottomMargin={ false }
contentTopMargin={ true }
Expand Down

0 comments on commit dcb30c1

Please sign in to comment.