Skip to content

Add Admin and DevPortal UI for DevPortal Governance templates#1346

Open
ashiduDissanayake wants to merge 3 commits into
wso2:mainfrom
ashiduDissanayake:feature/devportal-governance
Open

Add Admin and DevPortal UI for DevPortal Governance templates#1346
ashiduDissanayake wants to merge 3 commits into
wso2:mainfrom
ashiduDissanayake:feature/devportal-governance

Conversation

@ashiduDissanayake

Copy link
Copy Markdown
Contributor

Walkthrough Video

Feature walkthrough: Video

The walkthrough covers the complete flow across all three repositories:
Admin ruleset/template creation, server-backed form configuration, hidden default
validation, DevPortal template selection, application creation, snapshot-backed
OAuth governance, and product-level runtime behavior.

Summary:
This PR adds the Admin Portal and DevPortal UI for DevPortal Governance. It
allows admins to author templates, configure governed application and Key
Manager fields, bind APPLICATION rulesets, publish templates, and expose those
templates in the DevPortal application creation and OAuth key flows.

Depends on:
carbon-apimgt PR for governance template APIs, scopes, DTO fields, and backend enforcement.

Scope:

  • Adds Admin Portal Governance > Templates.
  • Adds template wizard steps:
    - General Details.
    - Field Configuration.
    - Ruleset Bindings.
    - Developer View.
    - Review & Publish.
  • Adds template metadata editing: name, description, tags, icon, global flag.
  • Adds field configuration for:
    - Application throttling policy.
    - Description.
    - Application groups.
    - Custom application attributes.
    - Per-Key-Manager OAuth fields.
    - Developer-facing summary and limitations.
  • Adds server-backed rendering for application sharing and application attributes.
  • Adds Key Manager-specific governance configuration under formConfig.keyManagers.
  • Adds Admin UI validation for required hidden fields without defaults.
  • Adds ruleset binding UI for APPLICATION rulesets.
  • Adds Key Manager scoping UI for APP_OAUTH bindings.
  • Adds template review/publish screen.
  • Adds template list default toggle and global read-only behavior.
  • Adds DevPortal template gallery, search, tag filtering, pagination, preview, default/global badges, and "No Restrictions" fallback behavior.
  • Adds DevPortal application create behavior for hidden, visible, required, and defaulted template fields.
  • Adds snapshot-aware application details and OAuth key UI filtering from governanceFormConfig.
  • Adds DevPortal API client support and apim:gov_template_read scope usage.

Important behavior:

  • Template fetch failure fails open to normal application creation.
  • "No Restrictions" is shown only when no default template is resolved.
  • Hidden fields are not rendered to developers.
  • Visible defaults are pre-filled and editable.
  • OAuth grant types are an allowed-list, not a hidden/visible field.
  • Existing governed applications use the captured snapshot exposed as governanceFormConfig.

Documentation

devportal-governance-admin-guide.md
devportal-governance-architecture.md
devportal-governance-developer-guide.md
devportal-governance-docs-index.md
devportal-governance-qa-evidence.md
devportal-governance-rest-api-reference.md
devportal-governance-rule-authoring-guide.md
devportal-governance-upgrade-compatibility.md

Copilot AI review requested due to automatic review settings May 10, 2026 21:07
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@ashiduDissanayake has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 3 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: db0945cb-ac23-4c9c-b090-21169452ba81

📥 Commits

Reviewing files that changed from the base of the PR and between bcc9a00 and 5cccd12.

