Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10254-fixed-1709590335168.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Persisting error messages in ACLB delete dialogs ([#10254](https://github.com/linode/manager/pull/10254))
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ export const DeleteCertificateDialog = (props: Props) => {
error,
isLoading,
mutateAsync,
reset,
} = useLoadBalancerCertificateDeleteMutation(
loadbalancerId,
certificate?.id ?? -1
);

const onDelete = async () => {
await mutateAsync();
const handleClose = () => {
// Clear the error when the dialog closes so that is does not persist
reset();
onClose();
};

const onDelete = async () => {
try {
await mutateAsync();
handleClose();
} catch (error) {
// Swallow error
}
};

return (
<ConfirmationDialog
actions={
Expand All @@ -41,12 +52,12 @@ export const DeleteCertificateDialog = (props: Props) => {
}}
secondaryButtonProps={{
label: 'Cancel',
onClick: onClose,
onClick: handleClose,
}}
/>
}
error={error?.[0]?.reason}
onClose={onClose}
onClose={handleClose}
open={open}
title={`Delete Certificate ${certificate?.label}?`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ export const DeleteConfigurationDialog = (props: Props) => {
error,
isLoading,
mutateAsync,
reset,
} = useLoadBalancerConfigurationDeleteMutation(
loadbalancerId,
configuration.id
);

const onDelete = async () => {
await mutateAsync();
const handleClose = () => {
// Clear the error when the dialog closes so that is does not persist
reset();
onClose();
};

const onDelete = async () => {
try {
await mutateAsync();
handleClose();
} catch (error) {
// Swallow error
}
};

return (
<ConfirmationDialog
actions={
Expand All @@ -41,12 +52,12 @@ export const DeleteConfigurationDialog = (props: Props) => {
}}
secondaryButtonProps={{
label: 'Cancel',
onClick: onClose,
onClick: handleClose,
}}
/>
}
error={error?.[0]?.reason}
onClose={onClose}
onClose={handleClose}
open={open}
title={`Delete Configuration ${configuration.label}?`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@ interface Props {
export const DeleteRouteDialog = (props: Props) => {
const { loadbalancerId, onClose, open, route } = props;

const { error, isLoading, mutateAsync } = useLoadBalancerRouteDeleteMutation(
loadbalancerId,
route?.id ?? -1
);
const {
error,
isLoading,
mutateAsync,
reset,
} = useLoadBalancerRouteDeleteMutation(loadbalancerId, route?.id ?? -1);

const onDelete = async () => {
await mutateAsync();
const handleClose = () => {
// Clear the error when the dialog closes so that is does not persist
reset();
onClose();
};

const onDelete = async () => {
try {
await mutateAsync();
handleClose();
} catch (error) {
// Swallow error
}
};

return (
<ConfirmationDialog
actions={
Expand All @@ -37,12 +49,12 @@ export const DeleteRouteDialog = (props: Props) => {
}}
secondaryButtonProps={{
label: 'Cancel',
onClick: onClose,
onClick: handleClose,
}}
/>
}
error={error?.[0]?.reason}
onClose={onClose}
onClose={handleClose}
open={open}
title={`Delete Route ${route?.label}?`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ interface Props {
export const DeleteRuleDialog = (props: Props) => {
const { loadbalancerId, onClose, open, route, ruleIndex } = props;

const { error, isLoading, mutateAsync } = useLoadBalancerRouteUpdateMutation(
loadbalancerId,
route?.id ?? -1
);
const {
error,
isLoading,
mutateAsync,
reset,
} = useLoadBalancerRouteUpdateMutation(loadbalancerId, route?.id ?? -1);

const handleClose = () => {
// Clear the error when the dialog closes so that is does not persist
reset();
onClose();
};

const onDelete = async () => {
if (!route || ruleIndex === undefined) {
Expand All @@ -35,12 +43,16 @@ export const DeleteRuleDialog = (props: Props) => {

const normalizedRules = newRules.map(getNormalizedRulePayload);

await mutateAsync({
label: route.label,
protocol: route.protocol,
rules: normalizedRules,
});
onClose();
try {
await mutateAsync({
label: route.label,
protocol: route.protocol,
rules: normalizedRules,
});
handleClose();
} catch (error) {
// Swallow error
}
};

return (
Expand All @@ -54,12 +66,12 @@ export const DeleteRuleDialog = (props: Props) => {
}}
secondaryButtonProps={{
label: 'Cancel',
onClick: onClose,
onClick: handleClose,
}}
/>
}
error={error?.[0]?.reason}
onClose={onClose}
onClose={handleClose}
open={open}
title="Delete Rule?"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,27 @@ export const DeleteServiceTargetDialog = (props: Props) => {
error,
isLoading,
mutateAsync,
reset,
} = useLoadBalancerServiceTargetDeleteMutation(
loadbalancerId,
serviceTarget?.id ?? -1
);

const onDelete = async () => {
await mutateAsync();
const handleClose = () => {
// Clear the error when the dialog closes so that is does not persist
reset();
onClose();
};

const onDelete = async () => {
try {
await mutateAsync();
handleClose();
} catch (error) {
// Swallow error
}
};

return (
<ConfirmationDialog
actions={
Expand All @@ -40,12 +51,12 @@ export const DeleteServiceTargetDialog = (props: Props) => {
}}
secondaryButtonProps={{
label: 'Cancel',
onClick: onClose,
onClick: handleClose,
}}
/>
}
error={error?.[0]?.reason}
onClose={onClose}
onClose={handleClose}
open={open}
title={`Delete Service Target ${serviceTarget?.label}?`}
>
Expand Down