-
Notifications
You must be signed in to change notification settings - Fork 370
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
feat: [M3-7016] - Add Basic Filtering for Firewall Devices #9626
feat: [M3-7016] - Add Basic Filtering for Firewall Devices #9626
Conversation
<Button | ||
buttonType="primary" | ||
data-testid="add-device-button" | ||
disabled={disabled} | ||
onClick={() => setDeviceDrawerOpen(true)} | ||
> | ||
Add {formattedType}s to Firewall | ||
</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use ActionsPanel
here to avoid variations for primary actions button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like the ActionsPanel is also dependent on the primary actions button. Let me know if I misinterpreted your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tyler-akamai Yes, you are right. My intention is to use the ActionsPanel component to render the Primary button instead of having isolated references to the primary button, unless the ActionsPanel doesn't meet our requirements. This approach would make future maintenance easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good callout. I checked with the team on this. They said that for one off selections like "Add a Nodebalancer/Linode" we should use the Button
component. We should only use the ActionsPanel component if there are multiple actions to select from, or we are in a modal or drawer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an ActionsPanel storybook component and added this clarification to the documentation page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tyler-akamai i know this is a draft, but just heads up this PR is modifying two core components and you shouldn't have to do that.
- Removing a required label prop isn't recommended
- you already have a
hideLabel
prop on the textfield component
yes, great catch. |
…iltering-to-Devices
…iltering-to-Devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming along! some more needed changes
packages/manager/src/components/DebouncedSearchTextField/DebouncedSearchTextField.tsx
Outdated
Show resolved
Hide resolved
label="" | ||
placeholder={`Search ${formattedType}s`} | ||
value={searchText} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may want to set a lower debounceTime than the default (250
instead of 400
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! is there a reason its at 400? Should we change the default to something lower?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to discuss this for a later PR, but see how the experience feels with 400. I find it to feel laggy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Tested in the browser and text field behaves as expected
I'm experiencing a noticeable delay when adding or removing devices to the Firewall. I did not observe this in the other PR where the functionality to add devices was introduced. Screen.Recording.2023-09-12.at.2.17.24.PM.movIt might be a state management issue because the number of devices is updated upon adding/removing devices, it's just that the table of devices is not updated until the page refreshes. |
@tyler-akamai Over all LGTM, Othe than below observations: The Linode firewall's table does not refresh successfully after adding Linodes until the page is manually refreshed. Same Behavior when Remove action is performed It would be nice to have descriptive tooltip message saying clear all or deselect all for X button. |
// const devices =
// allDevices?.filter((device) => device.entity.type === type) || [];
const [filteredDevices, setFilteredDevices] = React.useState<
FirewallDevice[]
>([]);
React.useEffect(() => {
setFilteredDevices(allDevices?.filter((device) => device.entity.type === type) || []);
}, [allDevices, type]);
const selectedDevice = filteredDevices?.find(
(device) => device.id === selectedDeviceId
);
const filter = (value: string) => {
setSearchText(value);
const filtered = filteredDevices.filter((device) => {
return device.entity.label.toLowerCase().includes(value.toLowerCase());
});
setFilteredDevices(filtered);
}; Screen.Recording.2023-09-12.at.3.49.44.PM.mov |
Huge thank you! |
* feat: [M3 7015] - Create nodebalancer tab in firewalls landing (#9590) * initial changes * finished the firewall device landing updates * Added changeset: Create nodebalancer tab in firewalls landing * fixed breadcrumb and variable names * added FirewallDeviceLanding test file * added initial unit tests * updated jest.mock function, still not working * swapped from jest.mock to MSW, still need some work * fixed unit tests * fixed tests for FirewallDeviceLanding --------- Co-authored-by: TylerWJ <[email protected]> * feat: [M3-7019] - Create add Nodebalancer to Firewall drawer (#9608) * initial drawer commit * finished the add nodebalancer drawer * Added changeset: Created 'Add Nodebalancer' to Firewall drawer * updated drawer and started to add event handlers * added toast notification * added multiple toast notifications * separated nodebalancer and linode drawer * added infinite scrolling * fixed pr suggestions * partially eliminated type definitions in LinodeSelect * eliminated type definitions in LinodeSelect * changed type definition of onSelectionChange in NodeBalancerSelect * eliminated type declarations in NodeBalancerSelect * erased commented out code * initial round of fixes * fixed linode error drawer not closing * eliminated event message * added todo comment * added todo comment * fixed toast notification, error reset, and error text * fixed toast notification, error reset, and error text for Linode Drawer * fixed nodebalancer drawer error notices * merged with develop * initial migration to new autocomplete component, still some errors * can select linodes now, but the linodes arent showing as selected * fixed selection issue with autocomplete * migrated to new autocomplete component * remove NodeBalancerSelect file changes * added banks PR suggestions --------- Co-authored-by: TylerWJ <[email protected]> * feat: [M3-7052] - Add NodeBalancer table under Firewall / Devices (#9664) * initial nodebalancer table commit * Added changeset: Added NodeBalancer table under Firewall/Devices * removed unnecessary prop extension --------- Co-authored-by: TylerWJ <[email protected]> * feat: [M3-7016] - Add Basic Filtering for Firewall Devices (#9626) * initial firewall device filter commit * Added changeset: Added Basic Filtering for Firewall Devices * cleaned up label content in TextField * initial ActionsPanel Storybook commit * reverted ActionsPanel changes * updated storybook * Fixed storybook * test commit - eslint issues * test commit * fixed text field * removed unnecessary code * added Alban's changes * test commit * removed test comment * fixed filtering error --------- Co-authored-by: TylerWJ <[email protected]> Co-authored-by: Hana Xu <[email protected]> * feat: [M3-7033] - Update Firewall Landing Device Column (#9668) * initial update to device cell wrap functionality * added extra console line for width * still not working * updated the code, still not working * changes linodes column to devices column * fixed styling file * Added changeset: Updated Firewall Landing Device Column * removed unnecessary styling * fixed test results * added Connie's pr suggestions * updated styled row file * added line clamp to styled component * removed old test case * updated row spacing * fixed spacing --------- Co-authored-by: TylerWJ <[email protected]> * feat: [M3-7017] - Update firewall events (#9693) * feat: [M3-7017] - Update firewall events * Fix e2e test and secondary entity formatting * Add changeset * feat: [M3-7020] - Update Create Firewall drawer (#9630) * feat: [M3-7020] - Update Create Firewall drawer * Update firewall e2e tests for NodeBalancer UI improvements * Integrate new Autocomplete component * Change test description * Add UI indicator for errors and reset nb values * Add changeset * Move static strings outside component * Implement PR feedback suggestions * Remove unnecessary check and change var name --------- Co-authored-by: Joe D'Amore <[email protected]> * feat: [M3-7021] - Added Firewall panel to create NodeBalancer flow (#9733) * merged with upstream * Added changeset: Added Firewall Panel to NodeBalancer Create flow --------- Co-authored-by: TylerWJ <[email protected]> * fix: [M3-7245] - Replaced 'Devices' with 'Services' in Firewall Page (#9775) * replaced visible devices with services * fixed routing for drawers * Added changeset: Swapped 'Devices' to 'Services' in Firewall and updated Add Service to Firewall routing * updated unit tests, still need work * updated unit tests * updated capitalization and unit tests --------- Co-authored-by: TylerWJ <[email protected]> * fixed merge conflict * fix: [M3-7313] - Migrated Linode dropdown to Autocomplete in Firewall Landing > Create Firewall drawer (#9837) * migrated Linode dropdown to Autocomplete, fixed NodeBalancer dropdown, added successfull toast notification * Added changeset: Linode dropdown in Create Firewall drawer using LinodeSelect component instead of the Autocomplete component * fixed changeset message from last pr * updated unit tests * addressed Hana's feedback * removed helper text * initial changes to unnecessary state * addresses Banks feedback * addressed additional feedback * fixed syntax of optionsFilter * switched set to list for autocomplete --------- Co-authored-by: TylerWJ <[email protected]> * feat: [M3-7163] - Add Firewall Section to NodeBalancer Details Page (#9831) * first commit * Code cleanup * Fix quick bug * PR feedback changes * RQ changes * fixed toast notification errors * fixed toast notifications * PR feedback --------- Co-authored-by: TylerWJ <[email protected]> * refactor: [M3-7377] - Migrate dopdowns in Create Firewall Drawer from Autocomplete to LinodeSelect and NodeBalancerSelect (#9886) * initial commit * updated font bold to use mui theme * migrated autocomplete to nodebalancer select * small naming changes * Updated CreateFirewallDrawer and SelectFirewallPanel * removed comments * Added changeset: Dropdowns in Create Firewall Drawer using Autocomplete instead of updated LinodeSelect and NodeBalancerSelect * fixed LinodeSelect unit tests * added NodeBalancer unit tests * fixed SelectFirewallPanel unit tests * added pr feedback * updated dropdown labels * fixed unit tests * fixed unit tests * fixed unit tests * working to fix timeout error * rerunning unit tests * test debug * merged with develop * testing unit tests * testing last unit test * testing last unit test * removed line to see if unit tests will pass * Replace calls to `jest.fn()` with `vi.fn()` * rerunning tests * fixed e2e tests * resolved pr suggestions --------- Co-authored-by: TylerWJ <[email protected]> Co-authored-by: Banks Nussman <[email protected]> Co-authored-by: Joe D'Amore <[email protected]> * feature: [M3-7442] - Put Firewall-Nodebalancer behind feature flag (#9931) * initial feature flag migration * Added remaining code under feature flag * updated text in drawer * Added changeset: Added feature flag to Firewall-NodeBalancer * fixed unit test * fixed unit tests * added feature flag to dev tools * test commit * test commit * fixed border issue in firewall's table * partially fixed border issue * partially fixed border issue * fixed border issue * feat: [M3-7018] - Add documentation links for Firewall NodeBalancer (#9926) * added links * fixed nodebalancer create flow text * made link format more consistent * added changeset * fixed filter issue * removed comment * started to address Alban's feedback * fixed other instance of unnecessary else * addressed feedback for Firewall Drawer Props * added clamp-js for firewall landing * added clamp-js library * addressed some comments * addressed onService required prop feedback * addressed test feedbacl for FirewallDeviceLanding * addressed test feedback for FirewallDeviceLanding * added a todo in FirewallRulesLanding * added unit tests for addNodebalancerDrawer and addLinodeDrawer * addressed Connie's feedback ab aria labels * sanitized error messages in add drawers * added interface for secondaryEntityTypeObj * fixed link in create NodeBalancer flow * fixed header in create drawer * Update packages/manager/.changeset/pr-9926-upcoming-features-1700672014523.md Co-authored-by: Dajahi Wiley <[email protected]> * added period after Learn more in create firewall drawer * fixed nodebalancer create flow issue * NodeBalancer is now assigned to Firewall * removed unnecessary invalidate query * added doc link to NodeBalancer's details page * improved organization of the AddLinodeDrawer and AddNodeBalancerDrawer * added a constants file in FirewallLanding directory * Update packages/manager/.changeset/pr-9926-upcoming-features-1700672014523.md Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/.changeset/pr-9931-upcoming-features-1700686098973.md Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/FirewallDeviceTable.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/FirewallDeviceTable.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddNodebalancerDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddNodebalancerDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddNodebalancerDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/NodeBalancers/NodeBalancerDetail/NodeBalancerFirewalls.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/api-v4/src/nodebalancers/nodebalancers.ts Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/NodeBalancers/NodeBalancerDetail/NodeBalancerFirewalls.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddLinodeDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddNodebalancerDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddLinodeDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddLinodeDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddLinodeDrawer.test.tsx Co-authored-by: Mariah Jacobs <[email protected]> * fixed import error * mapIdsToLinodes to mapIdsToDevices * fixed Linodes Network tab Firewall Table error state * fixed Linodes Network tab Firewall Table error state * fixed Create NodeBalancer add firewall flow * removed firewall_id forom NodeBalancerConfigNode * added firewall_id to the payload * fixed spelling issue * Fix darkmode link color discrepancy * added tags to CreateNodeBalancerPayload * Replace html anchor tag with Link component * change: [M3-7546] - Revert FW table row changes (#9974) * change: [M3-7546] - Revert NB table row changes * Fix linking for NodeBalancers from the table cell * Remove the `clamp-js` package * Add changeset * added links to constants file * changed SecondaryEntityType from interface to type * changed improved mapIdsToDevices tests to cover nodebalancers * Update packages/manager/src/features/Events/eventMessageGenerator.ts Co-authored-by: Banks Nussman <[email protected]> * eliminated ternary in Summary Panel * cleaned up NodeBalancerSettings displayFirewallInfotext * Fix dark mode color issue on NB settings page * invalidated device queries after firewall has been deleted --------- Co-authored-by: tyler-akamai <[email protected]> Co-authored-by: TylerWJ <[email protected]> Co-authored-by: Hana Xu <[email protected]> Co-authored-by: Joe D'Amore <[email protected]> Co-authored-by: Tyler Jones <[email protected]> Co-authored-by: Banks Nussman <[email protected]> Co-authored-by: Dajahi Wiley <[email protected]> Co-authored-by: Mariah Jacobs <[email protected]> Co-authored-by: Banks Nussman <[email protected]>
Description 📝
Added device filtering for the Linode and Nodebalancer firewall tabs.
Major Changes 🔄
DebouncedSearchTextField
componentPreview 📷
How to test 🧪