From d069736dace57223d480df9638c933930b81eab8 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Sat, 28 Dec 2024 00:52:46 +0530 Subject: [PATCH 1/4] Fix some circular dependencies --- .../models/application.ts | 2 +- features/admin.core.v1/configs/app.ts | 2 +- features/admin.core.v1/models/config.ts | 2 +- features/admin.groups.v1/api/groups.ts | 2 +- .../edit-group/add-group-user-modal.tsx | 2 +- .../edit-group/edit-group-basic.tsx | 2 +- .../edit-group/edit-group-roles.tsx | 2 +- .../edit-group/edit-group-users.tsx | 2 +- .../components/edit-group/edit-group.tsx | 2 +- .../admin.groups.v1/components/group-list.tsx | 2 +- .../components/wizard/create-group-wizard.tsx | 4 ++-- .../components/wizard/group-assign-users.tsx | 2 +- .../components/wizard/group-basics.tsx | 3 ++- features/admin.groups.v1/configs/endpoints.ts | 8 +++---- features/admin.groups.v1/index.ts | 22 ------------------- features/admin.groups.v1/models/groups.ts | 2 +- features/admin.groups.v1/models/index.ts | 20 ----------------- features/admin.groups.v1/pages/group-edit.tsx | 2 +- features/admin.groups.v1/pages/groups.tsx | 2 +- features/admin.roles.v2/api/roles.ts | 4 ++-- .../components/edit-role/edit-role-groups.tsx | 2 +- .../edit-role/edit-role-permission.tsx | 2 +- .../admin.roles.v2/components/role-utils.ts | 12 +++++----- .../components/wizard-updated/role-basics.tsx | 2 +- .../components/wizard/role-permission.tsx | 2 +- features/admin.roles.v2/configs/endpoints.ts | 2 +- features/admin.roles.v2/models/index.ts | 21 ------------------ features/admin.roles.v2/models/roles.ts | 2 +- .../pages/create-role-wizard.tsx | 4 ++-- .../utils/role-management-utils.ts | 3 ++- features/admin.users.v1/api/users.ts | 4 ++-- .../components/guests/models/invite.ts | 2 +- .../guests/pages/invite-parent-org-user.tsx | 3 ++- .../components/user-groups-edit.tsx | 2 +- .../wizard/add-consumer-user-wizard.tsx | 8 ++++--- .../components/wizard/add-user-wizard.tsx | 2 +- .../wizard/bulk-import-user-wizard.tsx | 4 ++-- features/admin.users.v1/models/endpoints.ts | 2 +- features/admin.users.v1/models/user.ts | 2 +- .../components/password-expiry-rule-list.tsx | 2 +- modules/forms/src/components/index.ts | 1 + 41 files changed, 58 insertions(+), 115 deletions(-) delete mode 100644 features/admin.groups.v1/index.ts delete mode 100644 features/admin.groups.v1/models/index.ts delete mode 100644 features/admin.roles.v2/models/index.ts diff --git a/features/admin.applications.v1/models/application.ts b/features/admin.applications.v1/models/application.ts index c97efb32c65..23e56340111 100644 --- a/features/admin.applications.v1/models/application.ts +++ b/features/admin.applications.v1/models/application.ts @@ -18,7 +18,7 @@ import { FeatureStatusLabel } from "@wso2is/admin.feature-gate.v1/models/feature-status"; import { GenericAuthenticatorInterface } from "@wso2is/admin.identity-providers.v1/models/identity-provider"; -import { AssociatedRolesInterface } from "@wso2is/admin.roles.v2/models"; +import { AssociatedRolesInterface } from "@wso2is/admin.roles.v2/models/roles"; import { LinkInterface } from "@wso2is/core/models"; import { OIDCDataInterface, diff --git a/features/admin.core.v1/configs/app.ts b/features/admin.core.v1/configs/app.ts index 7b0c9472599..13b0d61e43e 100644 --- a/features/admin.core.v1/configs/app.ts +++ b/features/admin.core.v1/configs/app.ts @@ -28,7 +28,7 @@ import { getConnectionResourceEndpoints } from "@wso2is/admin.connections.v1"; import { getEmailTemplatesResourceEndpoints } from "@wso2is/admin.email-templates.v1"; import { getExtendedFeatureResourceEndpoints } from "@wso2is/admin.extensions.v1/configs/endpoints"; import { getFeatureGateResourceEndpoints } from "@wso2is/admin.feature-gate.v1/configs/endpoints"; -import { getGroupsResourceEndpoints } from "@wso2is/admin.groups.v1"; +import { getGroupsResourceEndpoints } from "@wso2is/admin.groups.v1/configs/endpoints"; import { getIDVPResourceEndpoints } from "@wso2is/admin.identity-verification-providers.v1/configs/endpoints"; import { getScopesResourceEndpoints } from "@wso2is/admin.oidc-scopes.v1"; import { getInsightsResourceEndpoints } from "@wso2is/admin.org-insights.v1/config/org-insights"; diff --git a/features/admin.core.v1/models/config.ts b/features/admin.core.v1/models/config.ts index 8e9fb97e390..960a81c38cd 100644 --- a/features/admin.core.v1/models/config.ts +++ b/features/admin.core.v1/models/config.ts @@ -27,7 +27,7 @@ import { BrandingPreferenceResourceEndpointsInterface } from "@wso2is/admin.bran import { CertificatesResourceEndpointsInterface } from "@wso2is/admin.certificates.v1"; import { ClaimResourceEndpointsInterface } from "@wso2is/admin.claims.v1/models/endpoints"; import { ConnectionResourceEndpointsInterface } from "@wso2is/admin.connections.v1"; -import { GroupsResourceEndpointsInterface } from "@wso2is/admin.groups.v1"; +import { GroupsResourceEndpointsInterface } from "@wso2is/admin.groups.v1/models/endpoints"; import { ScopesResourceEndpointsInterface } from "@wso2is/admin.oidc-scopes.v1"; import { OrganizationResourceEndpointsInterface } from "@wso2is/admin.organizations.v1/models"; import { RolesResourceEndpointsInterface } from "@wso2is/admin.roles.v2/models/endpoints"; diff --git a/features/admin.groups.v1/api/groups.ts b/features/admin.groups.v1/api/groups.ts index d14c82da62c..d52ff7262fe 100644 --- a/features/admin.groups.v1/api/groups.ts +++ b/features/admin.groups.v1/api/groups.ts @@ -31,7 +31,7 @@ import { GroupsInterface, PatchGroupDataInterface, SearchGroupInterface -} from "../models"; +} from "../models/groups"; /** * Initialize an axios Http client. diff --git a/features/admin.groups.v1/components/edit-group/add-group-user-modal.tsx b/features/admin.groups.v1/components/edit-group/add-group-user-modal.tsx index 2440551fcf0..5e23edf58ee 100644 --- a/features/admin.groups.v1/components/edit-group/add-group-user-modal.tsx +++ b/features/admin.groups.v1/components/edit-group/add-group-user-modal.tsx @@ -39,7 +39,7 @@ import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; import { Dispatch } from "redux"; import { Grid, Modal } from "semantic-ui-react"; -import { GroupsInterface } from "../../models"; +import { GroupsInterface } from "../../models/groups"; /** * Proptypes for the group users list component. diff --git a/features/admin.groups.v1/components/edit-group/edit-group-basic.tsx b/features/admin.groups.v1/components/edit-group/edit-group-basic.tsx index ef0bfea69b1..54b538b85c0 100644 --- a/features/admin.groups.v1/components/edit-group/edit-group-basic.tsx +++ b/features/admin.groups.v1/components/edit-group/edit-group-basic.tsx @@ -39,7 +39,7 @@ import { useDispatch } from "react-redux"; import { Dispatch } from "redux"; import { Button, Divider, Form, Grid } from "semantic-ui-react"; import { deleteGroupById, searchGroupList, updateGroupDetails } from "../../api"; -import { GroupsInterface, PatchGroupDataInterface, SearchGroupInterface } from "../../models"; +import { GroupsInterface, PatchGroupDataInterface, SearchGroupInterface } from "../../models/groups"; /** * Interface to contain props needed for component diff --git a/features/admin.groups.v1/components/edit-group/edit-group-roles.tsx b/features/admin.groups.v1/components/edit-group/edit-group-roles.tsx index c8979502fd6..f30607e1e68 100644 --- a/features/admin.groups.v1/components/edit-group/edit-group-roles.tsx +++ b/features/admin.groups.v1/components/edit-group/edit-group-roles.tsx @@ -28,7 +28,7 @@ import React, { } from "react"; import { useTranslation } from "react-i18next"; import { Divider } from "semantic-ui-react"; -import { GroupsInterface } from "../../models"; +import { GroupsInterface } from "../../models/groups"; import "./edit-group-roles.scss"; interface EditGroupRolesPropsInterface extends IdentifiableComponentInterface { diff --git a/features/admin.groups.v1/components/edit-group/edit-group-users.tsx b/features/admin.groups.v1/components/edit-group/edit-group-users.tsx index a332813278c..411e740a9d3 100644 --- a/features/admin.groups.v1/components/edit-group/edit-group-users.tsx +++ b/features/admin.groups.v1/components/edit-group/edit-group-users.tsx @@ -52,7 +52,7 @@ import { Dispatch } from "redux"; import { Divider, DropdownProps, Header, Icon, PaginationProps, SemanticICONS } from "semantic-ui-react"; import { AddGroupUserModal } from "./add-group-user-modal"; import { updateGroupDetails } from "../../api"; -import { CreateGroupMemberInterface, GroupsInterface, PatchGroupDataInterface } from "../../models"; +import { CreateGroupMemberInterface, GroupsInterface, PatchGroupDataInterface } from "../../models/groups"; import "./edit-group-users.scss"; /** diff --git a/features/admin.groups.v1/components/edit-group/edit-group.tsx b/features/admin.groups.v1/components/edit-group/edit-group.tsx index 37a98c18bb4..0f43aa04468 100644 --- a/features/admin.groups.v1/components/edit-group/edit-group.tsx +++ b/features/admin.groups.v1/components/edit-group/edit-group.tsx @@ -30,7 +30,7 @@ import { EditGroupRoles } from "./edit-group-roles"; import { GroupUsersList } from "./edit-group-users"; import { GroupConstants } from "../../constants"; import useGroupManagement from "../../hooks/use-group-management"; -import { GroupsInterface } from "../../models"; +import { GroupsInterface } from "../../models/groups"; /** * Captures props needed for edit group component diff --git a/features/admin.groups.v1/components/group-list.tsx b/features/admin.groups.v1/components/group-list.tsx index 63adefb74cb..66b1418b4be 100644 --- a/features/admin.groups.v1/components/group-list.tsx +++ b/features/admin.groups.v1/components/group-list.tsx @@ -47,7 +47,7 @@ import { useTranslation } from "react-i18next"; import { useSelector } from "react-redux"; import { Header, Icon, Label, SemanticICONS } from "semantic-ui-react"; import { GroupConstants } from "../constants"; -import { GroupsInterface } from "../models"; +import { GroupsInterface } from "../models/groups"; interface GroupListProps extends SBACInterface, LoadableComponentInterface, TestableComponentInterface { diff --git a/features/admin.groups.v1/components/wizard/create-group-wizard.tsx b/features/admin.groups.v1/components/wizard/create-group-wizard.tsx index b8fad350c58..83ceb906bfc 100644 --- a/features/admin.groups.v1/components/wizard/create-group-wizard.tsx +++ b/features/admin.groups.v1/components/wizard/create-group-wizard.tsx @@ -28,7 +28,7 @@ import { BasicRoleInterface, PatchRoleDataInterface, RolesV2Interface -} from "@wso2is/admin.roles.v2/models"; +} from "@wso2is/admin.roles.v2/models/roles"; import { UserBasicInterface } from "@wso2is/admin.users.v1/models"; import { CONSUMER_USERSTORE, PRIMARY_USERSTORE } from "@wso2is/admin.userstores.v1/constants"; import { isFeatureEnabled } from "@wso2is/core/helpers"; @@ -59,7 +59,7 @@ import { WizardStateInterface, WizardStepInterface, WizardStepsFormTypes -} from "../../models"; +} from "../../models/groups"; /** * Interface which captures create group props. diff --git a/features/admin.groups.v1/components/wizard/group-assign-users.tsx b/features/admin.groups.v1/components/wizard/group-assign-users.tsx index 8717e8d0e2a..2488ec84b08 100644 --- a/features/admin.groups.v1/components/wizard/group-assign-users.tsx +++ b/features/admin.groups.v1/components/wizard/group-assign-users.tsx @@ -47,7 +47,7 @@ import { useDispatch } from "react-redux"; import { Dispatch as ReduxDispatch } from "redux"; import { Header, Segment } from "semantic-ui-react"; import { GroupBasics } from "./group-basics"; -import { GroupsMemberInterface } from "../../models"; +import { GroupsMemberInterface } from "../../models/groups"; /** * Proptypes for the application consents list component. diff --git a/features/admin.groups.v1/components/wizard/group-basics.tsx b/features/admin.groups.v1/components/wizard/group-basics.tsx index 832dc225077..618e83536d2 100644 --- a/features/admin.groups.v1/components/wizard/group-basics.tsx +++ b/features/admin.groups.v1/components/wizard/group-basics.tsx @@ -34,7 +34,8 @@ import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { DropdownItemProps, Grid, GridColumn, GridRow } from "semantic-ui-react"; -import { CreateGroupFormData, SearchGroupInterface, searchGroupList } from "../.."; +import { searchGroupList } from "../../api"; +import { CreateGroupFormData, SearchGroupInterface } from "../../models/groups"; /** * Interface to capture group basics props. diff --git a/features/admin.groups.v1/configs/endpoints.ts b/features/admin.groups.v1/configs/endpoints.ts index 01da9d7f0b7..1a674eb8466 100644 --- a/features/admin.groups.v1/configs/endpoints.ts +++ b/features/admin.groups.v1/configs/endpoints.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020-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 @@ -16,13 +16,13 @@ * under the License. */ -import { GroupsResourceEndpointsInterface } from "../models"; +import { GroupsResourceEndpointsInterface } from "../models/endpoints"; /** * Get the resource endpoints for the Group Management feature. * - * @param {string} serverHost - Server Host. - * @return {GroupsResourceEndpointsInterface} + * @param serverHost - Server Host. + * @returns the resource endpoints */ export const getGroupsResourceEndpoints = (serverHost: string): GroupsResourceEndpointsInterface => { return { diff --git a/features/admin.groups.v1/index.ts b/features/admin.groups.v1/index.ts deleted file mode 100644 index 7186192cfa8..00000000000 --- a/features/admin.groups.v1/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * 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 * from "./pages"; -export * from "./models"; -export * from "./api"; -export * from "./configs"; diff --git a/features/admin.groups.v1/models/groups.ts b/features/admin.groups.v1/models/groups.ts index 35aebe32530..89dbd8a2037 100644 --- a/features/admin.groups.v1/models/groups.ts +++ b/features/admin.groups.v1/models/groups.ts @@ -16,7 +16,7 @@ * under the License. */ -import { BasicRoleInterface } from "@wso2is/admin.roles.v2/models"; +import { BasicRoleInterface } from "@wso2is/admin.roles.v2/models/roles"; import { UserBasicInterface } from "@wso2is/admin.users.v1/models"; import { RolesMemberInterface } from "@wso2is/core/models"; import { GenericIconProps } from "@wso2is/react-components"; diff --git a/features/admin.groups.v1/models/index.ts b/features/admin.groups.v1/models/index.ts deleted file mode 100644 index 336f3bdc954..00000000000 --- a/features/admin.groups.v1/models/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * 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 * from "./groups"; -export * from "./endpoints"; diff --git a/features/admin.groups.v1/pages/group-edit.tsx b/features/admin.groups.v1/pages/group-edit.tsx index 3cd49375b9d..0e17eb9189c 100644 --- a/features/admin.groups.v1/pages/group-edit.tsx +++ b/features/admin.groups.v1/pages/group-edit.tsx @@ -24,7 +24,7 @@ import React, { FunctionComponent, ReactElement, useEffect, useState } from "rea import { useTranslation } from "react-i18next"; import { getGroupById } from "../api"; import { EditGroup } from "../components"; -import { GroupsInterface } from "../models"; +import { GroupsInterface } from "../models/groups"; import GroupManagementProvider from "../providers/group-management-provider"; const GroupEditPage: FunctionComponent = (): ReactElement => { diff --git a/features/admin.groups.v1/pages/groups.tsx b/features/admin.groups.v1/pages/groups.tsx index 19c3aeb7698..89529462b50 100644 --- a/features/admin.groups.v1/pages/groups.tsx +++ b/features/admin.groups.v1/pages/groups.tsx @@ -56,7 +56,7 @@ import { Dropdown, DropdownItemProps, DropdownProps, Icon, PaginationProps } fro import { deleteGroupById, useGroupList } from "../api"; import { GroupList } from "../components"; import { CreateGroupWizard } from "../components/wizard/create-group-wizard"; -import { GroupsInterface, WizardStepsFormTypes } from "../models"; +import { GroupsInterface, WizardStepsFormTypes } from "../models/groups"; const GROUPS_SORTING_OPTIONS: DropdownItemProps[] = [ { diff --git a/features/admin.roles.v2/api/roles.ts b/features/admin.roles.v2/api/roles.ts index 9f151e56271..a87fa8af60a 100644 --- a/features/admin.roles.v2/api/roles.ts +++ b/features/admin.roles.v2/api/roles.ts @@ -28,13 +28,13 @@ import { IdentityAppsApiException } from "@wso2is/core/exceptions"; import { HttpMethods, RoleListInterface, RolesInterface } from "@wso2is/core/models"; import { AxiosError, AxiosResponse } from "axios"; import { RoleAudienceTypes } from "../constants/role-constants"; +import { APIResourceInterface, APIResourceListInterface, AuthorizedAPIListItemInterface } from "../models/apiResources"; import { CreateRoleInterface, PatchRoleDataInterface, RolesV2ResponseInterface, SearchRoleInterface -} from "../models"; -import { APIResourceInterface, APIResourceListInterface, AuthorizedAPIListItemInterface } from "../models/apiResources"; +} from "../models/roles"; /** * Initialize an axios Http client. diff --git a/features/admin.roles.v2/components/edit-role/edit-role-groups.tsx b/features/admin.roles.v2/components/edit-role/edit-role-groups.tsx index d782332d402..f3aa367f3f5 100644 --- a/features/admin.roles.v2/components/edit-role/edit-role-groups.tsx +++ b/features/admin.roles.v2/components/edit-role/edit-role-groups.tsx @@ -24,7 +24,7 @@ import { import { PatchGroupAddOpInterface, PatchGroupRemoveOpInterface -} from "@wso2is/admin.groups.v1"; +} from "@wso2is/admin.groups.v1/models/groups"; import { useIdentityProviderList } from "@wso2is/admin.identity-providers.v1/api/identity-provider"; import { IdentityProviderInterface, StrictIdentityProviderInterface } from "@wso2is/admin.identity-providers.v1/models"; import { AlertLevels, IdentifiableComponentInterface, RoleGroupsInterface } from "@wso2is/core/models"; diff --git a/features/admin.roles.v2/components/edit-role/edit-role-permission.tsx b/features/admin.roles.v2/components/edit-role/edit-role-permission.tsx index 56b187e313e..245dd921c00 100644 --- a/features/admin.roles.v2/components/edit-role/edit-role-permission.tsx +++ b/features/admin.roles.v2/components/edit-role/edit-role-permission.tsx @@ -54,8 +54,8 @@ import { RenderChip } from "./edit-role-common/render-chip"; import { RoleAPIResourcesListItem } from "./edit-role-common/role-api-resources-list-item"; import { getAPIResourceDetailsBulk, updateRoleDetails, useAPIResourceDetails } from "../../api"; import { RoleAudienceTypes } from "../../constants/role-constants"; -import { PatchRoleDataInterface, PermissionUpdateInterface, SelectedPermissionsInterface } from "../../models"; import { APIResourceInterface, AuthorizedAPIListItemInterface, ScopeInterface } from "../../models/apiResources"; +import { PatchRoleDataInterface, PermissionUpdateInterface, SelectedPermissionsInterface } from "../../models/roles"; /** * Interface to capture permission edit props. diff --git a/features/admin.roles.v2/components/role-utils.ts b/features/admin.roles.v2/components/role-utils.ts index aab098e9a90..c19152033ef 100644 --- a/features/admin.roles.v2/components/role-utils.ts +++ b/features/admin.roles.v2/components/role-utils.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2020-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 @@ -16,15 +16,15 @@ * under the License. */ -import { PermissionObject, TreeNode } from "../models"; +import { PermissionObject, TreeNode } from "../models/permission"; /** * A Util method to create an array of permission object with heirarchy. - * + * * @param permissioObject - Permission Object * @param pathComponents - Permission Path Array * @param permissionTreeArray - Permission Tree array for reference - * + * * @returns {TreeNode[]} - Permission array with tree structure */ export const generatePermissionTree = (permissioObject: PermissionObject, pathComponents: string[], @@ -44,8 +44,8 @@ export const generatePermissionTree = (permissioObject: PermissionObject, pathCo permissionTreeArray.push(permissionComponent); } - if (pathComponents.length) { - generatePermissionTree(permissioObject, pathComponents, + if (pathComponents.length) { + generatePermissionTree(permissioObject, pathComponents, permissionComponent.children || (permissionComponent.children = [])); } diff --git a/features/admin.roles.v2/components/wizard-updated/role-basics.tsx b/features/admin.roles.v2/components/wizard-updated/role-basics.tsx index 21c7c666131..446ea7949d6 100644 --- a/features/admin.roles.v2/components/wizard-updated/role-basics.tsx +++ b/features/admin.roles.v2/components/wizard-updated/role-basics.tsx @@ -45,7 +45,7 @@ import { Trans, useTranslation } from "react-i18next"; import { DropdownProps } from "semantic-ui-react"; import useGetRolesList from "../../api/use-get-roles-list"; import { RoleAudienceTypes, RoleConstants } from "../../constants"; -import { CreateRoleFormData } from "../../models"; +import { CreateRoleFormData } from "../../models/roles"; const FORM_ID: string = "add-role-basics-form"; diff --git a/features/admin.roles.v2/components/wizard/role-permission.tsx b/features/admin.roles.v2/components/wizard/role-permission.tsx index 89d292be6d2..9a30bfe73ca 100644 --- a/features/admin.roles.v2/components/wizard/role-permission.tsx +++ b/features/admin.roles.v2/components/wizard/role-permission.tsx @@ -26,7 +26,7 @@ import React, { FunctionComponent, ReactElement, useEffect, useState } from "rea import { useTranslation } from "react-i18next"; import { Button, Divider, Grid } from "semantic-ui-react"; import { RoleConstants } from "../../constants"; -import { TreeNode } from "../../models"; +import { TreeNode } from "../../models/permission"; import { RoleManagementUtils } from "../../utils"; /** diff --git a/features/admin.roles.v2/configs/endpoints.ts b/features/admin.roles.v2/configs/endpoints.ts index db2e03782d0..7f6c1e0b314 100644 --- a/features/admin.roles.v2/configs/endpoints.ts +++ b/features/admin.roles.v2/configs/endpoints.ts @@ -16,7 +16,7 @@ * under the License. */ -import { RolesResourceEndpointsInterface } from "../models"; +import { RolesResourceEndpointsInterface } from "../models/endpoints"; /** * Get the resource endpoints for the Role Management feature. diff --git a/features/admin.roles.v2/models/index.ts b/features/admin.roles.v2/models/index.ts deleted file mode 100644 index 820d1eca5a5..00000000000 --- a/features/admin.roles.v2/models/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * 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 * from "./endpoints"; -export * from "./permission"; -export * from "./roles"; diff --git a/features/admin.roles.v2/models/roles.ts b/features/admin.roles.v2/models/roles.ts index caa25f5aaa8..d6f59b34418 100644 --- a/features/admin.roles.v2/models/roles.ts +++ b/features/admin.roles.v2/models/roles.ts @@ -16,7 +16,7 @@ * under the License. */ -import { CreateGroupMemberInterface } from "@wso2is/admin.groups.v1/models"; +import { CreateGroupMemberInterface } from "@wso2is/admin.groups.v1/models/groups"; import { SchemaAttributeValueInterface } from "@wso2is/admin.users.v1/models"; import { RolesInterface } from "@wso2is/core/models"; import { ScopeInterface } from "./apiResources"; diff --git a/features/admin.roles.v2/pages/create-role-wizard.tsx b/features/admin.roles.v2/pages/create-role-wizard.tsx index d8ebb9dd75e..f27d320a5df 100644 --- a/features/admin.roles.v2/pages/create-role-wizard.tsx +++ b/features/admin.roles.v2/pages/create-role-wizard.tsx @@ -34,6 +34,7 @@ import { createRole } from "../api/roles"; import { RoleBasics } from "../components/wizard-updated/role-basics"; import { RolePermissionsList } from "../components/wizard-updated/role-permissions/role-permissions"; import { RoleAudienceTypes } from "../constants"; +import { ScopeInterface } from "../models/apiResources"; import { CreateRoleFormData, CreateRoleInterface, @@ -41,8 +42,7 @@ import { CreateRoleStateInterface, CreateRoleStepsFormTypes, SelectedPermissionsInterface -} from "../models"; -import { ScopeInterface } from "../models/apiResources"; +} from "../models/roles"; /** * Interface which captures create role props. diff --git a/features/admin.roles.v2/utils/role-management-utils.ts b/features/admin.roles.v2/utils/role-management-utils.ts index 729d612c840..05146ccf03d 100644 --- a/features/admin.roles.v2/utils/role-management-utils.ts +++ b/features/admin.roles.v2/utils/role-management-utils.ts @@ -27,7 +27,8 @@ import { AxiosResponse } from "axios"; import isEmpty from "lodash-es/isEmpty"; import { getPermissionList, searchRoleList } from "../api"; import { generatePermissionTree } from "../components/role-utils"; -import { PermissionObject, SearchRoleInterface, TreeNode } from "../models"; +import { PermissionObject,TreeNode } from "../models/permission"; +import { SearchRoleInterface } from "../models/roles"; /** * Utility class for roles operations. diff --git a/features/admin.users.v1/api/users.ts b/features/admin.users.v1/api/users.ts index d39afb88b86..59db54eeb74 100644 --- a/features/admin.users.v1/api/users.ts +++ b/features/admin.users.v1/api/users.ts @@ -23,8 +23,8 @@ import useRequest, { RequestResultInterface } from "@wso2is/admin.core.v1/hooks/use-request"; import { store } from "@wso2is/admin.core.v1/store"; -import { PatchGroupDataInterface } from "@wso2is/admin.groups.v1"; -import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models"; +import { PatchGroupDataInterface } from "@wso2is/admin.groups.v1/models/groups"; +import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models/roles"; import { IdentityAppsApiException } from "@wso2is/core/exceptions"; import { HttpMethods, ProfileInfoInterface } from "@wso2is/core/models"; import { AxiosError, AxiosResponse } from "axios"; diff --git a/features/admin.users.v1/components/guests/models/invite.ts b/features/admin.users.v1/components/guests/models/invite.ts index 8599101f93b..4b442292388 100644 --- a/features/admin.users.v1/components/guests/models/invite.ts +++ b/features/admin.users.v1/components/guests/models/invite.ts @@ -16,7 +16,7 @@ * under the License. */ -import { GroupsInterface } from "@wso2is/admin.groups.v1"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { ReactNode } from "react"; import { InviteUserStatus } from "../../../models/user"; diff --git a/features/admin.users.v1/components/guests/pages/invite-parent-org-user.tsx b/features/admin.users.v1/components/guests/pages/invite-parent-org-user.tsx index f43d5dfdbb9..acf672082e6 100644 --- a/features/admin.users.v1/components/guests/pages/invite-parent-org-user.tsx +++ b/features/admin.users.v1/components/guests/pages/invite-parent-org-user.tsx @@ -20,7 +20,8 @@ import { AutocompleteRenderGetTagProps } from "@oxygen-ui/react/Autocomplete"; import Chip from "@oxygen-ui/react/Chip"; import Typography from "@oxygen-ui/react/Typography"; import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores"; -import { GroupsInterface, useGroupList } from "@wso2is/admin.groups.v1"; +import { useGroupList } from "@wso2is/admin.groups.v1/api"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { IdentifiableComponentInterface } from "@wso2is/core/models"; import { AutocompleteFieldAdapter, FinalForm, FinalFormField } from "@wso2is/form"; import { Hint, Message } from "@wso2is/react-components"; diff --git a/features/admin.users.v1/components/user-groups-edit.tsx b/features/admin.users.v1/components/user-groups-edit.tsx index b8da29997ea..e871a22723b 100644 --- a/features/admin.users.v1/components/user-groups-edit.tsx +++ b/features/admin.users.v1/components/user-groups-edit.tsx @@ -19,7 +19,7 @@ import { AppState, getEmptyPlaceholderIllustrations, updateResources } from "@wso2is/admin.core.v1"; import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores"; import { useGroupList } from "@wso2is/admin.groups.v1/api"; -import { GroupsInterface, GroupsMemberInterface } from "@wso2is/admin.groups.v1/models"; +import { GroupsInterface, GroupsMemberInterface } from "@wso2is/admin.groups.v1/models/groups"; import { APPLICATION_DOMAIN, INTERNAL_DOMAIN } from "@wso2is/admin.roles.v2/constants"; import { PRIMARY_USERSTORE } from "@wso2is/admin.userstores.v1/constants"; import { diff --git a/features/admin.users.v1/components/wizard/add-consumer-user-wizard.tsx b/features/admin.users.v1/components/wizard/add-consumer-user-wizard.tsx index 0fedfc200b9..e5a63b3a091 100644 --- a/features/admin.users.v1/components/wizard/add-consumer-user-wizard.tsx +++ b/features/admin.users.v1/components/wizard/add-consumer-user-wizard.tsx @@ -20,11 +20,13 @@ import { UserBasicInterface } from "@wso2is/admin.core.v1"; import { SCIMConfigs } from "@wso2is/admin.extensions.v1/configs/scim"; import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores"; import { - GroupsInterface, - PatchGroupDataInterface, getGroupList, updateGroupDetails -} from "@wso2is/admin.groups.v1"; +} from "@wso2is/admin.groups.v1/api/groups"; +import { + GroupsInterface, + PatchGroupDataInterface +} from "@wso2is/admin.groups.v1/models/groups"; import { addUser } from "@wso2is/admin.users.v1/api/users"; import { getUserWizardStepIcons } from "@wso2is/admin.users.v1/configs/ui"; import { diff --git a/features/admin.users.v1/components/wizard/add-user-wizard.tsx b/features/admin.users.v1/components/wizard/add-user-wizard.tsx index d1fb5db4133..2c7122946ec 100644 --- a/features/admin.users.v1/components/wizard/add-user-wizard.tsx +++ b/features/admin.users.v1/components/wizard/add-user-wizard.tsx @@ -22,7 +22,7 @@ import { administratorConfig } from "@wso2is/admin.extensions.v1/configs/adminis import { SCIMConfigs } from "@wso2is/admin.extensions.v1/configs/scim"; import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores"; import { updateGroupDetails, useGroupList } from "@wso2is/admin.groups.v1/api"; -import { GroupsInterface } from "@wso2is/admin.groups.v1/models"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type"; import { getAUserStore, useUserStores } from "@wso2is/admin.userstores.v1/api"; import { UserStoreManagementConstants } from "@wso2is/admin.userstores.v1/constants"; diff --git a/features/admin.users.v1/components/wizard/bulk-import-user-wizard.tsx b/features/admin.users.v1/components/wizard/bulk-import-user-wizard.tsx index c5bb57e0ce3..c8f59b771d9 100644 --- a/features/admin.users.v1/components/wizard/bulk-import-user-wizard.tsx +++ b/features/admin.users.v1/components/wizard/bulk-import-user-wizard.tsx @@ -42,9 +42,9 @@ import { } from "@wso2is/admin.core.v1"; import { userConfig, userstoresConfig } from "@wso2is/admin.extensions.v1/configs"; import { getGroupList, useGroupList } from "@wso2is/admin.groups.v1/api"; -import { GroupsInterface } from "@wso2is/admin.groups.v1/models"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type"; -import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models"; +import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models/roles"; import { getAUserStore, getUserStores } from "@wso2is/admin.userstores.v1/api"; import { PRIMARY_USERSTORE, UserStoreManagementConstants } from "@wso2is/admin.userstores.v1/constants"; import { useValidationConfigData } from "@wso2is/admin.validation.v1/api"; diff --git a/features/admin.users.v1/models/endpoints.ts b/features/admin.users.v1/models/endpoints.ts index af93bc3dd82..5afd1ed4ddb 100644 --- a/features/admin.users.v1/models/endpoints.ts +++ b/features/admin.users.v1/models/endpoints.ts @@ -16,7 +16,7 @@ * under the License. */ -import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models"; +import { PatchRoleDataInterface } from "@wso2is/admin.roles.v2/models/roles"; import { UserDetailsInterface } from "./user"; /** diff --git a/features/admin.users.v1/models/user.ts b/features/admin.users.v1/models/user.ts index 334880dac89..c44f841a014 100644 --- a/features/admin.users.v1/models/user.ts +++ b/features/admin.users.v1/models/user.ts @@ -19,7 +19,7 @@ // Keep statement as this to avoid cyclic dependency. Do not import from config index. import { UserRoleInterface } from "@wso2is/admin.core.v1"; import { SCIMConfigs } from "@wso2is/admin.extensions.v1/configs/scim"; -import { GroupsInterface, GroupsMemberInterface } from "@wso2is/admin.groups.v1"; +import { GroupsInterface, GroupsMemberInterface } from "@wso2is/admin.groups.v1/models/groups"; import { LinkInterface, MultiValueAttributeInterface, NameInterface, RolesInterface } from "@wso2is/core/models"; import React, { ReactElement } from "react"; import { BulkImportResponseOperationTypes, BulkUserImportStatus } from "../constants"; diff --git a/features/admin.validation.v1/components/password-expiry-rule-list.tsx b/features/admin.validation.v1/components/password-expiry-rule-list.tsx index 3fa51525e2c..57b10911a0d 100644 --- a/features/admin.validation.v1/components/password-expiry-rule-list.tsx +++ b/features/admin.validation.v1/components/password-expiry-rule-list.tsx @@ -31,7 +31,7 @@ import Select from "@oxygen-ui/react/Select"; import TextField from "@oxygen-ui/react/TextField"; import { ChevronDownIcon, ChevronUpIcon, PlusIcon, TrashIcon } from "@oxygen-ui/react-icons"; import { userstoresConfig } from "@wso2is/admin.extensions.v1"; -import { GroupsInterface } from "@wso2is/admin.groups.v1"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { RoleAudienceTypes } from "@wso2is/admin.roles.v2/constants"; import { GovernanceConnectorConstants diff --git a/modules/forms/src/components/index.ts b/modules/forms/src/components/index.ts index 51607c6e4e1..3cb5788219b 100644 --- a/modules/forms/src/components/index.ts +++ b/modules/forms/src/components/index.ts @@ -20,5 +20,6 @@ export * from "./field"; export * from "./group-fields"; export * from "./syntactic-sugars"; export * from "./meta-file-picker"; + export { DynamicField, KeyValue } from "./dynamic-field"; From 9f1a60d9ad536c62baabd5caa16faf2f74468a7c Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Sat, 28 Dec 2024 01:02:04 +0530 Subject: [PATCH 2/4] Address eslint warnings --- features/admin.roles.v2/components/role-utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/admin.roles.v2/components/role-utils.ts b/features/admin.roles.v2/components/role-utils.ts index c19152033ef..bc73526bea9 100644 --- a/features/admin.roles.v2/components/role-utils.ts +++ b/features/admin.roles.v2/components/role-utils.ts @@ -25,13 +25,13 @@ import { PermissionObject, TreeNode } from "../models/permission"; * @param pathComponents - Permission Path Array * @param permissionTreeArray - Permission Tree array for reference * - * @returns {TreeNode[]} - Permission array with tree structure + * @returns Permission array with tree structure */ export const generatePermissionTree = (permissioObject: PermissionObject, pathComponents: string[], permissionTreeArray: TreeNode[]): TreeNode[] => { - const component = pathComponents.shift(); - let permissionComponent = permissionTreeArray.find((permission: TreeNode) => { + const component: string = pathComponents.shift(); + let permissionComponent: TreeNode = permissionTreeArray.find((permission: TreeNode) => { return permission.name === component; }); From e7d200f21f5a9d6113dba7959b07a0b96bc8d118 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Sat, 28 Dec 2024 01:03:32 +0530 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=A6=8B=20Add=20changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/bright-rings-look.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changeset/bright-rings-look.md diff --git a/.changeset/bright-rings-look.md b/.changeset/bright-rings-look.md new file mode 100644 index 00000000000..012cb332346 --- /dev/null +++ b/.changeset/bright-rings-look.md @@ -0,0 +1,11 @@ +--- +"@wso2is/admin.applications.v1": patch +"@wso2is/admin.validation.v1": patch +"@wso2is/admin.groups.v1": patch +"@wso2is/admin.roles.v2": patch +"@wso2is/admin.users.v1": patch +"@wso2is/admin.core.v1": patch +"@wso2is/forms": patch +--- + +Fix some circular dependencies From 9776cf28c309132338a701608caab10199e36247 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Thu, 9 Jan 2025 18:44:12 +0530 Subject: [PATCH 4/4] Fix import --- features/admin.core.v1/components/groups/assign-groups.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/admin.core.v1/components/groups/assign-groups.tsx b/features/admin.core.v1/components/groups/assign-groups.tsx index 404d22d443d..262a7317120 100644 --- a/features/admin.core.v1/components/groups/assign-groups.tsx +++ b/features/admin.core.v1/components/groups/assign-groups.tsx @@ -16,7 +16,7 @@ * under the License. */ -import { GroupsInterface } from "@wso2is/admin.groups.v1"; +import { GroupsInterface } from "@wso2is/admin.groups.v1/models/groups"; import { PRIMARY_USERSTORE } from "@wso2is/admin.userstores.v1/constants"; import { RolesInterface } from "@wso2is/core/models"; import { StringUtils } from "@wso2is/core/utils";