Skip to content

Commit

Permalink
Merge pull request #5803 from jathushan-r/i18n-sep-consoleSettings
Browse files Browse the repository at this point in the history
Separate i18n namespaces feature-wise: consoleSettings
  • Loading branch information
JayaShakthi97 committed Mar 26, 2024
2 parents d0a3de4 + 45a4edc commit 2c19474
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ import {
} from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { EmptyPlaceholder, ListLayout, PrimaryButton } from "@wso2is/react-components";
import { UsersConstants } from "../../../../../extensions/components/users/constants/users";
import { UserStoreDropdownItem } from "../../../../userstores/models";
import React, { ReactElement, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { Dispatch } from "redux";
import { Dropdown, DropdownItemProps, DropdownProps, Icon, PaginationProps } from "semantic-ui-react";
import AdministratorsTable from "./administrators-table";
import { UsersConstants } from "../../../../../extensions/components/users/constants/users";
import { AccessControlConstants } from "../../../../access-control/constants/access-control";
import {
AdvancedSearchWithBasicFilters,
Expand All @@ -44,6 +43,7 @@ import {
} from "../../../../core";
import { useGetCurrentOrganizationType } from "../../../../organizations/hooks/use-get-organization-type";
import { PRIMARY_USERSTORE } from "../../../../userstores/constants";
import { UserStoreDropdownItem } from "../../../../userstores/models";
import useAdministrators from "../../../hooks/use-administrators";
import useBulkAssignAdministratorRoles from "../../../hooks/use-bulk-assign-user-roles";
import AddExistingUserWizard from "../add-existing-user-wizard/add-existing-user-wizard";
Expand Down Expand Up @@ -212,13 +212,13 @@ const AdministratorsList: React.FunctionComponent<AdministratorsListProps> = (
{
"data-componentid": `${ componentId }-add-existing-user-dropdown-item`,
key: 1,
text: t("console:consoleSettings.administrators.add.options.addExistingUser"),
text: t("consoleSettings:administrators.add.options.addExistingUser"),
value: AddAdministratorModes.AddExisting
},
{
"data-componentid": `${ componentId }-invite-new-user-dropdown-item`,
key: 2,
text: t("console:consoleSettings.administrators.add.options.inviteNewUser"),
text: t("consoleSettings:administrators.add.options.inviteNewUser"),
value: AddAdministratorModes.InviteNew
}
];
Expand All @@ -238,7 +238,7 @@ const AdministratorsList: React.FunctionComponent<AdministratorsListProps> = (
className="add-administrator-dropdown-trigger"
>
<Icon data-componentid={ `${componentId}-add-button-icon` } name="add" />
{ t("console:consoleSettings.administrators.add.action") }
{ t("consoleSettings:administrators.add.action") }
<Icon name="dropdown" className="add-administrator-dropdown-chevron"/>
</PrimaryButton>
) }
Expand Down Expand Up @@ -268,7 +268,7 @@ const AdministratorsList: React.FunctionComponent<AdministratorsListProps> = (
onClick={ () => setShowAddExistingUserWizard(true) }
>
<Icon data-componentid={ `${componentId}-add-button-icon` } name="add" />
{ t("console:consoleSettings.administrators.add.action") }
{ t("consoleSettings:administrators.add.action") }
</PrimaryButton>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent<CreateConsoleRol
} }
/>
<Typography className="permissions-accordion-label">
{ t("console:consoleSettings.roles.add.tenantPermissions.label") }
{ t("consoleSettings:roles.add.tenantPermissions.label") }
</Typography>
<Typography variant="body2">
{ filteredTenantAPIResourceCollections?.apiResourceCollections?.length } Permissions
Expand Down Expand Up @@ -462,10 +462,10 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent<CreateConsoleRol
size="small"
>
<ToggleButton value="read" aria-label="left aligned">
{ t("console:consoleSettings.roles.permissionLevels.view") }
{ t("consoleSettings:roles.permissionLevels.view") }
</ToggleButton>
<ToggleButton value="write" aria-label="right aligned">
{ t("console:consoleSettings.roles.permissionLevels.edit") }
{ t("consoleSettings:roles.permissionLevels.edit") }
</ToggleButton>
</ToggleButtonGroup>
</TableCell>
Expand Down Expand Up @@ -506,7 +506,7 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent<CreateConsoleRol
} }
/>
<Typography className="permissions-accordion-label">
{ t("console:consoleSettings.roles.add.organizationPermissions.label") }
{ t("consoleSettings:roles.add.organizationPermissions.label") }
</Typography>
<Typography variant="body2">
{ filteredOrganizationAPIResourceCollections?.apiResourceCollections?.length } Permissions
Expand Down Expand Up @@ -575,10 +575,10 @@ const CreateConsoleRoleWizardPermissionsForm: FunctionComponent<CreateConsoleRol
size="small"
>
<ToggleButton value="read" aria-label="left aligned">
{ t("console:consoleSettings.roles.permissionLevels.view") }
{ t("consoleSettings:roles.permissionLevels.view") }
</ToggleButton>
<ToggleButton value="write" aria-label="right aligned">
{ t("console:consoleSettings.roles.permissionLevels.edit") }
{ t("consoleSettings:roles.permissionLevels.edit") }
</ToggleButton>
</ToggleButtonGroup>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const ConsoleSettingsTabs: FunctionComponent<ConsoleSettingsTabsInterface> = (
"data-componentid": `${componentId}-tab-administrators`,
"data-tabid": ConsoleSettingsModes.ADMINISTRATORS,
id: ConsoleSettingsModes.ADMINISTRATORS,
label: t("console:consoleSettings.administrators.tabLabel"),
label: t("consoleSettings:administrators.tabLabel"),
pane: <ConsoleAdministrators />,
value: ConsoleSettingsTabIDs.ADMINISTRATORS
},
Expand All @@ -97,7 +97,7 @@ const ConsoleSettingsTabs: FunctionComponent<ConsoleSettingsTabsInterface> = (
"data-componentid": `${componentId}-tab-roles`,
"data-tabid": ConsoleSettingsModes.ROLES,
id: ConsoleSettingsModes.ROLES,
label: t("console:consoleSettings.roles.tabLabel"),
label: t("consoleSettings:roles.tabLabel"),
pane: <ConsoleRolesList />,
value: ConsoleSettingsTabIDs.ROLES
},
Expand All @@ -106,7 +106,7 @@ const ConsoleSettingsTabs: FunctionComponent<ConsoleSettingsTabsInterface> = (
"data-componentid": `${componentId}-tab-login-flow`,
"data-tabid": ConsoleSettingsModes.LOGIN_FLOW,
id: ConsoleSettingsModes.LOGIN_FLOW,
label: t("console:consoleSettings.loginFlow.tabLabel"),
label: t("consoleSettings:loginFlow.tabLabel"),
pane: <ConsoleLoginFlow />,
value: ConsoleSettingsTabIDs.LOGIN_FLOW
},
Expand All @@ -116,7 +116,7 @@ const ConsoleSettingsTabs: FunctionComponent<ConsoleSettingsTabsInterface> = (
"data-tabid": ConsoleSettingsModes.PROTOCOL,
hidden: true,
id: ConsoleSettingsModes.PROTOCOL,
label: t("console:consoleSettings.protocol.tabLabel"),
label: t("consoleSettings:protocol.tabLabel"),
pane: <ConsoleProtocol />,
value: ConsoleSettingsTabIDs.PROTOCOL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ const ConsoleAdministratorsEditPage: FunctionComponent<ConsoleAdministratorsEdit
backButton={ {
"data-testid": "user-mgt-edit-user-back-button",
onClick: handleBackButtonClick,
text: t("console:consoleSettings.administrators.edit.backButton")
text: t("consoleSettings:administrators.edit.backButton")
} }
titleTextAlign="left"
bottomMargin={ false }
Expand Down
1 change: 1 addition & 0 deletions apps/console/src/features/core/configs/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export class Config {
I18nConstants.COMMON_NAMESPACE,
I18nConstants.CONSOLE_PORTAL_NAMESPACE,
I18nConstants.EXTENSIONS_NAMESPACE,
I18nConstants.CONSOLE_SETTINGS_NAMESPACE,
I18nConstants.SECRETS_NAMESPACE,
I18nConstants.BRANDING_NAMESPACE,
I18nConstants.EMAIL_TEMPLATES_NAMESPACE,
Expand Down
6 changes: 6 additions & 0 deletions apps/console/src/features/core/constants/i18n-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export class I18nConstants {
*/
public static readonly EXTENSIONS_NAMESPACE: string = I18nModuleConstants.EXTENSIONS_NAMESPACE;

/**
* console settings namespace.
*/
public static readonly CONSOLE_SETTINGS_NAMESPACE: string = I18nModuleConstants.CONSOLE_SETTINGS_NAMESPACE;

/**
* Secrets namespace.
*/
Expand Down Expand Up @@ -78,6 +83,7 @@ export class I18nConstants {
[ I18nConstants.COMMON_NAMESPACE, "portals" ],
[ I18nConstants.CONSOLE_PORTAL_NAMESPACE, "portals" ],
[ I18nConstants.EXTENSIONS_NAMESPACE, "portals" ],
[ I18nConstants.CONSOLE_SETTINGS_NAMESPACE, "portals" ],
[ I18nConstants.SECRETS_NAMESPACE, "portals" ],
[ I18nConstants.BRANDING_NAMESPACE, "portals" ],
[ I18nConstants.EMAIL_TEMPLATES_NAMESPACE, "portals" ],
Expand Down
6 changes: 6 additions & 0 deletions modules/i18n/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export class I18nModuleConstants {
*/
public static readonly META_FILENAME: string = "meta.json";

/**
* Console settings namespace.
* @constant
*/
public static readonly CONSOLE_SETTINGS_NAMESPACE: string = "consoleSettings";

/**
* Secrets namespace.
* @constant
Expand Down
36 changes: 0 additions & 36 deletions modules/i18n/src/models/namespaces/console-ns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,42 +475,6 @@ export interface ConsoleNS {
};
};
};
consoleSettings: {
administrators: {
add: {
action: string;
options: {
addExistingUser: string;
inviteNewUser: string;
};
};
edit: {
backButton: string;
};
tabLabel: string;
};
loginFlow: {
tabLabel: string;
};
protocol: {
tabLabel: string;
};
roles: {
add: {
organizationPermissions: {
label: string;
};
tenantPermissions: {
label: string;
};
};
tabLabel: string;
permissionLevels: {
edit: string;
view: string;
};
};
};
featureGate: {
enabledFeatures: {
tags: {
Expand Down
53 changes: 53 additions & 0 deletions modules/i18n/src/models/namespaces/console-settings-ns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright (c) 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
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export interface ConsoleSettingsNS {
administrators: {
add: {
action: string;
options: {
addExistingUser: string;
inviteNewUser: string;
};
};
edit: {
backButton: string;
};
tabLabel: string;
};
loginFlow: {
tabLabel: string;
};
protocol: {
tabLabel: string;
};
roles: {
add: {
organizationPermissions: {
label: string;
};
tenantPermissions: {
label: string;
};
};
tabLabel: string;
permissionLevels: {
edit: string;
view: string;
};
};
}
1 change: 1 addition & 0 deletions modules/i18n/src/models/namespaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
export * from "./common-ns";
export * from "./console-ns";
export * from "./myaccount-ns";
export * from "./console-settings-ns";
export * from "./secrets-ns";
export * from "./branding-ns";
export * from "./email-templates-ns";
Expand Down
1 change: 1 addition & 0 deletions modules/i18n/src/translations/en-US/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const meta: LocaleMeta = {
I18nModuleConstants.CONSOLE_PORTAL_NAMESPACE,
I18nModuleConstants.MY_ACCOUNT_NAMESPACE,
I18nModuleConstants.EXTENSIONS_NAMESPACE,
I18nModuleConstants.CONSOLE_SETTINGS_NAMESPACE,
I18nModuleConstants.SECRETS_NAMESPACE,
I18nModuleConstants.BRANDING_NAMESPACE,
I18nModuleConstants.EMAIL_TEMPLATES_NAMESPACE,
Expand Down
61 changes: 61 additions & 0 deletions modules/i18n/src/translations/en-US/portals/console-settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright (c) 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
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { ConsoleSettingsNS } from "../../../models";

/**
* NOTES: No need to care about the max-len for this file since it's easier to
* translate the strings to other languages easily with editor translation tools.
*/
/* eslint-disable max-len */
/* eslint-disable sort-keys */
export const consoleSettings: ConsoleSettingsNS = {
administrators: {
add: {
action: "Add Administrator",
options: {
addExistingUser: "Add Existing User",
inviteNewUser: "Invite New User"
}
},
edit: {
backButton: "Go back to Administrators"
},
tabLabel: "Administrators"
},
loginFlow: {
tabLabel: "Login Flow"
},
protocol: {
tabLabel: "Protocol"
},
roles: {
add: {
organizationPermissions: {
label: "Organization Permissions"
},
tenantPermissions: {
label: "Root Organization Permissions"
}
},
tabLabel: "Roles",
permissionLevels: {
edit: "Edit",
view: "View"
}
}
};
Loading

0 comments on commit 2c19474

Please sign in to comment.