-
Notifications
You must be signed in to change notification settings - Fork 371
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-7035] - Add DC-specific pricing to Linode backups #9588
feat: [M3-7035] - Add DC-specific pricing to Linode backups #9588
Conversation
6737b64
to
e3eb1a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backups pricing can no longer be calculated at this level because it is DC-dependent.
@@ -82,7 +90,7 @@ export const EnableBackupsDialog = (props: Props) => { | |||
> | |||
<Typography> | |||
Are you sure you want to enable backups on this Linode?{` `} | |||
This will add <Currency quantity={price} /> | |||
This will add <Currency quantity={backupsMonthlyPrice ?? 0} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems somewhat strange that we will display "This will add $0.00 to your account." if there is ever a linode that doesn't have a monthly backup price returned types
, but this existing behavior, so I left it because it provides transparency, at least.
@@ -25,6 +25,31 @@ export const getLinodeRegionPrice = ( | |||
return type.price; | |||
}; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was also added in Alban's PR. Kept consistent function and variable names here.
@@ -85,7 +90,6 @@ import { | |||
import type { Tab } from 'src/components/TabLinkList/TabLinkList'; | |||
|
|||
export interface LinodeCreateProps { | |||
backupsMonthlyPrice?: null | number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is no longer a prop because it is calculated in this component based on region selection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Didn't find any issues with the flag on or off!
packages/manager/src/features/Linodes/LinodesDetail/LinodeBackup/EnableBackupsDialog.tsx
Outdated
Show resolved
Hide resolved
bf44f9d
to
12a0f11
Compare
return backupsMonthlyPrice && backupsMonthlyPrice > 0 ? ( | ||
<Typography variant="body1"> | ||
<Currency quantity={backupsMonthlyPrice} /> per month | ||
</Typography> | ||
) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the ternary, this will display "0" in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! happy to move utils around in upcoming work. Good to go 👍
@abailly-akamai I'll merge now so you can rebase -- thank you for taking care of moving the util! |
) * Add dynamic pricing backups util functions * Update Enable Backups drawer with dynamic pricing * Update Backups tab placeholder and confirmation dialog with dynamic pricing * Update mocks for now * Revert mock updates after rebase * Add test for backup price util function * Add DC-specific pricing to Linode Create flow * Update cached regions file to include Jakarta and Sao Paulo * Feature flag changes * Improve consistency with price variable names * Update tests * Renamed util function for consistency with linode#9570 * Added changeset: Add DC-specific pricing to Linode backups * Update backups drawer total cost util function to use FF * Address feedback: && over ternary * Address feedback: util and types * Missed a spot
Description 📝
Pricing for backups is now Region-dependent. This PR uses the mocked API response for the linode/types endpoint to get the correct price for a backup add-on with region_prices data.
Major Changes 🔄
With the
dcSpecificPricing
feature flag on and MSW on:Preview 📷
How to test 🧪
dcSpecificPricing
feature flag is toggled on.region_price
) in all the locations mentioned in the table above.dcSpecificPricing
flag off and confirm the mocked linode in Jakarta does not have any increases in its backup price (should use mocked base price).rest.get('*/linode/instances/:id'
and confirm that a linode not in Jakarta or Sao Paulo does not have any increases in its backup price (should use mocked base price).Update the MSW mocked request
rest.get('*/linode/instances/:id'
to includeregion: 'id-cgk'
in the mocked linode created with the factory.To test Backups Drawer:
Recommend modifying
rest.get('*/linode/instances'
to use a shorter list of linodes: