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-6934] MUI v5 Migration - SRC > Features > Linodes pt 1 #9445

Merged
merged 25 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
87bba47
refactor [m3-6272] begin using codemod
coliu-akamai Jul 21, 2023
5a61e91
refactor [m3-6272] continue switching to tss react
coliu-akamai Jul 21, 2023
26e2d4b
codemod to LinodesDetail
coliu-akamai Jul 21, 2023
558b9e7
Merge branch 'develop' into refactor-m3-6272
coliu-akamai Jul 21, 2023
fda1f34
refactor [m3-6272] migrate linode create styles
coliu-akamai Jul 24, 2023
0a5553e
IPAddress test difficulties
coliu-akamai Jul 24, 2023
a1b0cd5
Merge branch 'develop' into refactor-m3-6272
coliu-akamai Jul 25, 2023
508e2de
fix some styling
coliu-akamai Jul 25, 2023
93e1f92
some more ip styling but some weird things going on
coliu-akamai Jul 25, 2023
7b31274
narrowing down a source of styling pain
coliu-akamai Jul 25, 2023
3f8e525
need to look into this IP test
coliu-akamai Jul 26, 2023
0f8f00a
testing ip address
coliu-akamai Jul 26, 2023
02b2cfe
converting to styled components or sx
coliu-akamai Jul 26, 2023
b36d99e
more style conversions
coliu-akamai Jul 26, 2023
5e3bd69
Improve linode ip address tooltip
jaalah Jul 27, 2023
3c5ab0c
Merge branch 'refactor-m3-6272' of github.com:coliu-akamai/manager in…
jaalah Jul 27, 2023
a9d9175
Fix focus
jaalah Jul 27, 2023
7b75cc2
rest of styling
coliu-akamai Jul 27, 2023
44144ef
it was not the last of styling
coliu-akamai Jul 27, 2023
97fe9f6
Merge branch 'develop' into refactor-m3-6272
coliu-akamai Jul 28, 2023
bd1d8ac
cleanup of styling
coliu-akamai Jul 28, 2023
e54529a
fix up styling
coliu-akamai Jul 28, 2023
7dfcb53
Added changeset: MUI v5 Migration > SRC > Features > Linodes Pt 1
coliu-akamai Jul 28, 2023
2c32c49
all styles converted(except one file, see pr comment), for real this …
coliu-akamai Jul 31, 2023
a9a1964
Merge branch 'develop' into refactor-m3-6272
coliu-akamai Aug 1, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
} from '@linode/api-v4/lib/linodes';
import { APIError } from '@linode/api-v4/lib/types';
import Grid from '@mui/material/Unstable_Grid2';
import { Theme } from '@mui/material/styles';
import { makeStyles } from '@mui/styles';
import { styled, useTheme } from '@mui/material/styles';
import { castDraft } from 'immer';
import { intersection, pathOr } from 'ramda';
import * as React from 'react';
Expand Down Expand Up @@ -51,36 +50,12 @@ const LinodesDetailHeader = React.lazy(
() => import('../LinodesDetail/LinodesDetailHeader/LinodeDetailHeader')
);

const useStyles = makeStyles((theme: Theme) => ({
appBar: {
'& > div': {
marginTop: 0,
},
},
diskContainer: {
marginTop: theme.spacing(4),
},
outerContainer: {
paddingBottom: theme.spacing(2),
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
},
paper: {
padding: `${theme.spacing(3)} ${theme.spacing(3)} 0`,
},
root: {
marginTop: theme.spacing(1),
},
title: {
marginBottom: theme.spacing(2),
},
}));