📒 Files selected for processing (33)
  • portals/admin/src/main/webapp/site/public/locales/en.json
  • portals/admin/src/main/webapp/site/public/locales/fr.json
  • portals/admin/src/main/webapp/source/src/app/components/Base/RouteMenuMapping.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/RulesetCatalog/AddEditRuleset.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/DeleteTemplate.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/ListTemplates.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/TemplateWizard.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/index.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/DeveloperViewStep.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/FormBuilderStep.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/GeneralDetailsStep.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/ReviewPublishStep.jsx
  • portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/RulesetBindingsStep.jsx
  • portals/admin/src/main/webapp/source/src/app/data/Constants.js
  • portals/admin/src/main/webapp/source/src/app/data/GovernanceAPI.js
  • portals/devportal/src/main/webapp/services/login/login_callback.jsp
  • portals/devportal/src/main/webapp/site/public/locales/en.json
  • portals/devportal/src/main/webapp/source/src/app/components/Apis/Listing/APICardView.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Apis/Listing/SubscriptionPolicySelect.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/ApplicationFormHandler.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/ApplicationCreateBase.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/TemplatePreviewDialog.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/TemplateSelector.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/templateDeveloperViewUtils.js
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionSection.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionTableData.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/Subscriptions.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/ApplicationCreateForm.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/KeyConfiguration.jsx
  • portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/TokenManager.jsx
  • portals/devportal/src/main/webapp/source/src/app/data/AuthManager.jsx
  • portals/devportal/src/main/webapp/source/src/app/data/api.jsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 Security Hotspots
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces end-to-end UI support (Admin + DevPortal) for “DevPortal Governance Templates”, including template authoring/publishing in the Admin Portal and template selection + governed application/key/subscription behaviors in the DevPortal.

Changes:

  • DevPortal: adds a template gallery/preview flow and applies template-driven restrictions/defaults to application creation, OAuth key generation UI (including KM filtering), and subscription tier controls.
  • Admin Portal: adds a full Templates management area (list, wizard, publish/draft) and wiring to governance template APIs, plus consumer-app ruleset type support.
  • Cross-cutting: adds new scope usage (apim:gov_template_read), governance template API calls, localized strings, and login callback cookie path support for governance endpoints.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
