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

feat: [M3-8581] - GPUv2 Plan Selection Egress Banner #10956

Merged
merged 6 commits into from
Sep 25, 2024
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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10956-added-1727103260742.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

GPUv2 Plan Selection Egress Banner ([#10956](https://github.com/linode/manager/pull/10956))
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ describe('displays specific linode plans for GPU', () => {
// Should display two separate tables
cy.findByText('GPU').click();
cy.get(linodePlansPanel).within(() => {
cy.findAllByRole('alert').should('have.length', 1);
cy.findAllByRole('alert').should('have.length', 2);
cy.get(notices.unavailable).should('be.visible');

cy.findByRole('table', {
Expand Down
1 change: 1 addition & 0 deletions packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface CloudPulseResourceTypeMapFlag {
}

interface gpuV2 {
egressBanner: boolean;
planDivider: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { LinodeTypeClass } from '@linode/api-v4/lib/linodes';
import { Theme, useTheme } from '@mui/material/styles';
import * as React from 'react';

import { Link } from 'src/components/Link';
import { Notice } from 'src/components/Notice/Notice';
import { Typography } from 'src/components/Typography';
import { StyledNoticeTypography } from 'src/features/Linodes/LinodesCreate/PlansAvailabilityNotice.styles';
import { useFlags } from 'src/hooks/useFlags';

import { PlansAvailabilityNotice } from '../../Linodes/LinodesCreate/PlansAvailabilityNotice';
import {
Expand All @@ -19,6 +18,8 @@ import { MetalNotice } from './MetalNotice';
import { planTabInfoContent } from './utils';

import type { Region } from '@linode/api-v4';
import type { LinodeTypeClass } from '@linode/api-v4/lib/linodes';
import type { Theme } from '@mui/material/styles';

export interface PlanInformationProps {
disabledClasses?: LinodeTypeClass[];
Expand All @@ -40,20 +41,40 @@ export const PlanInformation = (props: PlanInformationProps) => {
planType,
regionsData,
} = props;

const getDisabledClass = (thisClass: LinodeTypeClass) => {
return Boolean(disabledClasses?.includes(thisClass));
};
const showGPUEgressBanner = Boolean(useFlags().gpuv2?.egressBanner);

return (
<>
{planType === 'gpu' ? (
<PlansAvailabilityNotice
hasSelectedRegion={hasSelectedRegion}
isSelectedRegionEligibleForPlan={isSelectedRegionEligibleForPlan}
planType={planType}
regionsData={regionsData || []}
/>
<>
{showGPUEgressBanner && (
<Notice spacingBottom={8} variant="info">
<Typography
fontFamily={(theme: Theme) => theme.font.bold}
fontSize="1rem"
>
New GPU instances are now generally available. Deploy an RTX
4000 Ada GPU instance in select core compute regions in North
America, Europe, and Asia. <br />
Receive 1 TB of free included network transfer for a limited
time.{' '}
<Link to="https://www.linode.com/blog/compute/new-gpus-nvidia-rtx-4000-ada-generation">
Learn more
</Link>
.
</Typography>
</Notice>
)}
<PlansAvailabilityNotice
hasSelectedRegion={hasSelectedRegion}
isSelectedRegionEligibleForPlan={isSelectedRegionEligibleForPlan}
planType={planType}
regionsData={regionsData || []}
/>
</>
) : null}
{planType === 'metal' ? (
<MetalNotice
Expand Down Expand Up @@ -101,7 +122,6 @@ interface ClassDescriptionCopyProps {

export const ClassDescriptionCopy = (props: ClassDescriptionCopyProps) => {
const { planType } = props;
const theme = useTheme();
let planTypeLabel: null | string;
let docLink: null | string;

Expand Down Expand Up @@ -133,7 +153,10 @@ export const ClassDescriptionCopy = (props: ClassDescriptionCopyProps) => {

return planTypeLabel && docLink ? (
<Typography
sx={{ marginBottom: theme.spacing(3), marginTop: theme.spacing(1) }}
sx={(theme: Theme) => ({
marginBottom: theme.spacing(3),
marginTop: theme.spacing(1),
})}
>
{
planTabInfoContent[planType as keyof typeof planTabInfoContent]
Expand Down
Loading