Skip to content

feat: [UIE-8142] - IAM RBAC - Implement Roles Table - #12012

Merged
cpathipa merged 11 commits into
linode:developfrom
rodonnel-akamai:UIE-8142-roles-table-rebased
Apr 16, 2025
Merged

feat: [UIE-8142] - IAM RBAC - Implement Roles Table#12012
cpathipa merged 11 commits into
linode:developfrom
rodonnel-akamai:UIE-8142-roles-table-rebased

Conversation

@rodonnel-akamai

@rodonnel-akamai rodonnel-akamai commented Apr 10, 2025

Copy link
Copy Markdown
Contributor

Description 📝

Highlight the Pull Request's context and intentions.

Changes 🔄

List any change(s) relevant to the reviewer.

  • This is the initial implementation of the Roles Table
  • This PR introduces the web component library and uses the Table as a POC for the Roles table

Target release date 🗓️

4/22/2025
RBAC initial release

Preview 📷

Before After
📷 Screenshot 2025-04-10 at 5 29 43 PM

How to test 🧪

Prerequisites

(How to setup test environment)

  • Ensure the Identity and Access Beta flag is enabled in dev tools
  • Use devenv and login as vagrant user
  • Click on the "Identity and Access [BETA]" link on the left
  • Click on the Roles tab

Verification steps

(How to verify changes)

  • Confirm that the table shows up and renders all data properly
  • Confirm that rows are expandable and that roles with permissions show those permissions
  • Confirm that the roles rows are filterable by text and by type
  • Confirm roles can be selected, and when they are, the button to use them as assignable roles is enabled
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@mjac0bs mjac0bs 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.

Hi @rodonnel-akamai - it looks like all the CI jobs are failing on this PR with an error related to the Akamai CDS package. Can you address that before review? (Does this branch have the latest from develop? Have you run pnpm clean and pnpm install?)

Also, is there somewhere I can find the date for the RBAC initial release mentioned under the Target Release Date?

@rodonnel-akamai

Copy link
Copy Markdown
Contributor Author

Hi @rodonnel-akamai - it looks like all the CI jobs are failing on this PR with an error related to the Akamai CDS package. Can you address that before review? (Does this branch have the latest from develop? Have you run pnpm clean and pnpm install?)

I have and just reran it. I am puzzled by the failure of the CI jobs - it didn't happen that way the first time I raised the PR. I abandoned that PR because I couldn't resolve merge conflicts, and opened this PR under a new branch with the same code but fixes based on comments in the previous PR.

Also, is there somewhere I can find the date for the RBAC initial release mentioned under the Target Release Date?

I don't have an exact date but I have heard June. I will look for a schedule somewhere.

@corya-akamai
corya-akamai self-requested a review April 11, 2025 16:39
@rodonnel-akamai
rodonnel-akamai force-pushed the UIE-8142-roles-table-rebased branch from 3f4f65f to 39f2fe9 Compare April 15, 2025 16:12
@rodonnel-akamai
rodonnel-akamai force-pushed the UIE-8142-roles-table-rebased branch from b50cd95 to 51915c3 Compare April 15, 2025 20:06
Comment thread packages/api-v4/src/iam/types.ts Outdated
Comment thread packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx Outdated
};

const handleAssignSelectedRoles = () => {
// Logic to assign selected roles

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.

Is there another ticket TODO for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No and there should be or this should be implemented. Will update one way or the other.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

UIE-8707

data: EntitiesRole[] | RoleMap[],
suffix: string
): SelectOption[] => {
const resourceTypes = Array.from(new Set(data?.map((el) => el.entity_type)));

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.

Nit: We should avoid "resource" since it is now referred to as "entity"

@rodonnel-akamai rodonnel-akamai Apr 15, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've fixed this a several other new-ish references to "resource" in this file. There are still roughly 50 other references that I did not touch and maybe we should look at down the road.

Comment thread packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx
Comment thread packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx Outdated
};

