Skip to content

Commit

Permalink
Merge pull request #6828 from brionmario/code-cleanup-2024-extensions…
Browse files Browse the repository at this point in the history
…-groups-remove

[🧹 UNIFICATION CLEANUP] Remove `extensions/components/groups` stale folder
  • Loading branch information
brionmario authored Aug 30, 2024
2 parents 5d05973 + 95468f5 commit c9a5619
Show file tree
Hide file tree
Showing 27 changed files with 55 additions and 5,150 deletions.
6 changes: 6 additions & 0 deletions .changeset/wicked-pugs-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/admin.application-roles.v1": minor
"@wso2is/admin.extensions.v1": minor
---

Remove `extensions/components/groups` stale folder
21 changes: 21 additions & 0 deletions features/admin.application-roles.v1/api/application-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";
import {
ApplicationRoleGroupsAPIResponseInterface,
ApplicationRoleGroupsUpdatePayloadInterface,
ApplicationRoleInterface,
ApplicationRolesResponseInterface,
AuthorizedAPIListItemInterface,
CreateRolePayloadInterface,
Expand Down Expand Up @@ -443,3 +444,23 @@ export const useDescendantsOfSubOrg = <Data = DescendantDataInterface[],
mutate: mutate
};
};

/**
* Get all the application roles in the organization.
*
* @returns A promise containing the response.
*/
export const getAllApplicationRolesList = ():Promise<ApplicationRoleInterface[]> => {
const requestConfig: AxiosRequestConfig = {
method: HttpMethods.GET,
url: `${ store.getState().config.endpoints.authzEndpoint }/roles`
};

return httpClient(requestConfig)
.then((response: AxiosResponse) => {
return Promise.resolve(response.data.app_roles as ApplicationRoleInterface[]);
})
.catch((error: AxiosError) => {
return Promise.reject(error);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

import { AppConstants, getEmptyPlaceholderIllustrations, history } from "@wso2is/admin.core.v1";
import { ApplicationRoleInterface } from "@wso2is/admin.extensions.v1/components/groups/models";
import {
IdentifiableComponentInterface,
LoadableComponentInterface
Expand All @@ -33,6 +32,7 @@ import React, { Fragment, ReactElement, useState } from "react";
import { useTranslation } from "react-i18next";
import { Accordion, Grid } from "semantic-ui-react";
import RolesList from "./roles-list";
import { ApplicationRoleInterface } from "../models/application-roles";

interface ApplicationRolesListProps extends LoadableComponentInterface, IdentifiableComponentInterface {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import { history } from "@wso2is/admin.core.v1";
import { AppConstants, UIConstants } from "@wso2is/admin.core.v1/constants";
import { RoleBasicInterface } from "@wso2is/admin.extensions.v1/components/groups/models";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import {
DataTable,
Expand All @@ -30,6 +29,7 @@ import {
import React, { ChangeEvent, ReactElement, ReactNode, SyntheticEvent, useState } from "react";
import { useTranslation } from "react-i18next";
import { Grid, Header, Icon, Input, SemanticICONS } from "semantic-ui-react";
import { RoleBasicInterface } from "../models/application-roles";

interface RolesListProps extends IdentifiableComponentInterface {
rolesList: RoleBasicInterface[];
Expand Down
24 changes: 24 additions & 0 deletions features/admin.application-roles.v1/models/application-roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,27 @@ export interface DescendantDataInterface {
id: string;
name: string;
}

/**
* Interface to store basic role data.
*/
export interface RoleBasicInterface {
name: string;
}

/**
* Interface to store application role data grouped by application.
*/
export interface ApplicationRoleInterface {
app: string;
appName?: string;
roles: RoleBasicInterface[];
}

/**
* Interface for group role assignment payload.
*/
export interface GroupRoleAssignPayloadInterface {
added_roles: ApplicationRoleInterface[];
removed_roles: ApplicationRoleInterface[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import { getApplicationList } from "@wso2is/admin.applications.v1/api";
import { ApplicationListInterface, ApplicationListItemInterface } from "@wso2is/admin.applications.v1/models";
import { AppConstants, UIConstants, getEmptyPlaceholderIllustrations, history } from "@wso2is/admin.core.v1";
import { getAllApplicationRolesList } from "@wso2is/admin.extensions.v1/components/groups/api";
import { ApplicationRoleInterface } from "@wso2is/admin.extensions.v1/components/groups/models";
import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import {
Expand All @@ -36,7 +34,9 @@ import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { Dispatch } from "redux";
import { Icon, Input } from "semantic-ui-react";
import { getAllApplicationRolesList } from "../api/application-roles";
import { ApplicationRolesList } from "../components";
import { ApplicationRoleInterface } from "../models/application-roles";

type ApplicationRolesPageInterface = IdentifiableComponentInterface;

Expand Down

This file was deleted.

19 changes: 0 additions & 19 deletions features/admin.extensions.v1/components/groups/api/index.ts

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions features/admin.extensions.v1/components/groups/data/group.md

This file was deleted.

Loading

0 comments on commit c9a5619

Please sign in to comment.