Skip to content

Fix UI issues in Settings, Views and Application pages - #3123

Merged
Piumal1999 merged 6 commits into
wso2:mainfrom
Piumal1999:rb-bug-fixes
Aug 4, 2026
Merged

Fix UI issues in Settings, Views and Application pages#3123
Piumal1999 merged 6 commits into
wso2:mainfrom
Piumal1999:rb-bug-fixes

Conversation

@Piumal1999

@Piumal1999 Piumal1999 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Purpose

$subject
Fixes #3118
Fixes #3117
Also fixes a set of issues reported under this:

Approach

  • Fixed the issue with listing multiple key managers in the application overview page
  • Disable the idp ref id setting in the organization edit form
  • Block accessing views through display names
  • Fix issues related to view handle
  • Fix sidebar glitching issue

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 532c599e-1eff-4502-ac56-2ed298a1cd77

📥 Commits

Reviewing files that changed from the base of the PR and between f5b9c25 and 7b9e161.

📒 Files selected for processing (2)
  • portals/api-portal/src/controllers/apiContentController.js
  • portals/api-portal/src/middlewares/registerPartials.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • portals/api-portal/src/middlewares/registerPartials.js
  • portals/api-portal/src/controllers/apiContentController.js

📝 Walkthrough

Walkthrough

The change adds a configurable IdP organization identifier, dynamic view fallback and handle renaming, view-scoped API resolution, multi-key-manager UI scoping, sidebar state restoration, documentation, and integration coverage.

Changes

View lifecycle and scoped access