export const mapEntityTypesForSelect = (
data: EntitiesRole[] | RoleMap[],

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.

Can we reuse mapEntityTypes function? How would other devs know which function to use when?

@rodonnel-akamai rodonnel-akamai Apr 15, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The first one - mapEntityTypes came first and was for an autocomplete, which has different enough options that I had to do this for now. I think you are probably right that there has to be a simple way to combine these, and we should. I'll take a second look at this after the initial release.

/**
* Add descriptions, permissions, type to roles
*/
export const mapAccountPermissionsToRoles = (

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.

Not sure about the name of this function. If I understand correctly, the permissions are already associated with the Role, so this function is flattening the roles and adding 'access', 'entity_type' and 'id' (id is the same as name so not sure it's needed) to the Role for display in the table.

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.

We can follow up on naming. @aaleksee-akamai and I were discussing creating a ticket to align the naming since it has evolved during backend development.

@linode-gh-bot

Copy link
Copy Markdown

Cloud Manager UI test results

🔺 1 failing test on test run #13 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing539 Passing4 Skipped109m 58s

Details

Failing Tests
SpecTest
bucket-details-multicluster.spec.tsCloud Manager Cypress Tests→Object Storage Multicluster Bucket Details Tabs→Properties tab without required capabilities » Object Storage Multicluster Bucket Details Tabs→Properties tab without required capabilities

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/objectStorageMulticluster/bucket-details-multicluster.spec.ts"

@mjac0bs mjac0bs 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.

Did merging in develop cause the linter to run on a bunch of other files that weren't in this PR? CI is failing again. @cpathipa - have you seen this with any of the other IAM PRs?

Edit: I saw this locally on this branch, and a different branch of my own that also had the latest develop merged in, before I ran pnpm clean && pnpm install && pnpm bootstrap to reset the dependencies. That seemed to clear the typecheck errors for me, which leads me to believe that maybe the typecheck failures on this branch are related to the new package update?

I can't test this with API data because I don't have devenv set up locally and have had various blockers in trying to do that in the past week. Still working through them, but just reviewed code and the UI without API data to get this reviewed.

It sounds like you need this in the 4/22 release for devcloud, so as long as we get CI passing and clean up warnings, the rest of my notes were more minor.

  • The table should have centered empty state text and the action menus in the PR description's screenshot look like they're not aligned at the end of the row. If not addressed in this PR, can you please create a ticket to address as a follow up?

"@linode/manager": Added
---

UIE-8142 - implement Roles table ([#12012](https://github.com/linode/manager/pull/12012))

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.

Is this still an upcoming feature under active development? If so, can we delete this changeset and replace it with an "Upcoming Feature" changeset?

<TableBody>
{!rows?.length ? (
<TableRow>
<TableCell>No items to display.</TableCell>

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.

For the empty state table, we ideally still want the empty state copy to be centered within the table. Check out the usage of our <TableRowEmpty /> component in other places (e.g. MaintenanceTable.tsx), which includes a colspan.

Currently Empty State Row
Screenshot 2025-04-15 at 10 58 52 PM Screenshot 2025-04-15 at 11 00 11 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've written a ticket for this. https://track.akamai.com/jira/browse/UIE-8708

}
buttonType="primary"
disabled={selectedRows.length === 0}
onClick={() => handleAssignSelectedRoles()}

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.

Optional nit

Suggested change
onClick={() => handleAssignSelectedRoles()}
onClick={handleAssignSelectedRoles}


renderWithTheme(<RolesLanding />);

expect(screen.getByRole('progressbar')).toBeInTheDocument();

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.

Nit: Couple of linter warnings here - you can remove the expect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly still learning to write the tests within this framework. It's both very different and familiar, so I definitely appreciate any pointers.

"@tanstack/react-query-devtools": "5.51.24",
"@tanstack/react-router": "^1.111.11",
"@xterm/xterm": "^5.5.0",
"akamai-cds-react-components": "0.0.1-alpha.6",

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.

Is this the first use of the Lit web components? That's probably a good thing to highlight in the PR description if so.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, as far as I know it is - hence the missed centered table row - going to have to figure that one out. (Ticket above.) You're right, I should have called it out in the description.

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.

A lot of warnings in this file - see the Github Actions reported by watchdog.


export const RolesTableActionMenu = () => {
const assignRole = () => {
// TODO - implement the assign role functionality

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.

Nit: helpful if TODOs reference ticket numbers if this is a follow up for another PR

Comment on lines +8 to +10
beforeEach(() => {
vi.clearAllMocks();
});

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.

This can be removed.

Comment thread pnpm-lock.yaml
/**
* Add descriptions, permissions, type to roles
*/
export const mapAccountPermissionsToRoles = (

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.

We can follow up on naming. @aaleksee-akamai and I were discussing creating a ticket to align the naming since it has evolved during backend development.

@github-project-automation github-project-automation Bot moved this from Review to Approved in Cloud Manager Apr 16, 2025

@mjac0bs mjac0bs 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.

Thanks for fixing the lock file. Approving with passing CI and team discussion about the web components package remaining in this PR.

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Apr 16, 2025
@cpathipa
cpathipa merged commit ea6a661 into linode:develop Apr 16, 2025
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Cloud Manager Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Multiple approvals and ready to merge! IAM (Identity & Access Management)

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants