Skip to content
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

Enable API Resources UI in sub organization from View only capability #7226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
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 @@ -327,6 +327,7 @@ export interface Extensions {
apiResource: {
pageHeader: {
description: string;
subOrgDescription: string;
title: string;
};
empty: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export const extensions: Extensions = {
apiResource: {
pageHeader: {
description: "Create and manage the APIs used to define the API scopes/permissions that can be consumed by your applications.",
subOrgDescription: "View the APIs used to define the API scopes/permissions that can be consumed by your applications.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT?

Suggested change
subOrgDescription: "View the APIs used to define the API scopes/permissions that can be consumed by your applications.",
subOrgDescription: "View the APIs that define scopes and permissions for your applications.",

title: "API Resources"
},
empty: "There are no API resources available at the moment.",
Expand Down
1 change: 1 addition & 0 deletions features/admin.api-resources.v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@wso2is/forms": "^2.3.5",
"@wso2is/react-components": "^2.8.10",
"@wso2is/admin.core.v1": "^2.34.59",
"@wso2is/admin.organizations.v1": "^2.26.59",
"axios": "^0.19.2",
"i18next": "^21.9.1",
"node-forge": "^0.10.0",
Expand Down
103 changes: 60 additions & 43 deletions features/admin.api-resources.v2/pages/api-resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
getEmptyPlaceholderIllustrations,
history
} from "@wso2is/admin.core.v1";
import { OrganizationType } from "@wso2is/admin.organizations.v1/constants";
import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type";
import { IdentityAppsApiException } from "@wso2is/core/exceptions";
import { AlertInterface, AlertLevels, IdentifiableComponentInterface, LinkInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
Expand Down Expand Up @@ -88,6 +90,7 @@ const APIResourcesPage: FunctionComponent<APIResourcesPageInterface> = (

const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features);
const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);
const { organizationType } = useGetCurrentOrganizationType();

const {
data: apiResourcesListData,
Expand Down Expand Up @@ -252,7 +255,7 @@ const APIResourcesPage: FunctionComponent<APIResourcesPageInterface> = (
}
pageTitle={ t("extensions:develop.apiResource.pageHeader.title") }
title={ t("extensions:develop.apiResource.pageHeader.title") }
description={ (
description={ organizationType !== OrganizationType.SUBORGANIZATION ? (
<>
{ t("extensions:develop.apiResource.pageHeader.description") }
<DocumentationLink
Expand All @@ -261,54 +264,68 @@ const APIResourcesPage: FunctionComponent<APIResourcesPageInterface> = (
{ t("extensions:common.learnMore") }
</DocumentationLink>
</>
) : (
<>
{ t("extensions:develop.apiResource.pageHeader.subOrgDescription") }
<DocumentationLink
link={ getLink("develop.apiResources.learnMore") }
>
{ t("extensions:common.learnMore") }
</DocumentationLink>
</>
) }
data-componentid={ `${ componentId }-page-layout` }
data-testid={ `${ componentId }-page-layout` }
headingColumnWidth="11"
actionColumnWidth="5"
>
<EmphasizedSegment
onClick={ () => {
history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY")
.replace(":categoryId", APIResourceType.MANAGEMENT));
} }
className="clickable"
data-componentid={ `${ componentId }-management-api-container` }
>
<List>
<List.Item>
<Grid container direction="row" xs={ 12 } alignItems="center">
<Grid xs={ 10 } alignContent="center">
<GenericIcon
verticalAlign="middle"
fill="primary"
transparent
icon={ <BuildingGearIcon size="medium" /> }
spaced="right"
floated="left"
className="mt-1"
/>
<List.Header>
{ t("extensions:develop.apiResource.managementAPI.header") }
</List.Header>
<List.Description>
{ t("extensions:develop.apiResource.managementAPI.description") }
</List.Description>
</Grid>
<Grid xs={ 2 }>
<GenericIcon
verticalAlign="middle"
fill="primary"
transparent
icon={ <ChevronRightIcon /> }
spaced="right"
floated="right"
/>
</Grid>
</Grid>
</List.Item>
</List>
</EmphasizedSegment>
{
organizationType !== OrganizationType.SUBORGANIZATION &&
(
<EmphasizedSegment
onClick={ () => {
history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY")
.replace(":categoryId", APIResourceType.MANAGEMENT));
} }
className="clickable"
data-componentid={ `${ componentId }-management-api-container` }
>
<List>
<List.Item>
<Grid container direction="row" xs={ 12 } alignItems="center">
<Grid xs={ 10 } alignContent="center">
<GenericIcon
verticalAlign="middle"
fill="primary"
transparent
icon={ <BuildingGearIcon size="medium" /> }
spaced="right"
floated="left"
className="mt-1"
/>
<List.Header>
{ t("extensions:develop.apiResource.managementAPI.header") }
</List.Header>
<List.Description>
{ t("extensions:develop.apiResource.managementAPI.description") }
</List.Description>
</Grid>
<Grid xs={ 2 }>
<GenericIcon
verticalAlign="middle"
fill="primary"
transparent
icon={ <ChevronRightIcon /> }
spaced="right"
floated="right"
/>
</Grid>
</Grid>
</List.Item>
</List>
</EmphasizedSegment>
)
}
<EmphasizedSegment
onClick={ () => {
history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY")
Expand Down
3 changes: 2 additions & 1 deletion features/admin.core.v1/constants/app-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ export class AppConstants {
"smsTemplates",
"governanceConnectors",
"branding",
"consoleSettings"
"consoleSettings",
"apiResources"
];

/**
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading