diff --git a/.changeset/blue-tigers-live.md b/.changeset/blue-tigers-live.md new file mode 100644 index 00000000000..8b9519a4fbd --- /dev/null +++ b/.changeset/blue-tigers-live.md @@ -0,0 +1,7 @@ +--- +"@wso2is/admin.api-resources.v2": patch +"@wso2is/admin.core.v1": patch +"@wso2is/console": patch +--- + +Add API Resource View capability in sub orgs diff --git a/apps/console/src/extensions/i18n/models/extensions.ts b/apps/console/src/extensions/i18n/models/extensions.ts index 6a9e303f7e8..f27ca50995b 100755 --- a/apps/console/src/extensions/i18n/models/extensions.ts +++ b/apps/console/src/extensions/i18n/models/extensions.ts @@ -327,6 +327,7 @@ export interface Extensions { apiResource: { pageHeader: { description: string; + subOrgDescription: string; title: string; }; empty: string; diff --git a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts index 8883120e4a2..9f941956130 100755 --- a/apps/console/src/extensions/i18n/resources/en-US/extensions.ts +++ b/apps/console/src/extensions/i18n/resources/en-US/extensions.ts @@ -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 that define scopes and permissions for your applications.", title: "API Resources" }, empty: "There are no API resources available at the moment.", diff --git a/features/admin.api-resources.v2/package.json b/features/admin.api-resources.v2/package.json index df8b79cf0a5..1235b5e256c 100644 --- a/features/admin.api-resources.v2/package.json +++ b/features/admin.api-resources.v2/package.json @@ -22,6 +22,7 @@ "@wso2is/forms": "^2.3.6", "@wso2is/react-components": "^2.8.11", "@wso2is/admin.core.v1": "^2.35.1", + "@wso2is/admin.organizations.v1": "^2.26.62", "axios": "^0.19.2", "i18next": "^21.9.1", "node-forge": "^0.10.0", diff --git a/features/admin.api-resources.v2/pages/api-resources.tsx b/features/admin.api-resources.v2/pages/api-resources.tsx index d3b00eaa024..087cb87a270 100644 --- a/features/admin.api-resources.v2/pages/api-resources.tsx +++ b/features/admin.api-resources.v2/pages/api-resources.tsx @@ -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"; @@ -88,6 +90,7 @@ const APIResourcesPage: FunctionComponent = ( 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, @@ -252,7 +255,7 @@ const APIResourcesPage: FunctionComponent = ( } 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") } = ( { t("extensions:common.learnMore") } + ) : ( + <> + { t("extensions:develop.apiResource.pageHeader.subOrgDescription") } + + { t("extensions:common.learnMore") } + + ) } data-componentid={ `${ componentId }-page-layout` } data-testid={ `${ componentId }-page-layout` } headingColumnWidth="11" actionColumnWidth="5" > - { - history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY") - .replace(":categoryId", APIResourceType.MANAGEMENT)); - } } - className="clickable" - data-componentid={ `${ componentId }-management-api-container` } - > - - - - - } - spaced="right" - floated="left" - className="mt-1" - /> - - { t("extensions:develop.apiResource.managementAPI.header") } - - - { t("extensions:develop.apiResource.managementAPI.description") } - - - - } - spaced="right" - floated="right" - /> - - - - - + { + organizationType !== OrganizationType.SUBORGANIZATION && + ( + { + history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY") + .replace(":categoryId", APIResourceType.MANAGEMENT)); + } } + className="clickable" + data-componentid={ `${ componentId }-management-api-container` } + > + + + + + } + spaced="right" + floated="left" + className="mt-1" + /> + + { t("extensions:develop.apiResource.managementAPI.header") } + + + { t("extensions:develop.apiResource.managementAPI.description") } + + + + } + spaced="right" + floated="right" + /> + + + + + + ) + } { history.push(APIResourcesConstants.getPaths().get("API_RESOURCES_CATEGORY") diff --git a/features/admin.core.v1/constants/app-constants.ts b/features/admin.core.v1/constants/app-constants.ts index 12ae455576f..5d2eb4afff2 100644 --- a/features/admin.core.v1/constants/app-constants.ts +++ b/features/admin.core.v1/constants/app-constants.ts @@ -481,7 +481,8 @@ export class AppConstants { "smsTemplates", "governanceConnectors", "branding", - "consoleSettings" + "consoleSettings", + "apiResources" ]; /** diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb841307738..1529c1e2138 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2265,6 +2265,9 @@ importers: '@wso2is/admin.core.v1': specifier: ^2.35.1 version: link:../admin.core.v1 + '@wso2is/admin.organizations.v1': + specifier: ^2.26.62 + version: link:../admin.organizations.v1 '@wso2is/core': specifier: ^2.5.2 version: link:../../modules/core