-
Notifications
You must be signed in to change notification settings - Fork 367
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
fix: [M3-7038] - Add Firewall and Linode Configuration success toast notifications #9725
fix: [M3-7038] - Add Firewall and Linode Configuration success toast notifications #9725
Conversation
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.
Thanks for working on this!
Do you know why we're getting those delays (VS creating or deleting a Linode for instance)? Pretty important IMO because the toast ends up being a bit distracting. It happens a few seconds afterwards (that was my experience at least, sometimes close to 5/6 seconds) and it's a bit odd since we can clearly see the UI update (ex row gets deleted), then the notification happens much later.
Considering the UI updates + the notification menu event notification, I wonder about the worth of this update if the delay is that long
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 feel like linode_config*
, firewall_enable
, firewall_disable
, firewall_create
, firewall_device_add
, firewall_device_remove
toasts should just be done on the initial request, not based on events polling. I'd have to look at the API code and see what actually takes place when some of these events are created but I feel like most of the events I listed above don't need to wait on an event to show, This is mostly my opinion. Anyone else have thoughts?
@bnussman-akamai ah yeah that makes sense, they're based on event polling. Agree 💯 |
Awesome, will change that over now. |
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.
Thanks for making those changes! Feels much better.
for consistency, in the firewall flows, do we also want to add toasts when adding inbound/outbound rules? /firewalls/{id}/rules
packages/manager/src/features/Firewalls/FirewallLanding/FirewallDialog.tsx
Outdated
Show resolved
Hide resolved
@@ -191,6 +195,9 @@ const FirewallRulesLanding = (props: Props) => { | |||
// Reset editor state. | |||
inboundDispatch({ rules: _rules.inbound ?? [], type: 'RESET' }); | |||
outboundDispatch({ rules: _rules.outbound ?? [], type: 'RESET' }); | |||
enqueueSnackbar('Successfully updated Firewall rules', { |
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.
The firewalls inbound/outbound details section is a little odd. Instead of having an api call for each action (edit, delete, add, clone), the user first executes an action and then when they click 'Save Changes', the api is called. This makes my job a little easier with the Toast Notifications since they are all routed through the function applyChanges
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.
packages/manager/src/features/Firewalls/FirewallDetail/Devices/AddDeviceDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Firewalls/FirewallDetail/Devices/RemoveDeviceDialog.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/DeleteConfigDialog.tsx
Show resolved
Hide resolved
packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Firewalls/FirewallLanding/CreateFirewallDrawer.tsx
Outdated
Show resolved
Hide resolved
|
||
onClose(); | ||
onClose(); |
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.
@bnussman-akamai I got rid of the error toast notification and made it so the dialog only closed if the mutateasync does not return an error.
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.
Could we clean this up still? Should we put queryClient.invalidateQueries
in the then
? Should we put onClose
in the then
too? Should we revert to the await syntax?
Right now, it's unclear to me why enqueueSnackbar
is in the then
but queryClient.invalidateQueries
and onClose
are not
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.
@bnussman-akamai queryClient.invalidateQueries
and onClose
are in the then
statement.
I can go back to the await
syntax though to make it more clear.
@@ -218,6 +225,9 @@ const FirewallRulesLanding = (props: Props) => { | |||
}); | |||
} | |||
} | |||
enqueueSnackbar('Failed to update Firewall rules', { |
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.
Kept this error because there is no "Save Changes" dialog
…ll-and-Linode-Config
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.
Creating a Firewall triggers a successful toast notification 🚫
Disabling a Firewall triggers a successful toast notification ✅
Enabling a Firewall triggers a successful toast notification ✅
Deleting a Firewall triggers a successful toast notification ✅
Adding a Linode triggers a successful toast notification 🚫
Deleting a Linode triggers a successful toast notification ✅
Adding a Linode configuration triggers a successful toast notification ✅
Deleting a Linode configuration triggers a successful toast notification ✅
Editing a Linode configuration triggers a successful toast notification ✅
|
||
onClose(); | ||
onClose(); |
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.
Could we clean this up still? Should we put queryClient.invalidateQueries
in the then
? Should we put onClose
in the then
too? Should we revert to the await syntax?
Right now, it's unclear to me why enqueueSnackbar
is in the then
but queryClient.invalidateQueries
and onClose
are not
packages/manager/src/features/Firewalls/FirewallLanding/FirewallDialog.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/DeleteConfigDialog.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx
Outdated
Show resolved
Hide resolved
The two tests that failed are corrected in the nodebalancer-firewall feature branch. Banks left a comment pointing out that the changes conflict with the feature branch. So the functionality will be added shortly once the feature branch is merged. |
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.
Approving based on latest comments about expected cases to be handled in a different PR
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.
…t-Notification-for-Firewall-and-Linode-Config
@@ -116,7 +116,7 @@ describe('clone linode', () => { | |||
|
|||
ui.toast.assertMessage(`Your Linode ${newLinodeLabel} is being created.`); | |||
ui.toast.assertMessage( | |||
`Linode ${linode.label} has been cloned successfully to ${newLinodeLabel}.` | |||
`Linode ${linode.label} successfully cloned to ${newLinodeLabel}.` |
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 had to update the E2E tests to match the toast notification messages.
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! Thanks for resolving the e2e failures! 🎉
Description 📝
The Firewall and Linode Configuration toast notifications did not have a success message, causing no toast notifications when an action was successful.
Major Changes 🔄
Preview 📷
Before
M3-7038.mov
After
How to test 🧪
*** Note: The toast notifications take a couple seconds to pop up.
Navigate to the firewall landing page (/firewalls) and ensure:
Navigate to the linodes tab within any firewall details page (/firewalls/[firewall_ID]/linodes) and ensure:
Navigate to the config tab within any linode details page (/linodes/[linode_id]/configurations) and ensure: