-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat-m3-7227
- Loading branch information
Showing
11 changed files
with
452 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Added | ||
--- | ||
|
||
Helper text for DC-specific pricing Object Storage overages ([#9813](https://github.com/linode/manager/pull/9813)) |
257 changes: 194 additions & 63 deletions
257
packages/manager/cypress/e2e/core/objectStorage/enable-object-storage.spec.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/manager/src/features/ObjectStorage/BucketLanding/OveragePricing.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { fireEvent } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { OBJ_STORAGE_PRICE } from 'src/utilities/pricing/constants'; | ||
import { objectStoragePriceIncreaseMap } from 'src/utilities/pricing/dynamicPricing'; | ||
import { renderWithTheme } from 'src/utilities/testHelpers'; | ||
|
||
import { | ||
DC_SPECIFIC_TRANSFER_POOLS_TOOLTIP_TEXT, | ||
GLOBAL_TRANSFER_POOL_TOOLTIP_TEXT, | ||
OveragePricing, | ||
} from './OveragePricing'; | ||
|
||
describe('OveragePricing', () => { | ||
it('Renders base overage pricing for a region without price increases', () => { | ||
const { getByText } = renderWithTheme( | ||
<OveragePricing regionId="us-east" /> | ||
); | ||
getByText(`$${OBJ_STORAGE_PRICE.storage_overage} per GB`, { exact: false }); | ||
getByText(`$${OBJ_STORAGE_PRICE.transfer_overage} per GB`, { | ||
exact: false, | ||
}); | ||
}); | ||
|
||
it('Renders DC-specific overage pricing for a region with price increases', () => { | ||
const { getByText } = renderWithTheme(<OveragePricing regionId="br-gru" />); | ||
getByText( | ||
`$${objectStoragePriceIncreaseMap['br-gru'].storage_overage} per GB`, | ||
{ exact: false } | ||
); | ||
getByText( | ||
`$${objectStoragePriceIncreaseMap['br-gru'].transfer_overage} per GB`, | ||
{ exact: false } | ||
); | ||
}); | ||
|
||
it('Renders a tooltip for DC-specific transfer pools for a region with price increases', async () => { | ||
const { findByRole, getByText } = renderWithTheme( | ||
<OveragePricing regionId="br-gru" /> | ||
); | ||
|
||
fireEvent.mouseEnter(getByText('network transfer pool for this region')); | ||
|
||
const tooltip = await findByRole(/tooltip/); | ||
|
||
expect(tooltip).toBeInTheDocument(); | ||
expect(getByText(DC_SPECIFIC_TRANSFER_POOLS_TOOLTIP_TEXT)).toBeVisible(); | ||
}); | ||
|
||
it('Renders a tooltip for global network transfer pools for a region without price increases', async () => { | ||
const { findByRole, getByText } = renderWithTheme( | ||
<OveragePricing regionId="us-east" /> | ||
); | ||
|
||
fireEvent.mouseEnter(getByText('global network transfer pool')); | ||
|
||
const tooltip = await findByRole(/tooltip/); | ||
|
||
expect(tooltip).toBeInTheDocument(); | ||
expect(getByText(GLOBAL_TRANSFER_POOL_TOOLTIP_TEXT)).toBeVisible(); | ||
}); | ||
}); |
75 changes: 75 additions & 0 deletions
75
packages/manager/src/features/ObjectStorage/BucketLanding/OveragePricing.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Region } from '@linode/api-v4'; | ||
import { styled } from '@mui/material/styles'; | ||
import React from 'react'; | ||
|
||
import { TextTooltip } from 'src/components/TextTooltip'; | ||
import { Typography } from 'src/components/Typography'; | ||
import { OBJ_STORAGE_PRICE } from 'src/utilities/pricing/constants'; | ||
import { objectStoragePriceIncreaseMap } from 'src/utilities/pricing/dynamicPricing'; | ||
|
||
interface Props { | ||
regionId: Region['id']; | ||
} | ||
|
||
export const DC_SPECIFIC_TRANSFER_POOLS_TOOLTIP_TEXT = | ||
'For this region, monthly network transfer is calculated and tracked independently and is not part of your global network transfer pool.'; | ||
export const GLOBAL_TRANSFER_POOL_TOOLTIP_TEXT = | ||
'Your global network transfer pool adds up all the included transfer associated with active Linode services on your account and is prorated based on service creation.'; | ||
|
||
export const OveragePricing = (props: Props) => { | ||
const { regionId } = props; | ||
const isDcSpecificPricingRegion = objectStoragePriceIncreaseMap.hasOwnProperty( | ||
regionId | ||
); | ||
|
||
return ( | ||
<> | ||
<StyledTypography> | ||
For this region, additional storage costs{' '} | ||
<strong> | ||
$ | ||
{isDcSpecificPricingRegion | ||
? objectStoragePriceIncreaseMap[regionId].storage_overage | ||
: OBJ_STORAGE_PRICE.storage_overage}{' '} | ||
per GB | ||
</strong> | ||
. | ||
</StyledTypography> | ||
<StyledTypography> | ||
Outbound transfer will cost{' '} | ||
<strong> | ||
$ | ||
{isDcSpecificPricingRegion | ||
? objectStoragePriceIncreaseMap[regionId].transfer_overage | ||
: OBJ_STORAGE_PRICE.transfer_overage}{' '} | ||
per GB | ||
</strong>{' '} | ||
if it exceeds{' '} | ||
{isDcSpecificPricingRegion ? ( | ||
<> | ||
the{' '} | ||
<TextTooltip | ||
displayText="network transfer pool for this region" | ||
tooltipText={DC_SPECIFIC_TRANSFER_POOLS_TOOLTIP_TEXT} | ||
/> | ||
</> | ||
) : ( | ||
<> | ||
your{' '} | ||
<TextTooltip | ||
displayText="global network transfer pool" | ||
tooltipText={GLOBAL_TRANSFER_POOL_TOOLTIP_TEXT} | ||
/> | ||
</> | ||
)} | ||
. | ||
</StyledTypography> | ||
</> | ||
); | ||
}; | ||
|
||
const StyledTypography = styled(Typography, { | ||
label: 'StyledTypography', | ||
})(({ theme }) => ({ | ||
margin: `${theme.spacing(2)} 0`, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.