Skip to content

Improve user assignment UI in roles edit page #7993

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

Merged
merged 17 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 8 additions & 0 deletions .changeset/mean-paws-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@wso2is/admin.groups.v1": patch
"@wso2is/react-components": patch
"@wso2is/admin.roles.v2": patch
"@wso2is/i18n": patch
---

Improve user assignment UI in roles edit page
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { history } from "@wso2is/admin.core.v1/helpers/history";
import { AppState } from "@wso2is/admin.core.v1/store";
import { EventPublisher } from "@wso2is/admin.core.v1/utils/event-publisher";
import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs";
import { updateRole } from "@wso2is/admin.roles.v2/api";
import { updateRoleDetails } from "@wso2is/admin.roles.v2/api";
import useGetRolesList from "@wso2is/admin.roles.v2/api/use-get-roles-list";
import { RoleConstants } from "@wso2is/admin.roles.v2/constants";
import {
Expand Down Expand Up @@ -322,7 +322,7 @@ export const CreateGroupWizard: FunctionComponent<CreateGroupProps> =

if (rolesList?.length > 0) {
Promise.all(rolesList.map((roleId: string) => {
return updateRole(roleId, roleData);
return updateRoleDetails(roleId, roleData);
})).then(() => {
dispatch(
addAlert({
Expand Down
30 changes: 2 additions & 28 deletions features/admin.roles.v2/api/roles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2020-2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2020-2025, 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 @@ -395,31 +395,6 @@ export const getAPIResourceDetails = (apiResourceId: string): Promise<APIResourc
});
};

/**
* Update Data of the matched ID or the role
*
* @param roleId - role id to update role details
* @param roleData - Data that needs to be updated.
*/
export const updateRole = (roleId: string, roleData: PatchRoleDataInterface): Promise<any> => {
const requestConfig: RequestConfigInterface = {
data: roleData,
headers: {
"Access-Control-Allow-Origin": store.getState().config.deployment.clientHost,
"Content-Type": "application/json"
},
method: HttpMethods.PATCH,
url: store.getState().config.endpoints.rolesV2 + "/" + roleId
};

return httpClient(requestConfig)
.then((response: AxiosResponse) => {
return Promise.resolve(response);
}).catch((error: AxiosError) => {
return Promise.reject(error);
});
};

/**
* Update roles for given role IDs.
*
Expand All @@ -430,7 +405,7 @@ export const updateRole = (roleId: string, roleData: PatchRoleDataInterface): Pr
export const updateRolesBulk = (roleIds: string[], roleData: PatchRoleDataInterface): Promise<any[]> => {
// send the request for each ID and return the response.
return Promise.all(roleIds.map((roleId: string) => {
return updateRole(roleId, roleData);
return updateRoleDetails(roleId, roleData);
}));
};

Expand Down Expand Up @@ -590,4 +565,3 @@ export const useGetAuthorizedAPIList = <Data = AuthorizedAPIListItemInterface[],
mutate
};
};

Loading
Loading