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

upcoming: [M3-7868] - Gecko Beta Demo feedback #10284

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Gecko Beta Demo feedback ([#10284](https://github.com/linode/manager/pull/10284))
3 changes: 2 additions & 1 deletion packages/manager/src/features/Images/ImageUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { APIError } from '@linode/api-v4/lib/types';
import { Theme } from '@mui/material/styles';
import { makeStyles } from 'tss-react/mui';
import * as React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { makeStyles } from 'tss-react/mui';

import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
import { Checkbox } from 'src/components/Checkbox';
Expand Down Expand Up @@ -275,6 +275,7 @@ export const ImageUpload: React.FC<Props> = (props) => {
errorText={errorMap.region}
handleSelection={setRegion}
label="Region"
regionFilter="core" // Images service will not be supported for Gecko Beta
regions={regions}
required
selectedId={region}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const AddonsPanel = React.memo((props: AddonsPanelProps) => {
</Typography>
{isEdgeRegionSelected && (
<Notice
text="Backups and Private IP are currently not available for Edge regions"
text="Backups and Private IP are currently not available for Edge regions."
variant="warning"
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const AddIPDrawer = (props: Props) => {
{linodeIsInEdgeRegion && (
<Notice
sx={{ fontSize: 15 }}
text="Private IP is currently not available for Edge regions"
text="Private IP is currently not available for Edge regions."
variant="warning"
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { API_MAX_PAGE_SIZE } from 'src/constants';
import { useLinodeVolumesQuery } from 'src/queries/volumes';

interface Props {
edgeRegionWarning?: string;
error?: string;
hasConfirmed: boolean;
linodeId: number | undefined;
Expand All @@ -19,19 +20,28 @@ interface Props {
}

export const CautionNotice = React.memo((props: Props) => {
const {
edgeRegionWarning,
error,
hasConfirmed,
linodeId,
metadataWarning,
migrationTimeInMins,
setConfirmed,
} = props;
const theme = useTheme();

// This is not great, but lets us get all of the volumes for a Linode while keeping
// the React Query store in a paginated shape. We want to keep data in a paginated shape
// because the event handler automatically updates stored paginated data.
// We can safely do this because linodes can't have more than 64 volumes.
const { data: volumesData } = useLinodeVolumesQuery(
props.linodeId ?? -1,
linodeId ?? -1,
{
page_size: API_MAX_PAGE_SIZE,
},
{},
props.linodeId !== undefined
linodeId !== undefined
);

const amountOfAttachedVolumes = volumesData?.results ?? 0;
Expand Down Expand Up @@ -89,20 +99,21 @@ export const CautionNotice = React.memo((props: Props) => {
<li>
When this migration begins, we estimate it will take approximately{' '}
{DateTime.local()
.plus({ minutes: props.migrationTimeInMins })
.plus({ minutes: migrationTimeInMins })
.toRelative()
?.replace('in', '')}{' '}
to complete.
</li>
{props.metadataWarning ? <li>{props.metadataWarning}</li> : null}
{metadataWarning && <li>{metadataWarning}</li>}
{edgeRegionWarning && <li>{edgeRegionWarning}</li>}
</ul>
{props.error && <Notice text={props.error} variant="error" />}
{error && <Notice text={error} variant="error" />}
<Checkbox
sx={{
marginLeft: theme.spacing(2),
}}
checked={props.hasConfirmed}
onChange={() => props.setConfirmed(!props.hasConfirmed)}
checked={hasConfirmed}
onChange={() => setConfirmed(!hasConfirmed)}
text="Accept"
/>
</StyledRootDiv>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Box } from 'src/components/Box';
import { Button } from 'src/components/Button/Button';
import { Dialog } from 'src/components/Dialog/Dialog';
import { Notice } from 'src/components/Notice/Notice';
import { getIsEdgeRegion } from 'src/components/RegionSelect/RegionSelect.utils';
import { TooltipIcon } from 'src/components/TooltipIcon';
import { Typography } from 'src/components/Typography';
import { MBpsInterDC } from 'src/constants';
Expand Down Expand Up @@ -144,6 +145,16 @@ export const MigrateLinode = React.memo((props: Props) => {
: undefined;
}, [flags.metadata, linode, regionsData, selectedRegion]);

const linodeIsInEdgeRegion = getIsEdgeRegion(
regionsData ?? [],
linode?.region ?? ''
);

const edgeRegionWarning =
flags.gecko && linodeIsInEdgeRegion
? 'Edge sites may only be migrated to other Edge sites.'
: undefined;
Comment on lines +153 to +156
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: should this logic live in CautionNotice?


if (!linode) {
return null;
}
Expand Down Expand Up @@ -224,6 +235,7 @@ export const MigrateLinode = React.memo((props: Props) => {
notifications={notifications}
/> */}
<CautionNotice
edgeRegionWarning={edgeRegionWarning}
hasConfirmed={hasConfirmed}
linodeId={linodeId}
metadataWarning={metadataMigrateWarning}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const PlanSelection = (props: PlanSelectionProps) => {
{type.vcpus}
</TableCell>
<TableCell center data-qa-storage noWrap>
{type.disk === 0 ? 'N/A' : convertMegabytesTo(type.disk, true)}
{convertMegabytesTo(type.disk, true)}
</TableCell>
{shouldShowTransfer && type.transfer ? (
<TableCell center data-qa-transfer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const PlansPanel = (props: Props) => {
delete plan.transfer;
return {
...plan,
disk: 0,
price: {
hourly: 0,
monthly: 0,
Expand Down Expand Up @@ -133,7 +132,7 @@ export const PlansPanel = (props: Props) => {
/>
{showEdgePlanTable && (
<Notice
text="Edge region pricing is temporarily $0 during the beta period, after which standard pricing will begin."
text="Edge region pricing is temporarily $0 during the beta period, after which billing will begin."
variant="warning"
/>
)}
Expand Down
Loading