Skip to content

Commit 8a7101e

Browse files
hotfix: [M3-10688] - Add ability to enter migration queue (#13016)
* hotfix: [M3-10688] - Add ability to enter migration queue * Bump version and changelog --------- Co-authored-by: Jaalah Ramos <[email protected]>
1 parent a8d763e commit 8a7101e

File tree

4 files changed

+121
-35
lines changed

4 files changed

+121
-35
lines changed

packages/manager/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [2025-10-24] - v1.153.2
8+
9+
### Fixed:
10+
11+
- Add self-service maintenance action in LinodeMaintenanceBanner for power_off_on and include all maintenance types in dev tools preset. ([#13016](https://github.com/linode/manager/pull/13016))
712

813
## [2025-10-22] - v1.153.1
914

packages/manager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "linode-manager",
33
"author": "Linode",
44
"description": "The Linode Manager website",
5-
"version": "1.153.1",
5+
"version": "1.153.2",
66
"private": true,
77
"type": "module",
88
"bugs": {
Lines changed: 112 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import { scheduleOrQueueMigration } from '@linode/api-v4/lib/linodes';
12
import { useAllAccountMaintenanceQuery } from '@linode/queries';
2-
import { Notice, Typography } from '@linode/ui';
3+
import { ActionsPanel, LinkButton, Notice, Typography } from '@linode/ui';
4+
import { useDialog } from '@linode/utilities';
5+
import { useSnackbar } from 'notistack';
36
import React from 'react';
47

58
import { PENDING_MAINTENANCE_FILTER } from 'src/features/Account/Maintenance/utilities';
69
import { isPlatformMaintenance } from 'src/hooks/usePlatformMaintenance';
710

11+
import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog';
812
import { DateTimeDisplay } from '../DateTimeDisplay';
913
import { Link } from '../Link';
1014

@@ -13,6 +17,7 @@ interface Props {
1317
}
1418

1519
export const LinodeMaintenanceBanner = ({ linodeId }: Props) => {
20+
const { enqueueSnackbar } = useSnackbar();
1621
const { data: allMaintenance } = useAllAccountMaintenanceQuery(
1722
{},
1823
PENDING_MAINTENANCE_FILTER,
@@ -31,45 +36,118 @@ export const LinodeMaintenanceBanner = ({ linodeId }: Props) => {
3136
const maintenanceStartTime =
3237
linodeMaintenance?.start_time || linodeMaintenance?.when;
3338

39+
const { closeDialog, dialog, handleError, openDialog, submitDialog } =
40+
useDialog<number>((id: number) => scheduleOrQueueMigration(id));
41+
42+
const isScheduled = Boolean(maintenanceStartTime);
43+
44+
const actionLabel = isScheduled
45+
? 'enter the migration queue'
46+
: 'schedule your migration';
47+
const showMigrateAction =
48+
linodeId !== undefined && linodeMaintenance?.type === 'power_off_on';
49+
50+
const onSubmit = () => {
51+
if (!linodeId) {
52+
return;
53+
}
54+
submitDialog(linodeId)
55+
.then(() => {
56+
const successMessage = isScheduled
57+
? 'Your Linode has been entered into the migration queue.'
58+
: 'Your migration has been scheduled.';
59+
enqueueSnackbar(successMessage, { variant: 'success' });
60+
})
61+
.catch(() => {
62+
const errorMessage = isScheduled
63+
? 'An error occurred entering the migration queue.'
64+
: 'An error occurred scheduling your migration.';
65+
handleError(errorMessage);
66+
});
67+
};
68+
69+
const actions = () => (
70+
<ActionsPanel
71+
primaryButtonProps={{
72+
label: actionLabel,
73+
loading: dialog.isLoading,
74+
onClick: onSubmit,
75+
}}
76+
secondaryButtonProps={{
77+
'data-testid': 'cancel',
78+
label: 'Cancel',
79+
onClick: closeDialog,
80+
}}
81+
/>
82+
);
83+
3484
if (!linodeMaintenance) return null;
3585

3686
return (
37-
<Notice data-qa-maintenance-banner="true" variant="warning">
38-
<Typography>
39-
Linode {linodeMaintenance.entity.label} {linodeMaintenance.description}{' '}
40-
maintenance {maintenanceTypeLabel} will begin{' '}
41-
<strong>
42-
{maintenanceStartTime ? (
87+
<>
88+
<Notice data-qa-maintenance-banner="true" variant="warning">
89+
<Typography>
90+
Linode {linodeMaintenance.entity.label}{' '}
91+
{linodeMaintenance.description} maintenance {maintenanceTypeLabel}{' '}
92+
will begin{' '}
93+
<strong>
94+
{maintenanceStartTime ? (
95+
<>
96+
<DateTimeDisplay
97+
format="MM/dd/yyyy"
98+
sx={(theme) => ({
99+
font: theme.font.bold,
100+
})}
101+
value={maintenanceStartTime}
102+
/>{' '}
103+
at{' '}
104+
<DateTimeDisplay
105+
format="HH:mm"
106+
sx={(theme) => ({
107+
font: theme.font.bold,
108+
})}
109+
value={maintenanceStartTime}
110+
/>
111+
</>
112+
) : (
113+
'soon'
114+
)}
115+
</strong>
116+
. For more details, view{' '}
117+
<Link
118+
pendoId="linode-maintenance-banner-link"
119+
to="/account/maintenance"
120+
>
121+
Account Maintenance
122+
</Link>
123+
{showMigrateAction ? (
43124
<>
44-
<DateTimeDisplay
45-
format="MM/dd/yyyy"
46-
sx={(theme) => ({
47-
font: theme.font.bold,
48-
})}
49-
value={maintenanceStartTime}
50-
/>{' '}
51-
at{' '}
52-
<DateTimeDisplay
53-
format="HH:mm"
54-
sx={(theme) => ({
55-
font: theme.font.bold,
56-
})}
57-
value={maintenanceStartTime}
58-
/>
125+
{' or '}
126+
<LinkButton onClick={() => openDialog(linodeId)}>
127+
{actionLabel}
128+
</LinkButton>
129+
{' now.'}
59130
</>
60131
) : (
61-
'soon'
132+
'.'
62133
)}
63-
</strong>
64-
. For more details, view{' '}
65-
<Link
66-
pendoId="linode-maintenance-banner-link"
67-
to="/account/maintenance"
68-
>
69-
Account Maintenance
70-
</Link>
71-
.
72-
</Typography>
73-
</Notice>
134+
</Typography>
135+
</Notice>
136+
<ConfirmationDialog
137+
actions={actions}
138+
error={dialog.error}
139+
onClose={() => closeDialog()}
140+
open={dialog.isOpen}
141+
title="Confirm Migration"
142+
>
143+
<Typography variant="subtitle1">
144+
Are you sure you want to{' '}
145+
{isScheduled
146+
? 'enter the migration queue now'
147+
: 'schedule your migration now'}
148+
?
149+
</Typography>
150+
</ConfirmationDialog>
151+
</>
74152
);
75153
};

packages/manager/src/dev-tools/components/ExtraPresetMaintenance.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ const renderMaintenanceFields = (
109109
<option value="reboot">Reboot</option>
110110
<option value="cold_migration">Cold Migration</option>
111111
<option value="live_migration">Live Migration</option>
112+
<option value="migrate">Migrate</option>
113+
<option value="power_off_on">Power Off / On</option>
114+
<option value="volume_migration">Volume Migration</option>
112115
</select>
113116
</label>,
114117

0 commit comments

Comments
 (0)