portals/devportal/src/main/webapp/source/src/app/data/AuthManager.jsx Adds apim:gov_template_read to the default DevPortal scope set.
portals/devportal/src/main/webapp/source/src/app/data/api.jsx Adds direct-fetch helpers for listing/fetching governance templates from the governance REST API.
portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/TokenManager.jsx Filters visible Key Managers and passes KM-scoped governance config into key generation UI; adjusts tab sync and button enablement.
portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/KeyConfiguration.jsx Applies template-driven grant type filtering and conditional visibility of KM config fields.
portals/devportal/src/main/webapp/source/src/app/components/Shared/AppsAndKeys/ApplicationCreateForm.jsx Adds template-driven hide/required behavior for app create fields and attributes.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionTableData.jsx Disables subscription tier edits when governed by template and shows governed messaging.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/SubscriptionSection.jsx Plumbs formConfig down into subscription rows.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/Subscriptions.jsx Passes formConfig through subscriptions pages/dialogs and updates propTypes/defaultProps.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Details/index.jsx Loads governanceFormConfig snapshot or resolves template by ID; passes formConfig into TokenManager and Subscriptions.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/TemplateSelector.jsx New DevPortal template gallery (search/tags/pagination/preview) with fail-open behavior.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/TemplatePreviewDialog.jsx New dialog to preview developer-facing summary/limitations and ruleset bindings before selection.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/templateDeveloperViewUtils.js Utilities to derive developer-facing limitations from a template formConfig/rulesets.
portals/devportal/src/main/webapp/source/src/app/components/Applications/Create/ApplicationCreateBase.jsx Layout tweak to support full-width template selection vs narrow create form container.
portals/devportal/src/main/webapp/source/src/app/components/Applications/ApplicationFormHandler.jsx Adds template-selection gating step, applies template defaults into create request, and adds template-required validation/error handling.
portals/devportal/src/main/webapp/source/src/app/components/Apis/Listing/SubscriptionPolicySelect.jsx Applies governed subscription tier selection in the subscribe flow when tier is hidden/forced by template.
portals/devportal/src/main/webapp/source/src/app/components/Apis/Listing/APICardView.jsx Plumbs formConfig to subscription policy selector in API/MCP listings.
portals/devportal/src/main/webapp/site/public/locales/en.json Adds new DevPortal i18n strings for template selection/preview and governed messages.
portals/devportal/src/main/webapp/services/login/login_callback.jsp Adds governance API cookie path for the HTTP-only access token segment.
portals/admin/src/main/webapp/source/src/app/data/GovernanceAPI.js Adds Admin Portal client methods for governance template CRUD + validation.
portals/admin/src/main/webapp/source/src/app/data/Constants.js Adds template scopes and consumer app rule/artifact types for governance.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/TemplateWizard.jsx New multi-step wizard for creating/editing governance templates (draft/publish).
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/RulesetBindingsStep.jsx New dual-pane ruleset binding UI with APP rulesets and KM scoping for APP_OAUTH.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/ReviewPublishStep.jsx New review/publish step with full summary and raw JSON payload preview.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/GeneralDetailsStep.jsx New wizard step for name/description/tags/icon/global flag with icon validation.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/steps/DeveloperViewStep.jsx New wizard step to author developer-facing summary/limitations with live preview.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/ListTemplates.jsx New templates list screen with default toggle + global read-only behavior.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/index.jsx New templates route switch under Governance.
portals/admin/src/main/webapp/source/src/app/components/Governance/Templates/DeleteTemplate.jsx Adds delete dialog/control with read-only guard for global templates.
portals/admin/src/main/webapp/source/src/app/components/Governance/RulesetCatalog/AddEditRuleset.jsx Restricts ruleType options based on artifactType (adds consumer rules for APPLICATION).
portals/admin/src/main/webapp/source/src/app/components/Base/RouteMenuMapping.jsx Adds “Governance > Templates” to the Admin Portal navigation.
portals/admin/src/main/webapp/site/public/locales/fr.json Adds French i18n strings for the new templates feature set.
portals/admin/src/main/webapp/site/public/locales/en.json Adds English i18n strings for the new templates feature set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1291 to +1296
* Fetch published Devportal Governance Templates from the governance REST API.
* The governance API lives outside the devportal swagger spec, so this method
* uses a direct fetch() with the same auth headers the swagger-client interceptor uses.
* Only PUBLISHED templates are returned; the list is empty on any error so callers
* can fail open to the un-governed form.
*
Comment on lines +1331 to +1336
.then((json) => ({
body: {
list: (json.list ?? []).filter((t) => t.status === 'PUBLISHED'),
count: json.count ?? 0,
},
}));
Comment on lines +357 to +364
getVisibleKeyManagers = (keyManagers = []) => {
const kmConfig = this.props.formConfig?.keyManagers;
if (!kmConfig) return keyManagers;
return keyManagers.filter((km) => {
const entry = kmConfig[km.name];
return entry && entry.enabled !== false;
});
};
import FormHelperText from '@mui/material/FormHelperText';
import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel';
import Chip from '@mui/material/Chip';

// Grant types currently selected by the developer — drives conditional field visibility
const activeGrantTypes = keyRequest.selectedGrantTypes ?? [];

</Grid>
</Grid>
</Grid>
<Grid item sm={0} md={3} />
Comment on lines +339 to +344
if (missingFields.length > 0) {
return Promise.reject(new Error(intl.formatMessage({
id: 'Applications.Create.ApplicationFormHandler.template.required.error',
defaultMessage: 'Please fill all required template fields',
})));
}
Comment on lines +478 to +485
{/* Search bar */}
<TextField
fullWidth
size='small'
placeholder='Search templates...'
value={search}
onChange={(e) => setSearch(e.target.value)}
InputProps={{
Comment on lines +123 to +146
const toFieldLabel = (path) => {
if (path === 'application.description') return 'Application description';
if (path === 'application.groups') return 'Application groups';
if (path.startsWith('application.attributes.')) {
return `Application attribute "${path.slice('application.attributes.'.length)}"`;
}
return path || 'Field';
};

const collectRequiredHiddenDefaultFields = (config, path = '') => {
if (!config || typeof config !== 'object' || Array.isArray(config)) return [];

// Skip per-KM config objects that have governance disabled
if (config.enabled === false) return [];

const fields = [];
if (
isConfigActive(config)
&& isConfigTrue(config.required)
&& isConfigTrue(config.hidden)
&& isDefaultEmpty(config.defaultValue)
) {
fields.push(toFieldLabel(path));
}
@@ -0,0 +1,37 @@
/* eslint-disable */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants