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-6971] Add dynamic pricing model to Volume creation flows #9569

Merged
merged 10 commits into from
Aug 22, 2023

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Aug 19, 2023

Description 📝

This PR adds dynamic (DC based) pricing to the Volume creation flows.

Preview 📷

Before After
Screenshot 2023-08-21 at 00 10 21 Screenshot 2023-08-21 at 00 09 08
Screenshot 2023-08-21 at 00 10 39 Screenshot 2023-08-21 at 00 09 40

How to test 🧪

  1. Check out code locally and enable the DC-Specific Pricing feature flag in the dev settings
  2. Test the following flows with both the flag on and off.
  • The off flag should match production (except for some styling fixes -- see self review) and the on flag the dynamic pricing implementation
  • With the flag on, flow should be tested with Sao Paulo, Jakarta and and any region without a price increase

Flows:

  • /volumes/create
  • /volumes => action menu: resize & clone
  • /linodes/[id]/storage (w/ linodes in both regular and increased priced regions): create volume + action menu: resize & clone with attached volumes

@abailly-akamai abailly-akamai self-assigned this Aug 19, 2023
const price = getClampedPrice(value, currentSize);

return (
<Box marginTop={4}>
<DisplayPrice interval="mo" price={price} />
<DisplayPrice interval="mo" price={Number(price)} />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's inconsistencies in the way price is passed to children resulting in some expecting a string and others a number, such as DisplayPrice & Currency. Just something to be aware when we'll get the values from the API, which is when we can perhaps try to consolidate

left: `calc(${SIZE_FIELD_WIDTH}px + ${theme.spacing(2)})`,
position: 'absolute',
top: 50,
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those additional styles prevent an existing display issue with the combination of the right helper text and the inline error.

Before After
Screenshot 2023-08-20 at 19 14 53 Screenshot 2023-08-20 at 19 28 59

export default compose(connected, withProfile)(VolumeDrawer);
const VolumeDrawerWithHOCs = withProfile(connected(VolumeDrawer));

export default VolumeDrawerWithHOCs;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored this to be a functional component in order to use hooks. There is much more refactor needed for volumes, a lot of those files have not been touched in a long time. However I wanted to keep the diff related to this effort and not introduce other errors not pertaining to the scope of the ticket's requirements

@abailly-akamai abailly-akamai marked this pull request as ready for review August 20, 2023 17:37
@abailly-akamai abailly-akamai changed the title feat: [M3-6971] feat: [M3-6971] Add dynamic pricing model to Volume creation flows Aug 20, 2023
* @param size The size of a Volume in GBs
* @returns the base price of a volume based on its size
*/
export const getDynamicVolumePrice = ({ flags, regionId, size }: Props) => {
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on Options instead of Props? Props make me think React Component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure why not

@mjac0bs mjac0bs self-requested a review August 21, 2023 15:36
@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Aug 21, 2023
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

A couple minor things with the helper text on top of the create form, but otherwise this looks good. Thanks!

@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"@linode/manager": Changed
"@linode/manager": Upcoming Features

<span>
A single Volume can range from 10 to {MAX_VOLUME_SIZE} GB
in size and costs $0.10/GB per month. <br />
Up to eight volumes can be attached to a single Linode.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Up to eight volumes can be attached to a single Linode.
Up to eight volumes can be attached to a single Linode

Screenshot 2023-08-21 at 2 05 05 PM

We've got a double period here:

Comment on lines 284 to 286
A single Volume can range from 10 to 10240 GB in size. Up
to eight Volumes can be attached to a single Linode.
Select a Region to see cost per GB
Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2023-08-21 at 2 01 57 PM
This is a nitpick, but with the addition of another sentence, the way that we're displaying our copy is a little strange now, with that line break separating "Linode" onto the next line instead of at the end of the sentence. Can we potentially adjust max-width to something like 700 here to make our helper text more scannable?

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Aug 21, 2023
@abailly-akamai abailly-akamai merged commit 0a4a1dd into linode:develop Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! DC-Specific Pricing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants