Skip to content

Commit

Permalink
Merge branch 'develop' into feature/firewall-nodebalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerWJ committed Oct 11, 2023
2 parents 2f7380d + 5ba8ec5 commit 56ee34f
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 61 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-9725-fixed-1695824674392.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Add Firewall and Linode Configuration success toast notifications ([#9725](https://github.com/linode/manager/pull/9725))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-9753-changed-1696626338930.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Comment out CS:GO app pending update ([#9753](https://github.com/linode/manager/pull/9753))
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`
);
});
});
Expand Down
10 changes: 7 additions & 3 deletions packages/manager/cypress/e2e/core/linodes/linode-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ describe('Linode Config', () => {
.click();
});

ui.toast.assertMessage('Successfully deleted config');
ui.toast.assertMessage(
'Configuration My Debian 10 Disk Profile successfully deleted'
);
cy.findByLabelText('List of Configurations').within(() => {
containsVisible('No data to display.');
});
Expand Down Expand Up @@ -232,7 +234,7 @@ describe('Linode Config', () => {
});

ui.toast.assertMessage(
'Linode cy-test-clone-origin-linode has been cloned successfully to cy-test-clone-destination-linode.'
'Linode cy-test-clone-origin-linode successfully cloned to cy-test-clone-destination-linode.'
);
});
});
Expand Down Expand Up @@ -274,7 +276,9 @@ describe('Linode Config', () => {
cy.wait('@deleteLinodeConfig')
.its('response.statusCode')
.should('eq', 200);
ui.toast.assertMessage('Successfully deleted config');
ui.toast.assertMessage(
'Configuration My Debian 10 Disk Profile successfully deleted'
);
cy.findByLabelText('List of Configurations').within(() => {
containsVisible('No data to display.');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('linode storage tab', () => {
cy.wait('@deleteDisk').its('response.statusCode').should('eq', 200);
cy.findByText('Deleting', { exact: false }).should('be.visible');
ui.button.findByTitle('Add a Disk').should('be.enabled');
ui.toast.assertMessage(`Disk ${diskName} deleted successfully.`);
ui.toast.assertMessage(`Disk ${diskName} successfully deleted.`);
cy.findByLabelText('List of Disks').within(() => {
cy.contains(diskName).should('not.exist');
});
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('linode storage tab', () => {
cy.wait('@resizeDisk').its('response.statusCode').should('eq', 200);
ui.toast.assertMessage('Disk queued for resizing.');
// cy.findByText('Resizing', { exact: false }).should('be.visible');
ui.toast.assertMessage(`Disk ${diskName} resized successfully.`);
ui.toast.assertMessage(`Disk ${diskName} successfully resized.`);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('resize linode', () => {
});

// Wait until the disk resize is done.
ui.toast.assertMessage(`Disk ${diskName} resized successfully.`);
ui.toast.assertMessage(`Disk ${diskName} successfully resized.`);

cy.intercept(
'POST',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export const RemoveDeviceDialog = React.memo((props: Props) => {

const onDelete = async () => {
await mutateAsync();
enqueueSnackbar(`Device ${device?.entity.label} successfully removed`, {
variant: 'success',
});

if (error) {
enqueueSnackbar(error[0].reason, { variant: 'error' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Typography } from 'src/components/Typography';
import { useUpdateFirewallRulesMutation } from 'src/queries/firewalls';
import { getAPIErrorOrDefault } from 'src/utilities/errorUtils';

import { useSnackbar } from 'notistack';

import { FirewallRuleDrawer } from './FirewallRuleDrawer';
import { FirewallRuleTable } from './FirewallRuleTable';
import {
Expand Down Expand Up @@ -49,6 +51,8 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
firewallID
);

const { enqueueSnackbar } = useSnackbar();

/**
* inbound and outbound policy aren't part of any particular rule
* so they are managed separately rather than through the reducer.
Expand Down Expand Up @@ -191,6 +195,9 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
// Reset editor state.
inboundDispatch({ rules: _rules.inbound ?? [], type: 'RESET' });
outboundDispatch({ rules: _rules.outbound ?? [], type: 'RESET' });
enqueueSnackbar('Firewall rules successfully updated', {
variant: 'success',
});
})
.catch((err) => {
setSubmitting(false);
Expand Down Expand Up @@ -218,6 +225,9 @@ export const FirewallRulesLanding = React.memo((props: Props) => {
});
}
}
enqueueSnackbar('Failed to update Firewall rules', {
variant: 'error',
});
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useSnackbar } from 'notistack';
import * as React from 'react';

import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
Expand All @@ -16,6 +17,8 @@ interface Props {
}

export const FirewallDialog = React.memo((props: Props) => {
const { enqueueSnackbar } = useSnackbar();

const {
mode,
onClose,
Expand Down Expand Up @@ -55,6 +58,9 @@ export const FirewallDialog = React.memo((props: Props) => {

const onSubmit = async () => {
await requestMap[mode]();
enqueueSnackbar(`Firewall ${label} successfully ${mode}d`, {
variant: 'success',
});
onClose();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export const DeleteConfigDialog = (props: Props) => {

const onDelete = async () => {
await mutateAsync();
enqueueSnackbar('Successfully deleted config', { variant: 'success' });
enqueueSnackbar(`Configuration ${config?.label} successfully deleted`, {
variant: 'success',
});
onClose();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { APIError } from '@linode/api-v4/lib/types';
import Grid from '@mui/material/Unstable_Grid2';
import { styled, useTheme } from '@mui/material/styles';
import { useFormik } from 'formik';
import { useSnackbar } from 'notistack';
import { equals, pathOr, repeat } from 'ramda';
import * as React from 'react';
import { useQueryClient } from 'react-query';
Expand Down Expand Up @@ -195,6 +196,8 @@ export const LinodeConfigDialog = (props: Props) => {

const { data: linode } = useLinodeQuery(linodeId, open);

const { enqueueSnackbar } = useSnackbar();

const {
data: kernels,
error: kernelsError,
Expand Down Expand Up @@ -317,6 +320,7 @@ export const LinodeConfigDialog = (props: Props) => {
delete configData.interfaces;
}

const actionType = Boolean(config) ? 'updated' : 'created';
const handleSuccess = () => {
formik.setSubmitting(false);
queryClient.invalidateQueries(['linode', 'configs', props.linodeId]);
Expand All @@ -328,6 +332,13 @@ export const LinodeConfigDialog = (props: Props) => {
) {
queryClient.invalidateQueries('vlans');
}

enqueueSnackbar(
`Configuration ${configData.label} successfully ${actionType}`,
{
variant: 'success',
}
);
onClose();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const baseApps = {
'401697': 'WordPress - Latest One-Click',
'401698': 'Drupal - Latest One-Click',
'401699': 'Ark - Latest One-Click',
'401700': 'CS:GO - Latest One-Click',
// '401700': 'CS:GO - Latest One-Click', // CS:GO app is defunct because the sequel is out
'401701': 'LAMP One-Click',
'401702': 'MERN One-Click',
'401703': 'Rust - Latest One-Click',
Expand Down Expand Up @@ -115,9 +115,8 @@ export const baseApps = {
'1008125': 'Easypanel',
'1017300': 'Kali Linux',
'1037036': 'Budibase',
// uncomment clusters after marketplace release
// '1226544': 'HashiCorp Nomad Cluster',
// '1226545': 'HashiCorp Nomad Clients Cluster',
'1226544': 'HashiCorp Nomad Cluster',
'1226545': 'HashiCorp Nomad Clients Cluster',
'1037037': 'HashiCorp Nomad',
'1037038': 'HashiCorp Vault',
'1051714': 'Microweber',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const ToastNotifications = () => {
'https://www.linode.com/docs/products/tools/images/#technical-specifications'
),
persistFailureMessage: true,
successMessage: `Image ${secondaryLabel} created successfully.`,
successMessage: `Image ${secondaryLabel} successfully created.`,
});
case 'disk_resize':
return toastSuccessAndFailure({
Expand All @@ -134,7 +134,7 @@ export const ToastNotifications = () => {
)
),
persistFailureMessage: true,
successMessage: `Disk ${secondaryLabel} resized successfully.`,
successMessage: `Disk ${secondaryLabel} successfully resized.`,
});
case 'image_upload':
const isDeletion = event.message === 'Upload canceled.';
Expand All @@ -155,7 +155,7 @@ export const ToastNotifications = () => {
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error deleting Image ${label}.`,
successMessage: `Image ${label} deleted successfully.`,
successMessage: `Image ${label} successfully deleted.`,
});
case 'disk_delete':
return toastSuccessAndFailure({
Expand All @@ -164,7 +164,7 @@ export const ToastNotifications = () => {
failureMessage: `Unable to delete disk ${secondaryLabel} ${
label ? ` on ${label}` : ''
}. Is it attached to a configuration profile that is in use?`,
successMessage: `Disk ${secondaryLabel} deleted successfully.`,
successMessage: `Disk ${secondaryLabel} successfully deleted.`,
});
case 'linode_snapshot':
return toastSuccessAndFailure({
Expand Down Expand Up @@ -193,69 +193,27 @@ export const ToastNotifications = () => {
* We don't know if it's possible for these to fail,
* but are including handling to be safe.
*/
case 'linode_config_delete':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error deleting config ${secondaryLabel}.`,
});
case 'linode_config_create':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error creating config ${secondaryLabel}.`,
});
case 'linode_clone':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error cloning Linode ${label}.`,
successMessage: `Linode ${label} has been cloned successfully to ${secondaryLabel}.`,
successMessage: `Linode ${label} successfully cloned to ${secondaryLabel}.`,
});
case 'linode_migrate_datacenter':
case 'linode_migrate':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error migrating Linode ${label}.`,
successMessage: `Linode ${label} has been migrated successfully.`,
successMessage: `Linode ${label} successfully migrated.`,
});
case 'linode_resize':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error resizing Linode ${label}.`,
successMessage: `Linode ${label} has been resized successfully.`,
});
case 'firewall_enable':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error enabling Firewall ${label}.`,
});
case 'firewall_disable':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error disabling Firewall ${label}.`,
});
case 'firewall_delete':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error deleting Firewall ${label}.`,
});
case 'firewall_device_add':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error adding ${secondaryLabel} to Firewall ${label}.`,
});
case 'firewall_device_remove':
return toastSuccessAndFailure({
enqueueSnackbar,
eventStatus: event.status,
failureMessage: `Error removing ${secondaryLabel} from Firewall ${label}.`,
successMessage: `Linode ${label} successfully resized.`,
});
case 'longviewclient_create':
return toastSuccessAndFailure({
Expand Down

0 comments on commit 56ee34f

Please sign in to comment.