Skip to content

upcoming: [M3-9829] - Refactor AddLinodeDrawer and add support for assigning multiple firewalls #12220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

coliu-akamai
Copy link
Contributor

@coliu-akamai coliu-akamai commented May 14, 2025

Description 📝

  • Updates AddLinodeDrawer to remove useEffect >>> huge kudos + thanks to Banks for the POC! this builds heavily off that
  • Adds ability to assign multiple firewalls to an entity from the Firewall details page - this functionality always existed in the API, now bringing a bit of parity to CM
  • Update Linode Interface table to have a 'Show More' if there exist additional firewalls

FOLLOW UP: M3-9984 to continue supporting multiple firewall functionality
RELATED: M3-9884

Changes 🔄

  • Add ability to assign multiple firewalls for all device types (linode, interface, nodebalancer)
  • add util function + tests to determine if firewall can be assigned to entity (util function only takes into account firewall status + existing devices, not stuff like read only linodes/entities. additional filtering done in the drawers)
  • refactored AddLinodeDrawer to remove useEffect

Preview 📷

there should be no visual changes (besides comment below)
Functionality changes - see video

Before After
cannot-multi-assign.mov
can-multi-assign.mov

image

Before After
image image

How to test 🧪

To test Linode Interface stuff, you'll need the tag + feature flag

Verification steps

  • Confirm steps in upcoming: [M3-9114] - Add support for Linode Interfaces in Firewalls AddLinodeDrawer  #12035 still work as expected and
  • Confirm assigning multiple firewalls to a device (linode, interface, nodebalancer) works as expected:
    • if firewall is disabled, we can add an entity as long as that entity isn't already assigned to this firewall
    • if firewall is enabled, we can only add an entity if it doesn't already have another enabled firewall
  • Confirm if a Linode Interface has multiple firewalls assigned to it, a ShowMore component for its firewalls will appear in the Interface table
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

Comment on lines 277 to 280
if (linodesNeedingInterfaceSelection.length > 0) {
interfaceError =
'You must select an interface to assign to this Firewall.';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the one visual/functionality difference for adding interfaces that (should - unless there are bugs 🤞) exists between this version and the old is that now, if we select a LInode but don't select a corresponding interface, we receive an error (instead of submit button being disabled):

Before After
image image

this aligns behavior with other drawers/forms in CM a bit more (submitting + receiving error back), but I can look into changing back to disabling the button if wanted!

Comment on lines 180 to 184
const linodesNeedingInterfaceSelection =
selectedLinodesWithMultipleInterfaces.filter(
(linode) => !selectedIfacesToAdd[linode.id]
);
const failedLinodes: Linode[] = [...linodesNeedingInterfaceSelection];
Copy link
Contributor Author

@coliu-akamai coliu-akamai May 14, 2025

Choose a reason for hiding this comment

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

If we've selected a Linode with multiple eligible interfaces, haven't selected an interface for that Linode, and click add, no interface device gets added for those Linodes. So, we will save them for the next attempt and display a message to select the interfaces

@coliu-akamai coliu-akamai marked this pull request as ready for review May 14, 2025 22:13
@coliu-akamai coliu-akamai requested a review from a team as a code owner May 14, 2025 22:13
@coliu-akamai coliu-akamai requested review from hana-akamai, hasyed-akamai and bnussman-akamai and removed request for a team May 14, 2025 22:13
Comment on lines +46 to +58
<ShowMore
ariaItemType="Interface Firewalls"
items={firewalls}
render={(firewalls) => (
<Stack>
{firewalls.map((firewall) => (
<Link key={firewall.id} to={`/firewalls/${firewall.id}`}>
{firewall.label}
</Link>
))}
</Stack>
)}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

considering adding this to LinodeEntityDetail as well (see #12176), but I feel like it makes the UI a bit too cluttered:

vs

image

image

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #9 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing592 Passing4 Skipped111m 37s

Details

Failing Tests
SpecTest
object-storage-objects-multicluster.spec.tsCloud Manager Cypress Tests→Object Storage Multicluster objects » Object Storage Multicluster objects

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/objectStorageMulticluster/object-storage-objects-multicluster.spec.ts"

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Functionality seems to be working as expected

Comment on lines +26 to +32
return firewall?.status !== 'enabled'
? !isEntityAssignedToFirewall
: !isEntityAssignedToFirewall &&
!firewallEntities?.some(
(service) =>
service.id === entityId && service.firewallStatus === 'enabled'
);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could use some early returns instead of teranaries to make this cleaner and more readable

@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels May 20, 2025
@github-project-automation github-project-automation bot moved this from Review to Approved in Cloud Manager May 21, 2025
@hasyed-akamai hasyed-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels May 21, 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! Firewalls Related to Firewalls Linode Interfaces
Projects
Status: Approved
Development

Successfully merging this pull request may close these issues.

4 participants