const CloneLanding = () => {
const { linodeId: _linodeId } = useParams<{ linodeId: string }>();
const history = useHistory();
const match = useRouteMatch();
const location = useLocation();
const theme = useTheme();

const linodeId = Number(_linodeId);

Expand All @@ -89,8 +64,6 @@ const CloneLanding = () => {
const { data: linodes } = useAllLinodesQuery();
const { data: linode } = useLinodeQuery(linodeId);

const classes = useStyles();

const configs = _configs ?? [];
const disks = _disks ?? [];

Expand Down Expand Up @@ -289,12 +262,12 @@ const CloneLanding = () => {
<MutationNotification linodeId={linodeId} />
<Notifications />
<LinodesDetailHeader />
<Grid className={classes.root} container>
<Grid sx={{ marginTop: theme.spacing(1) }} container>
<Grid lg={9} md={8} xs={12}>
<Paper className={classes.paper}>
<Paper sx={{ padding: `${theme.spacing(3)} ${theme.spacing(3)} 0` }}>
<Typography
aria-level={2}
className={classes.title}
sx={{ marginBottom: theme.spacing(2) }}
data-qa-title
role="heading"
variant="h2"
Expand All @@ -312,34 +285,34 @@ const CloneLanding = () => {
<TabLinkList tabs={tabs} />
<TabPanels>
<SafeTabPanel index={0}>
<div className={classes.outerContainer}>
<StyledOuterDiv>
<Configs
// Cast the results of the Immer state to a mutable data structure.
configSelection={castDraft(state.configSelection)}
configs={configsInState}
handleSelect={toggleConfig}
/>
</div>
</StyledOuterDiv>
</SafeTabPanel>

<SafeTabPanel index={1}>
<div className={classes.outerContainer}>
<StyledOuterDiv>
<Typography>
You can make a copy of a disk to the same or different
Linode. We recommend you power off your Linode first, and
keep it powered off until the disk has finished being
cloned.
</Typography>
<div className={classes.diskContainer}>
<StyledDiskDiv>
<Disks
// Cast the results of the Immer state to a mutable data structure.
diskSelection={castDraft(state.diskSelection)}
disks={disksInState}
handleSelect={toggleDisk}
selectedConfigIds={selectedConfigIds}
/>
</div>
</div>
</StyledDiskDiv>
</StyledOuterDiv>
</SafeTabPanel>
</TabPanels>
</Tabs>
Expand Down Expand Up @@ -387,4 +360,18 @@ const CloneLanding = () => {
);
};

const StyledDiskDiv = styled('div', { label: 'StyledDiskDiv' })(
({ theme }) => ({
marginTop: theme.spacing(4),
})
);

const StyledOuterDiv = styled('div', { label: 'StyledOuterDiv' })(
({ theme }) => ({
paddingBottom: theme.spacing(2),
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
})
);

export default CloneLanding;
23 changes: 10 additions & 13 deletions packages/manager/src/features/Linodes/CloneLanding/Configs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Config } from '@linode/api-v4/lib/linodes';
import { makeStyles } from '@mui/styles';
import * as React from 'react';

import { Checkbox } from 'src/components/Checkbox';
Expand All @@ -13,15 +12,6 @@ import { TableRowEmpty } from 'src/components/TableRowEmpty/TableRowEmpty';

import { ConfigSelection } from './utilities';

const useStyles = makeStyles(() => ({
root: {
'& td': {
borderBottom: 'none',
paddingBottom: 0,
paddingTop: 0,
},
},
}));
export interface Props {
configSelection: ConfigSelection;
configs: Config[];
Expand All @@ -31,8 +21,6 @@ export interface Props {
export const Configs: React.FC<Props> = (props) => {
const { configSelection, configs, handleSelect } = props;

const classes = useStyles();

return (
<Paginate data={configs}>
{({
Expand All @@ -45,7 +33,16 @@ export const Configs: React.FC<Props> = (props) => {
}) => {
return (
<div>
<Table aria-label="List of Configurations" className={classes.root}>
<Table
aria-label="List of Configurations"
sx={{
'& td': {
borderBottom: 'none',
paddingBottom: 0,
paddingTop: 0,
},
}}
>
<TableBody>
{paginatedData.length === 0 ? (
<TableRowEmpty colSpan={1} />
Expand Down
Loading