Skip to content
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

refactor: [M3-6343] - MUI v5 Migration - Grid v2 for Features #8985

Merged
merged 21 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions packages/manager/src/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Logo from 'src/assets/logo/akamai-logo.svg';
import Box from 'src/components/core/Box';
import { makeStyles, withTheme, WithTheme } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import MainContentBanner from 'src/components/MainContentBanner';
import { MaintenanceScreen } from 'src/components/MaintenanceScreen';
import NotFound from 'src/components/NotFound';
Expand Down Expand Up @@ -316,7 +316,7 @@ const MainContent: React.FC<CombinedProps> = (props) => {
role="main"
>
<Grid container spacing={0} className={classes.grid}>
<Grid item className={`${classes.switchWrapper} p0`}>
<Grid className={`${classes.switchWrapper} p0`}>
<GlobalNotifications />
<React.Suspense fallback={<SuspenseLoader />}>
<Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const useStyles = makeStyles((theme: Theme) => ({
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
padding: `10px 16px !important`,
padding: `7px 16px !important`, // This will be taken care of during refactor
},
footerBorder: {
borderTop: `1px solid ${theme.borderColors.borderTable}`,
Expand Down
7 changes: 3 additions & 4 deletions packages/manager/src/components/Notice/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { makeStyles } from 'tss-react/mui';
import { withTheme, WithTheme } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography, { TypographyProps } from 'src/components/core/Typography';
import Grid, { GridProps } from 'src/components/Grid';
import Grid, { Grid2Props } from '@mui/material/Unstable_Grid2';
import { SxProps } from '@mui/system';

export const useStyles = makeStyles<
Expand Down Expand Up @@ -112,7 +112,7 @@ export const useStyles = makeStyles<
},
}));

