Repository navigation
upcoming: [M3-9503] - Add New VM Host Maintenance Icons #12398
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
Changes from all commits
4199255
130b2c2
3bfe183
7c38144
57538fe
0eb27eb
3951780
598d569
f6af3ea
343f949
8e81e86
76e5780
f7c0eda
5f517fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Add new maintenance policy icons to linode rows ([#12398](https://github.com/linode/manager/pull/12398)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,12 @@ | ||
| import { useTypeQuery } from '@linode/queries'; | ||
| import { Tooltip, TooltipIcon, Typography } from '@linode/ui'; | ||
| import { | ||
| LoadFailureIcon as MaintenanceActiveIcon, | ||
| CalendarIcon as MaintenancePendingIcon, | ||
| CalendarScheduledIcon as MaintenanceScheduledIcon, | ||
| Tooltip, | ||
| TooltipIcon, | ||
| Typography, | ||
| } from '@linode/ui'; | ||
| import { Hidden } from '@linode/ui'; | ||
| import { formatStorageUnits, getFormattedStatus } from '@linode/utilities'; | ||
| import * as React from 'react'; | ||
|
|
@@ -32,6 +39,30 @@ import type { LinodeHandlers } from '../LinodesLanding'; | |
| import type { SxProps, Theme } from '@mui/material/styles'; | ||
| import type { LinodeWithMaintenance } from 'src/utilities/linodes'; | ||
|
|
||
| const statusTooltipIcons = { | ||
| scheduled: <MaintenanceScheduledIcon />, | ||
| active: <MaintenanceActiveIcon />, | ||
| pending: <MaintenancePendingIcon />, | ||
| }; | ||
|
|
||
| interface MaintenanceTextProps { | ||
| isOpened?: boolean; | ||
| maintenanceStartTime: string; | ||
| } | ||
|
|
||
| const MaintenanceText = ({ | ||
| isOpened = false, | ||
| maintenanceStartTime, | ||
| }: MaintenanceTextProps) => { | ||
| return ( | ||
| <> | ||
| This Linode’s maintenance window {isOpened ? 'opened' : 'opens'} at{' '} | ||
| {maintenanceStartTime} | ||
| {!isOpened && <>. For more information, see your open support tickets</>}. | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| interface Props extends LinodeWithMaintenance { | ||
| handlers: LinodeHandlers; | ||
| } | ||
|
|
@@ -61,22 +92,12 @@ export const LinodeRow = (props: Props) => { | |
|
|
||
| const isBareMetalInstance = linodeType?.class === 'metal'; | ||
|
|
||
| const loading = linodeInTransition(status, recentEvent); | ||
| const isTransitioning = linodeInTransition(status, recentEvent); | ||
|
|
||
| const parsedMaintenanceStartTime = parseMaintenanceStartTime( | ||
| maintenance?.when | ||
| maintenance?.start_time || maintenance?.when | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think @hkhalil-akamai left |
||
| ); | ||
|
|
||
| const MaintenanceText = () => { | ||
| return ( | ||
| <> | ||
| This Linode’s maintenance window opens at{' '} | ||
| {parsedMaintenanceStartTime}. For more information, see your{' '} | ||
| <Link to="/support/tickets/open">open support tickets.</Link> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| const iconStatus = getLinodeIconStatus(status); | ||
|
|
||
| const [isHovered, setIsHovered] = React.useState(false); | ||
|
|
@@ -89,6 +110,12 @@ export const LinodeRow = (props: Props) => { | |
| setIsHovered(false); | ||
| }, []); | ||
|
|
||
| const isPendingOrScheduled = | ||
| maintenance?.status === 'pending' || maintenance?.status === 'scheduled'; | ||
|
|
||
| const isInProgress = | ||
| maintenance?.status === 'started' || maintenance?.status === 'in-progress'; | ||
|
|
||
| return ( | ||
| <TableRow | ||
| data-qa-linode={label} | ||
|
|
@@ -105,36 +132,57 @@ export const LinodeRow = (props: Props) => { | |
| <StyledMaintenanceTableCell | ||
| data-qa-status | ||
| maintenance={Boolean(maintenance)} | ||
| noWrap | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're ok with table possibly scrolling |
||
| statusCell | ||
| > | ||
| {!maintenance ? ( | ||
| loading ? ( | ||
| <> | ||
| <StatusIcon status={iconStatus} /> | ||
| <StyledButton onClick={notificationContext.openMenu}> | ||
| <ProgressDisplay | ||
| progress={getProgressOrDefault(recentEvent)} | ||
| sx={{ display: 'inline-block' }} | ||
| text={transitionText(status, id, recentEvent)} | ||
| /> | ||
| </StyledButton> | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <StatusIcon status={iconStatus} /> | ||
| {getFormattedStatus(status)} | ||
| </> | ||
| ) | ||
| ) : ( | ||
| <div style={{ alignItems: 'center', display: 'flex' }}> | ||
| <strong>Maintenance Scheduled</strong> | ||
| <TooltipIcon | ||
| status="help" | ||
| sx={{ tooltip: { maxWidth: 300 } }} | ||
| text={<MaintenanceText />} | ||
| tooltipPosition="top" | ||
| <StatusIcon status={iconStatus} /> | ||
| {!isTransitioning && getFormattedStatus(status)} | ||
| {isTransitioning && ( | ||
| <StyledButton onClick={notificationContext.openMenu}> | ||
| <ProgressDisplay | ||
| progress={getProgressOrDefault(recentEvent)} | ||
| sx={{ display: 'inline-block' }} | ||
| text={transitionText(status, id, recentEvent)} | ||
| /> | ||
| </div> | ||
| </StyledButton> | ||
| )} | ||
| {isInProgress && ( | ||
| <TooltipIcon | ||
| className="ui-TooltipIcon ui-TooltipIcon-isActive" | ||
| icon={statusTooltipIcons.active} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit odd to me that in-progress is a red exclamation icon; makes it seem like the action errored out. Should we use the warning icon here instead? context: #12348
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe even use the in-progress spinning icon in the notification bell?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point - In this case it is "Emergency" maintenance hence the red color. UX did do a design permutation with the warning icon and based on review with PM and SA. They leaned towards an icon that represented "progress" in this case. I agree that there may be a better icon (perhaps the animated autorenew icon we use for events. Either way, I think this is something we can revisit during beta. |
||
| status="other" | ||
| sx={{ tooltip: { maxWidth: 300 } }} | ||
| text={ | ||
| <MaintenanceText | ||
| isOpened | ||
| maintenanceStartTime={parsedMaintenanceStartTime} | ||
| /> | ||
| } | ||
| tooltipPosition="top" | ||
| /> | ||
| )} | ||
| {isPendingOrScheduled && ( | ||
| <TooltipIcon | ||
| className="ui-TooltipIcon" | ||
| icon={ | ||
| maintenance.status === 'pending' | ||
| ? statusTooltipIcons.pending | ||
| : statusTooltipIcons.scheduled | ||
| } | ||
| status="other" | ||
| sx={{ tooltip: { maxWidth: 300 } }} | ||
| text={ | ||
| maintenance.status === 'pending' ? ( | ||
| "This Linode's maintenance window is pending." | ||
| ) : ( | ||
| <MaintenanceText | ||
| isOpened={false} | ||
| maintenanceStartTime={parsedMaintenanceStartTime} | ||
| /> | ||
| ) | ||
| } | ||
| tooltipPosition="top" | ||
| /> | ||
| )} | ||
| </StyledMaintenanceTableCell> | ||
| <Hidden smDown> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,12 +5,20 @@ import { useFlags } from 'src/hooks/useFlags'; | |
|
|
||
| import type { AccountMaintenance, Linode } from '@linode/api-v4'; | ||
|
|
||
| export interface Maintenance { | ||
| export interface LinodeMaintenance { | ||
| start_time: null | string; | ||
| status?: | ||
| | 'canceled' | ||
| | 'completed' | ||
| | 'in-progress' | ||
| | 'pending' | ||
| | 'scheduled' | ||
| | 'started'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding |
||
| when: null | string; | ||
| } | ||
|
|
||
| export interface LinodeWithMaintenance extends Linode { | ||
| maintenance?: Maintenance | null; | ||
| maintenance?: LinodeMaintenance | null; | ||
| } | ||
|
|
||
| export const addMaintenanceToLinodes = ( | ||
|
|
@@ -29,6 +37,8 @@ export const addMaintenanceToLinodes = ( | |
| ? { | ||
| ...thisLinode, | ||
| maintenance: { | ||
| start_time: foundMaintenance.start_time, | ||
| status: foundMaintenance.status, | ||
| when: foundMaintenance.when, | ||
| }, | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/ui": Upcoming Features | ||
| --- | ||
|
|
||
| Add new maintenance policy icons and update TooltipIcon tokens ([#12398](https://github.com/linode/manager/pull/12398)) |
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.
These maintenance styles are now controlled by
ui-TooltipIconin the theme