Skip to content

CONSOLE-5061: Add Resource Names column to Role Rules table#15999

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
krishagarwal278:CONSOLE-5061
Feb 8, 2026
Merged

CONSOLE-5061: Add Resource Names column to Role Rules table#15999
openshift-merge-bot[bot] merged 3 commits intoopenshift:mainfrom
krishagarwal278:CONSOLE-5061

Conversation

@krishagarwal278
Copy link
Member

@krishagarwal278 krishagarwal278 commented Feb 5, 2026

Reviewers Checklist:

  • Added Resource Names column to the Rules table
  • Display logic - nothing when empty, each name when populated
  • Renamed 'Actions' to 'Verbs'
  • Updated e2e tests (Cypress)
Screenshot 2026-02-05 at 11 45 31 AM Screenshot 2026-02-05 at 11 44 53 AM

Summary by CodeRabbit

  • New Features

    • Added "Resource Names" column to role and cluster role rule details for enhanced visibility.
    • Enhanced search functionality to include resource names when filtering RBAC rules.
  • Tests

    • Added UI tests verifying resource names column display in role-based rule tables.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 5, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 5, 2026

@krishagarwal278: This pull request references CONSOLE-5061 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Reviewers Checklist:

  • Added Resource Names column to the Rules table
  • Display logic - nothing when empty, each name when populated
  • Renamed 'Actions' to 'Verbs'
  • Updated e2e tests (Cypress)
Screenshot 2026-02-05 at 11 45 31 AM Screenshot 2026-02-05 at 11 44 53 AM

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from cajieh and spadgett February 5, 2026 16:53
@openshift-ci openshift-ci bot added component/core Related to console core functionality kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Feb 5, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 5, 2026

@krishagarwal278: This pull request references CONSOLE-5061 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Reviewers Checklist:

  • Added Resource Names column to the Rules table
  • Display logic - nothing when empty, each name when populated
  • Renamed 'Actions' to 'Verbs'
  • Updated e2e tests (Cypress)
Screenshot 2026-02-05 at 11 45 31 AM Screenshot 2026-02-05 at 11 44 53 AM

Summary by CodeRabbit

  • New Features

  • Added "Resource Names" column to role and cluster role rule details for enhanced visibility.

  • Enhanced search functionality to include resource names when filtering RBAC rules.

  • Tests

  • Added UI tests verifying resource names column display in role-based rule tables.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This pull request extends RBAC rule table functionality to support the resourceNames field across the console. Changes include: adding a new "Resource Names" column to the Rules detail view with corresponding display logic via a ResourceNames component; extending the role rules filter predicate to include resourceNames in search operations; introducing Cypress integration tests that verify the column's presence and structure for both Role and ClusterRole resources; and adding the required localization key. The modifications maintain existing table behavior while expanding coverage of Kubernetes RBAC rule attributes.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: adding a Resource Names column to the Role Rules table, which aligns with all file modifications across tests, components, translations, and UI logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/public/components/RBAC/rules.jsx`:
- Around line 131-143: The ResourceNames component currently calls
resourceNames.sort(), which mutates the incoming prop; instead create a copy
before sorting (e.g., use [...resourceNames] or resourceNames.slice()) and call
sort on that copy, then map over the sorted copy to render the rows; update
ResourceNames to avoid mutating the resourceNames prop and preserve
immutability.
🧹 Nitpick comments (1)
frontend/packages/integration-tests-cypress/tests/crud/roles-rolebindings.cy.ts (1)

17-54: Consider adding test data with actual resourceNames for more comprehensive coverage.

The example roles created in createExampleRoles() use default YAML that likely doesn't include resourceNames. To fully validate the new column renders content correctly (not just the header), consider adding a rule with resourceNames populated.