export interface Props extends GridProps {
export interface Props extends Grid2Props {
text?: string;
error?: boolean;
errorGroup?: string;
Expand Down Expand Up @@ -202,7 +202,6 @@ const Notice: React.FC<CombinedProps> = (props) => {

return (
<Grid
item
className={cx({
[classes.root]: true,
[classes.important]: important,
Expand All @@ -229,7 +228,7 @@ const Notice: React.FC<CombinedProps> = (props) => {
sx={sx}
>
{flag && (
<Grid item>
<Grid>
<Flag className={classes.flag} />
</Grid>
)}
Expand Down
12 changes: 6 additions & 6 deletions packages/manager/src/features/Account/AutoBackups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Theme } from '@mui/material/styles';
import * as React from 'react';
import Accordion from 'src/components/Accordion';
import FormControlLabel from 'src/components/core/FormControlLabel';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import Notice from 'src/components/Notice';
import OpenInNew from '@mui/icons-material/OpenInNew';
import Toggle from 'src/components/Toggle';
Expand Down Expand Up @@ -46,8 +46,8 @@ const AutoBackups = (props: Props) => {

return (
<Accordion heading="Backup Auto Enrollment" defaultExpanded={true}>
<Grid container direction="column">
<Grid item>
<Grid container direction="column" spacing={2}>
<Grid>
{!!isManagedCustomer ? (
<Notice success spacingBottom={20}>
You&rsquo;re a Managed customer, which means your Linodes are
Expand All @@ -72,8 +72,8 @@ const AutoBackups = (props: Props) => {
.
</Typography>
</Grid>
<Grid item container direction="row" alignItems="center">
<Grid item>
<Grid container direction="row" alignItems="center">
<Grid>
<FormControlLabel
control={
<Toggle
Expand All @@ -92,7 +92,7 @@ const AutoBackups = (props: Props) => {
</Grid>
</Grid>
{!isManagedCustomer && !backups_enabled && hasLinodesWithoutBackups && (
<Grid item>
<Grid>
<Typography variant="body1" className={classes.footnote}>
For existing Linodes without backups,&nbsp;
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Accordion from 'src/components/Accordion';
import Button from 'src/components/Button';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import CloseAccountDialog from './CloseAccountDialog';

const CloseAccountSetting = () => {
Expand All @@ -11,7 +11,7 @@ const CloseAccountSetting = () => {
<>
<Accordion heading="Close Account" defaultExpanded={true}>
<Grid container direction="column">
<Grid item>
<Grid>
<Button buttonType="outlined" onClick={() => setDialogOpen(true)}>
Close Account
</Button>
Expand Down
8 changes: 4 additions & 4 deletions packages/manager/src/features/Account/EnableManaged.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Button from 'src/components/Button';
import ConfirmationDialog from 'src/components/ConfirmationDialog';
import Typography from 'src/components/core/Typography';
import ExternalLink from 'src/components/ExternalLink';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import SupportLink from 'src/components/SupportLink';
import withLinodes, {
DispatchProps,
Expand Down Expand Up @@ -43,8 +43,8 @@ export const ManagedContent = (props: ContentProps) => {
}

return (
<Grid container direction="column">
<Grid item>
<Grid container direction="column" spacing={2}>
<Grid>
<Typography variant="body1">
Linode Managed includes Backups, Longview Pro, cPanel, and
round-the-clock monitoring to help keep your systems up and running.
Expand All @@ -56,7 +56,7 @@ export const ManagedContent = (props: ContentProps) => {
/>
</Typography>
</Grid>
<Grid item>
<Grid>
<Button buttonType="outlined" onClick={openConfirmationModal}>
Add Linode Managed
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Notice from 'src/components/Notice';
import TypeToConfirm from 'src/components/TypeToConfirm';
import Typography from 'src/components/core/Typography';
import ExternalLink from 'src/components/ExternalLink';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import { updateAccountSettingsData } from 'src/queries/accountSettings';
import { usePreferences } from 'src/queries/preferences';
import { useProfile } from 'src/queries/profile';
Expand All @@ -31,15 +31,15 @@ export const ObjectStorageContent = (props: ContentProps) => {

if (object_storage !== 'disabled') {
return (
<Grid container direction="column">
<Grid item>
<Grid container direction="column" spacing={2}>
<Grid>
<Typography variant="body1">
Object Storage is enabled on your account. Upon cancellation, all
Object Storage Access Keys will be revoked, all buckets will be
removed, and their objects deleted.
</Typography>
</Grid>
<Grid item>
<Grid>
<Button
data-testid="open-dialog-button"
buttonType="outlined"
Expand Down
10 changes: 5 additions & 5 deletions packages/manager/src/features/Account/NetworkHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import FormControlLabel from 'src/components/core/FormControlLabel';
import Typography from 'src/components/core/Typography';
import Accordion from 'src/components/Accordion';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import Toggle from 'src/components/Toggle';

interface Props {
Expand All @@ -13,15 +13,15 @@ interface Props {
const NetworkHelper = ({ onChange, networkHelperEnabled }: Props) => {
return (
<Accordion heading="Network Helper" defaultExpanded={true}>
<Grid container direction="column">
<Grid item>
<Grid container direction="column" spacing={2}>
<Grid>
<Typography variant="body1">
Network Helper automatically deposits a static networking
configuration into your Linode at boot.
</Typography>
</Grid>
<Grid item container direction="row" alignItems="center">
<Grid item>
<Grid container direction="row" alignItems="center">
<Grid>
<FormControlLabel
control={
<Toggle
Expand Down
59 changes: 23 additions & 36 deletions packages/manager/src/features/Backups/AutoEnroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { createStyles, withStyles, WithStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
import ExternalLink from 'src/components/ExternalLink';
import Grid from 'src/components/Grid';
import Notice from 'src/components/Notice';
import Toggle from 'src/components/Toggle';

Expand Down Expand Up @@ -45,42 +44,30 @@ export const AutoEnroll: React.FC<CombinedProps> = (props) => {

return (
<Paper className={classes.root}>
{error && (
<Grid item>
<Notice error text={error} />
</Grid>
)}
<Grid container direction="row" wrap="nowrap">
<Grid item>
<FormControlLabel
className={classes.toggleLabel}
control={
<Toggle
checked={enabled}
onChange={toggle}
data-qa-enable-toggle
/>
}
label={
<div className={classes.toggleLabelText}>
<Typography className={classes.header}>
Auto Enroll All New Linodes in Backups
</Typography>
<Typography variant="body1">
{`Enroll all future Linodes in backups. Your account will be billed
{error && <Notice error text={error} />}
<FormControlLabel
className={classes.toggleLabel}
control={
<Toggle checked={enabled} onChange={toggle} data-qa-enable-toggle />
}
label={
<div className={classes.toggleLabelText}>
<Typography className={classes.header}>
Auto Enroll All New Linodes in Backups
</Typography>
<Typography variant="body1">
{`Enroll all future Linodes in backups. Your account will be billed
the additional hourly rate noted on the `}
<ExternalLink
data-qa-backups-price
fixedIcon
link="https://www.linode.com/backups"
text="Backups pricing page"
/>
</Typography>
</div>
}
/>
</Grid>
</Grid>
<ExternalLink
data-qa-backups-price
fixedIcon
link="https://www.linode.com/backups"
text="Backups pricing page"
/>
</Typography>
</div>
}
/>
</Paper>
);
};
Expand Down
16 changes: 8 additions & 8 deletions packages/manager/src/features/Backups/BackupDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Button from 'src/components/Button';
import Typography from 'src/components/core/Typography';
import DisplayPrice from 'src/components/DisplayPrice';
import Drawer from 'src/components/Drawer';
import Grid from 'src/components/Grid';
import Grid from '@mui/material/Unstable_Grid2';
import Link from 'src/components/Link';
import Notice from 'src/components/Notice';
import {
Expand Down Expand Up @@ -166,8 +166,8 @@ export class BackupDrawer extends React.Component<CombinedProps, {}> {
const linodeCount = extendedLinodes.length;
return (
<Drawer title="Enable All Backups" open={open} onClose={close}>
<Grid container direction={'column'}>
<Grid item>
<Grid container direction={'column'} spacing={2}>
<Grid>
<Typography variant="body1">
Three backup slots are executed and rotated automatically: a daily
backup, a 2-7 day old backup, and an 8-14 day old backup. See our
Expand All @@ -186,29 +186,29 @@ export class BackupDrawer extends React.Component<CombinedProps, {}> {
</Typography>
</Grid>
{enableErrors && !isEmpty(enableErrors) && (
<Grid item data-testid={'result-notice'}>
<Grid data-testid={'result-notice'}>
<Notice error spacingBottom={0}>
{getFailureNotificationText(updatedCount, enableErrors.length)}
</Notice>
</Grid>
)}
{/* Don't show this if the setting is already active. */}
{!accountBackups && (
<Grid item>
<Grid>
<AutoEnroll
enabled={autoEnroll}
error={autoEnrollError}
toggle={toggle}
/>
</Grid>
)}
<Grid item>
<Grid>
<DisplayPrice
price={getTotalPrice(extendedLinodes)}
interval="mo"
/>
</Grid>
<Grid item>
<Grid>
<ActionsPanel style={{ padding: 0, margin: 0 }}>
<Button
onClick={close}
Expand All @@ -230,7 +230,7 @@ export class BackupDrawer extends React.Component<CombinedProps, {}> {
</Button>
</ActionsPanel>
</Grid>
<Grid item>
<Grid>
<BackupsTable linodes={extendedLinodes} loading={loading} />
</Grid>
</Grid>
Expand Down
Loading