Layer / File(s) Summary
View API contracts and lifecycle
portals/api-portal/docs/api-portal-openapi-spec-v0.9.yaml, portals/api-portal/src/dao/viewDao.js, portals/api-portal/src/services/apiMetadataService.js, portals/api-portal/it/rest-api/views-and-labels/views.spec.js
View handles can now be renamed. The view identity and its labels stay unchanged. Deletion now protects the last remaining view inside a transaction.
Fallback routing and view-scoped resolution
portals/api-portal/src/utils/orgContext.js, portals/api-portal/src/dao/apiDao.js, portals/api-portal/src/utils/util.js, portals/api-portal/src/controllers/*, portals/api-portal/src/routes/pages/orgContentRoute.js, portals/api-portal/src/middlewares/registerPartials.js, portals/api-portal/src/app.js
The portal resolves fallback view handles at runtime instead of using a hardcoded value. API and MCP lookups now require membership in the requested view.
View behavior validation and settings UI
portals/api-portal/it/rest-api/views-and-labels/*, portals/api-portal/it/ui/cypress/e2e/settings/001-views-labels.cy.js, portals/api-portal/src/pages/settings/partials/*, portals/api-portal/src/scripts/settings-views.js
Tests cover handle resolution, scoped detail pages, fallback redirects, renaming, labels, and deletion controls. The settings UI allows handle edits and shows a rename warning.

IdP organization identity configuration

Layer / File(s) Summary
IdP identity configuration contract
portals/api-portal/src/config/configDefaults.js, portals/api-portal/src/services/adminService.js, portals/api-portal/docs/administer/manage-organizations.md, portals/api-portal/docs/api-portal-openapi-spec-v0.9.yaml, portals/api-portal/src/pages/settings/partials/cfg-organization-panel.hbs
The documentation states that auth.idp_org_id is the source of idpRefId. The settings field is now read-only, and the API still rejects direct changes to idpRefId.
Startup reconciliation and persistence
portals/api-portal/src/services/seederService.js, portals/api-portal/src/utils/idpOrgIdPolicy.js, portals/api-portal/src/utils/idpOrgIdPolicy.test.js, portals/api-portal/src/dao/organizationDao.js, portals/api-portal/src/utils/orgContext.js
Startup creates new organizations with an identifier derived from configuration and reconciles existing values, detecting conflicts and preserving the stored value when needed. Targeted persistence updates only the IdP reference and audit fields.

Multi-key-manager application UI

Layer / File(s) Summary
Key-manager-scoped markup and data
portals/api-portal/src/pages/application/partials/*, portals/api-portal/src/controllers/applicationsContentController.js
Application controls, modals, fields, and references now include the key-manager identifier in their IDs.
Scoped token operations and validation
portals/api-portal/src/scripts/oauth2-key-generation.js, portals/api-portal/it/ui/cypress/e2e/applications/*
Token generation, regeneration, removal, and modal handling now use scoped element IDs. Cypress tests cover multiple key managers and verify isolated state.

Sidebar state and navigation styling

Layer / File(s) Summary
Sidebar state restoration
portals/api-portal/src/defaultContent/layout/main.hbs, portals/api-portal/src/defaultContent/partials/sidebar.hbs, portals/api-portal/src/defaultContent/styles/side-bar.css, portals/api-portal/src/scripts/common.js
The portal restores persisted sidebar state before it enables transitions. The root element's pinned state updates during sidebar collapse and expansion.
Navigation styling and content updates
portals/api-portal/src/defaultContent/styles/header.css, portals/api-portal/src/defaultContent/styles/side-bar.css, portals/api-portal/src/defaultContent/pages/mcp/partials/mcp-listing.hbs
Navigation styles are now scoped to .custom-navbar. Submenu spacing and the MCP heading capitalization are updated.

Estimated code review effort: 5 (Critical) | ~90 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Portal
  participant ViewDAO
  Client->>Portal: Request organization or view content
  Portal->>ViewDAO: Resolve fallback handle or view-scoped artifact
  ViewDAO-->>Portal: Handle or visible artifact
  Portal-->>Client: Redirect, content, or 404
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the purpose placeholder and approach but omits most required sections, including goals, tests, security checks, and test environment. Complete the required template sections and replace "$subject" with a clear purpose, including goals, documentation, tests, security checks, related PRs, and test environment.
Docstring Coverage ⚠️ Warning Docstring coverage is 57.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately identifies the main UI fixes across Settings, Views, and Application pages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
portals/api-portal/it/rest-api/views-and-labels/view-fallback-and-delete.spec.js (1)

19-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Test fallback and last-view behavior in an isolated organization.

The current redirect assertions run while default exists. The old hardcoded redirect would satisfy them. The suite also omits the final-view deletion guard. Use an isolated organization with no default view, assert the exact fallback handle, and assert that deleting the final view returns 400.

Also applies to: 40-67

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@portals/api-portal/it/rest-api/views-and-labels/view-fallback-and-delete.spec.js`
around lines 19 - 30, Update the tests in the view fallback and deletion suite
to create and use an isolated organization whose views do not include the
“default” handle. Assert that the bare organization and portal roots redirect to
the exact earliest-created fallback handle, then remove that view and verify
deleting the final remaining view returns HTTP 400. Avoid relying on the shared
seeded organization or hardcoded default-view redirects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@portals/api-portal/src/controllers/apiContentController.js`:
- Around line 467-470: In the loadAPIDefinitionRaw function's error handler
(around lines 1562-1570), preserve the original error status code when catching
errors from resolveApiIdInView instead of always sending a 500 response. Check
if the caught error has a specific status code like 404 and propagate that
status in the response rather than overwriting it with 500, so excluded APIs
return the expected 404 instead of 500.

In `@portals/api-portal/src/middlewares/registerPartials.js`:
- Around line 203-206: The registerDocsPageContent middleware currently loads
document content using apiDao.getId without enforcing view boundaries, allowing
excluded APIs to have their content preloaded. Replace the apiDao.getId call
with apiDao.getIdInView and include req.params.viewName as the third parameter
to enforce the view boundary before loading document partials. This ensures the
middleware fails when the API is not present in the requested view instead of
allowing the document content to be loaded.

In `@portals/api-portal/src/services/apiMetadataService.js`:
- Around line 1719-1736: The transaction around the view deletion flow must
serialize the last-view check with concurrent deletions. Update the transaction
handling used by the enclosing delete-view method around viewDao.count and
viewDao.delete to use SERIALIZABLE isolation with appropriate retry handling, or
apply the supported adapter’s organization/views row-lock mechanism; preserve
the existing 404, last-view 400, workflow 409, and successful deletion behavior.

---

Nitpick comments:
In
`@portals/api-portal/it/rest-api/views-and-labels/view-fallback-and-delete.spec.js`:
- Around line 19-30: Update the tests in the view fallback and deletion suite to
create and use an isolated organization whose views do not include the “default”
handle. Assert that the bare organization and portal roots redirect to the exact
earliest-created fallback handle, then remove that view and verify deleting the
final remaining view returns HTTP 400. Avoid relying on the shared seeded
organization or hardcoded default-view redirects.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f55d5e47-7e1b-434a-a0d8-cac559c65f0b

📥 Commits

Reviewing files that changed from the base of the PR and between e498dd0 and f5b9c25.

📒 Files selected for processing (44)
  • portals/api-portal/configs/config-template.toml
  • portals/api-portal/docs/administer/manage-organizations.md
  • portals/api-portal/docs/api-portal-openapi-spec-v0.9.yaml
  • portals/api-portal/it/rest-api/organizations/organizations.spec.js
  • portals/api-portal/it/rest-api/views-and-labels/view-fallback-and-delete.spec.js
  • portals/api-portal/it/rest-api/views-and-labels/view-handle-resolution.spec.js
  • portals/api-portal/it/rest-api/views-and-labels/view-scoped-detail-pages.spec.js
  • portals/api-portal/it/rest-api/views-and-labels/views.spec.js
  • portals/api-portal/it/ui/cypress/e2e/applications/application-flows.cy.js
  • portals/api-portal/it/ui/cypress/e2e/applications/key-managers-multiple.cy.js
  • portals/api-portal/it/ui/cypress/e2e/settings/001-views-labels.cy.js
  • portals/api-portal/src/app.js
  • portals/api-portal/src/config/configDefaults.js
  • portals/api-portal/src/controllers/apiContentController.js
  • portals/api-portal/src/controllers/apiKeysPageController.js
  • portals/api-portal/src/controllers/applicationsContentController.js
  • portals/api-portal/src/controllers/viewConfigureController.js
  • portals/api-portal/src/dao/apiDao.js
  • portals/api-portal/src/dao/organizationDao.js
  • portals/api-portal/src/dao/viewDao.js
  • portals/api-portal/src/defaultContent/layout/main.hbs
  • portals/api-portal/src/defaultContent/pages/mcp/partials/mcp-listing.hbs
  • portals/api-portal/src/defaultContent/partials/sidebar.hbs
  • portals/api-portal/src/defaultContent/styles/header.css
  • portals/api-portal/src/defaultContent/styles/side-bar.css
  • portals/api-portal/src/middlewares/registerPartials.js
  • portals/api-portal/src/pages/application/partials/keys-instructions.hbs
  • portals/api-portal/src/pages/application/partials/keys-token.hbs
  • portals/api-portal/src/pages/application/partials/manage-keys-km-card.hbs
  • portals/api-portal/src/pages/settings/partials/cfg-modals.hbs
  • portals/api-portal/src/pages/settings/partials/cfg-organization-panel.hbs
  • portals/api-portal/src/pages/settings/partials/cfg-views-panel.hbs
  • portals/api-portal/src/routes/pages/orgContentRoute.js
  • portals/api-portal/src/scripts/common.js
  • portals/api-portal/src/scripts/oauth2-key-generation.js
  • portals/api-portal/src/scripts/settings-organization.js
  • portals/api-portal/src/scripts/settings-views.js
  • portals/api-portal/src/services/adminService.js
  • portals/api-portal/src/services/apiMetadataService.js
  • portals/api-portal/src/services/seederService.js
  • portals/api-portal/src/utils/idpOrgIdPolicy.js
  • portals/api-portal/src/utils/idpOrgIdPolicy.test.js
  • portals/api-portal/src/utils/orgContext.js
  • portals/api-portal/src/utils/util.js

Comment thread portals/api-portal/src/controllers/apiContentController.js
Comment thread portals/api-portal/src/middlewares/registerPartials.js
Comment thread portals/api-portal/src/services/apiMetadataService.js
@Piumal1999
Piumal1999 merged commit facdc0d into wso2:main Aug 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants