Add Admin and DevPortal UI for DevPortal Governance templates#1346
Add Admin and DevPortal UI for DevPortal Governance templates#1346ashiduDissanayake wants to merge 3 commits into
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (33)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
|
|
|
There was a problem hiding this comment.
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.
| * 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. | ||
| * |
| .then((json) => ({ | ||
| body: { | ||
| list: (json.list ?? []).filter((t) => t.status === 'PUBLISHED'), | ||
| count: json.count ?? 0, | ||
| }, | ||
| })); |
| 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} /> |
| 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', | ||
| }))); | ||
| } |
| {/* Search bar */} | ||
| <TextField | ||
| fullWidth | ||
| size='small' | ||
| placeholder='Search templates...' | ||
| value={search} | ||
| onChange={(e) => setSearch(e.target.value)} | ||
| InputProps={{ |
| 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 */ | |||




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:
- General Details.
- Field Configuration.
- Ruleset Bindings.
- Developer View.
- Review & Publish.
- Application throttling policy.
- Description.
- Application groups.
- Custom application attributes.
- Per-Key-Manager OAuth fields.
- Developer-facing summary and limitations.
Important behavior:
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