💡 Example enhancement
   yamlEditor.getEditorContent().then((content) => {
-    newContent = _.defaultsDeep({}, { metadata: { name: roleName } }, safeLoad(content));
+    newContent = _.defaultsDeep(
+      {},
+      {
+        metadata: { name: roleName },
+        rules: [
+          {
+            apiGroups: [''],
+            resources: ['pods'],
+            resourceNames: ['example-pod'],
+            verbs: ['get', 'list'],
+          },
+        ],
+      },
+      safeLoad(content),
+    );
     yamlEditor.setEditorContent(safeDump(newContent)).then(() => {

Then in the test, you could additionally verify:

cy.contains('td', 'example-pod').should('exist');

Comment on lines 131 to 143
const ResourceNames = ({ resourceNames }) => {
if (!resourceNames || resourceNames.length === 0) {
return null;
}

const names = resourceNames.sort().map((name) => (
<div className="rbac-rule-row" key={name}>
{name}
</div>
));

return <div>{names}</div>;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid mutating the resourceNames prop with .sort().

Array.prototype.sort() mutates the original array. While React props should be treated as immutable, this could cause subtle bugs if the same array reference is reused elsewhere. Spread the array first to create a copy.

🔧 Proposed fix
 const ResourceNames = ({ resourceNames }) => {
   if (!resourceNames || resourceNames.length === 0) {
     return null;
   }

-  const names = resourceNames.sort().map((name) => (
+  const names = [...resourceNames].sort().map((name) => (
     <div className="rbac-rule-row" key={name}>
       {name}
     </div>
   ));

   return <div>{names}</div>;
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ResourceNames = ({ resourceNames }) => {
if (!resourceNames || resourceNames.length === 0) {
return null;
}
const names = resourceNames.sort().map((name) => (
<div className="rbac-rule-row" key={name}>
{name}
</div>
));
return <div>{names}</div>;
};
const ResourceNames = ({ resourceNames }) => {
if (!resourceNames || resourceNames.length === 0) {
return null;
}
const names = [...resourceNames].sort().map((name) => (
<div className="rbac-rule-row" key={name}>
{name}
</div>
));
return <div>{names}</div>;
};
🤖 Prompt for AI Agents
In `@frontend/public/components/RBAC/rules.jsx` around lines 131 - 143, The
ResourceNames component currently calls resourceNames.sort(), which mutates the
incoming prop; instead create a copy before sorting (e.g., use
[...resourceNames] or resourceNames.slice()) and call sort on that copy, then
map over the sorted copy to render the rows; update ResourceNames to avoid
mutating the resourceNames prop and preserve immutability.

Copy link
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 5, 2026
@krishagarwal278
Copy link
Member Author

docs-approval:
/assign @jseseCCS

px-approval:
/assign @rh-joshbeverly

qe-approval:
/assign @yanpzhan

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 5, 2026

@krishagarwal278: GitHub didn't allow me to assign the following users: jseseCCS, rh-joshbeverly.

Note that only openshift members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

docs-approval:
/assign @jseseCCS

px-approval:
/assign @rh-joshbeverly

qe-approval:
/assign @yanpzhan

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@sferich888
Copy link

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Feb 5, 2026
@yanpzhan
Copy link
Contributor

yanpzhan commented Feb 6, 2026

Tested on cluster launched against the pr, go to anyone role page, check Rules table, there is 'Resource Names' column column, when a rule has 'resourceNames'(could check from role yaml), the value will show up in 'Resource Names' column, otherwise, the 'Resource Names' is empty.
Screenshot from 2026-02-06 16-57-37

/verified by yanpzhan

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 6, 2026
@openshift-ci-robot
Copy link
Contributor

@yanpzhan: This PR has been marked as verified by yanpzhan.

Details

In response to this:

Tested on cluster launched against the pr, go to anyone role page, check Rules table, there is 'Resource Names' column column, when a rule has 'resourceNames'(could check from role yaml), the value will show up in 'Resource Names' column, otherwise, the 'Resource Names' is empty.
Screenshot from 2026-02-06 16-57-37

/verified by yanpzhan

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

@jseseCCS jseseCCS left a comment

Choose a reason for hiding this comment

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

one small comment; otherwise LGTM

"Create Role": "Create Role",
"API groups": "API groups",
"Resources": "Resources",
"Resource Names": "Resource Names",
Copy link

Choose a reason for hiding this comment

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

Suggest sentence case for consistency w/other UI labels in this file/across console.

Change: "Resource Names" → "Resource names"

Field labels, table headers, dropdown labels use sentence case (API groups, Delete rule), so this should align w/that pattern.

@jseseCCS
Copy link

jseseCCS commented Feb 6, 2026

suggested 1 change; otherwise LGTM

@jseseCCS
Copy link

jseseCCS commented Feb 6, 2026

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Feb 6, 2026
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Feb 6, 2026
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2026
@krishagarwal278
Copy link
Member Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 6, 2026
Comment on lines 136 to 140
const names = resourceNames.sort().map((name) => (
<div className="rbac-rule-row" key={name}>
{name}
</div>
));
Copy link
Member

Choose a reason for hiding this comment

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

code rabbit is right. sort will mutate the array, but best practice dictates we treat props as read only. we can use toSorted to avoid that

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed 👍🏻

Copy link
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig, jseseCCS, krishagarwal278, logonoff

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@krishagarwal278
Copy link
Member Author

/verified by @yanpzhan @krishagarwal278

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Feb 6, 2026
@openshift-ci-robot
Copy link
Contributor

@krishagarwal278: This PR has been marked as verified by @yanpzhan @krishagarwal278.

Details

In response to this:

/verified by @yanpzhan @krishagarwal278

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@krishagarwal278
Copy link
Member Author

/retest

1 similar comment
@krishagarwal278
Copy link
Member Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 8, 2026

@krishagarwal278: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 8211d30 into openshift:main Feb 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants