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-6968] Add DC specific pricing info to migration modal #9570

Merged
merged 25 commits into from
Aug 29, 2023

Conversation

abailly-akamai
Copy link
Contributor

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

Description 📝

Adds a price comparison when trying to migrate a linode and selecting a region with an DC increase.

Per the mockups, we're looking at aligning the old region a new region data in a row, as well as an optional pricing dataset underneath if the migration is set towards a DC with a price increase

Preview 📷

Before After
Screenshot 2023-08-23 at 00 14 56 Screenshot 2023-08-23 at 00 14 25

How to test 🧪

  1. Pull local code
  2. Navigate to the linodes landing page or an individual linode
  3. Use the action menu and click on "Migrate"
  4. Play with the UI and confirm the test scenari outlined in the test file:
  • should render the initial ConfigureForm fields on modal open (no MigrationPricing)
  • shouldn't render the MigrationPricing component when the current Linode region is selected in the "New region" select
  • shouldn't render the MigrationPricing component when a region without price increase is selected in the "New region" select (anything else than br-gru & id-cgk)
  • should render the MigrationPricing component when a region with price increase is selected (ex: Sao Paulo br-gru)
  • should render the MigrationPricing component when a region with price decrease is selected (ex: Sao Paulo br-gru)
  • shouldn't render the MigrationPricingComponent for any case if the flag is disabled

@abailly-akamai abailly-akamai self-assigned this Aug 21, 2023
@abailly-akamai abailly-akamai changed the title feat: [M3-6968] feat: [M3-6968] Add DC specific information to migration flow modal Aug 21, 2023
@abailly-akamai abailly-akamai changed the title feat: [M3-6968] Add DC specific information to migration flow modal feat: [M3-6968] Add DC specific pricing info to migration flow modal Aug 21, 2023
@abailly-akamai abailly-akamai changed the title feat: [M3-6968] Add DC specific pricing info to migration flow modal feat: [M3-6968] Add DC specific pricing info to migration modal Aug 21, 2023
@abailly-akamai abailly-akamai marked this pull request as ready for review August 22, 2023 22:29
@abailly-akamai abailly-akamai marked this pull request as draft August 23, 2023 22:24
Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

General functionality and styling is looking great!

  • Feedback 🗣️
    • Backups and hourly price does not look different between the two regions, does this need to be fixed?
    • Volumes attached indentation is out of wack. (Out of scope but likely an easy fix to include here)
  • UX Concern 😰
    • We show a backups price even if the Linode does not have backups enabled. I am worried this might scare users into thinking they have backups enabled 😟 when they really don't have it enabled. Is this a valid concern? Should we hide the backups price if it is not enabled? Should we somehow show that backups are not enabled?

Screenshot 2023-08-24 at 11 48 02 AM

@abailly-akamai
Copy link
Contributor Author

abailly-akamai commented Aug 24, 2023

@bnussman-akamai thx! still in draft, but valid points all around

  1. hourly price was fixed, we needed 3 decimals
  2. where is the backup price increase included? in the region_price[] object? I'll update the mock data
  3. indentation - sure will fix!
  4. agreed - we should not show backup price if disabled - learning about this feature while hacking at it because of missing context while being away. I would just not show anything.

@mjac0bs
Copy link
Contributor

mjac0bs commented Aug 24, 2023

  1. where is the backup price increase included? in the region_price[] object? I'll update the mock data

@abailly-akamai Pull in the latest develop and you'll have this!

  1. agreed - we should not show backup price if disabled - learning about this feature while hacking at it because of missing context while being away. I would just not show anything.

This is a good call out and was a UX oversight when I made the ticket. Thanks for bringing it up @bnussman-akamai. Agreed that we shouldn't show backup price if disabled.

currentLinodeType && getLinodeRegionPrice(currentLinodeType, currentRegion);
// TODO: DYNAMIC_PRICING we probably don't want to default to the current price in case something goes wrong,
// resulting in misleading pricing.
// we will need a way to handle an error for this case here and dynamicPricing.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjac0bs Should we make a ticket for this and reference it before we forget in how many places we need to handle this important case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good thought, I made M3-7063 to account for this. We should display some error in lieu of the price comparison when selectedRegionPrice can't be calculated.

I wanted to clarify what you meant by dynamicPricing.ts. We're returning basePrice when there's no increase in our map, the feature flag is off, or we don't have regionId. Are we concerned about the regionId somehow getting set incorrectly or an issue with LD?

@abailly-akamai abailly-akamai marked this pull request as ready for review August 28, 2023 14:22
@abailly-akamai
Copy link
Contributor Author

@bnussman-akamai @mjac0bs this is ready for another look - thanks!

mjac0bs added a commit to mjac0bs/manager that referenced this pull request Aug 28, 2023
@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Aug 28, 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.

This is looking good with its various test scenarios! Just left a couple clarifying questions.

packages/manager/src/factories/types.ts Outdated Show resolved Hide resolved
currentLinodeType && getLinodeRegionPrice(currentLinodeType, currentRegion);
// TODO: DYNAMIC_PRICING we probably don't want to default to the current price in case something goes wrong,
// resulting in misleading pricing.
// we will need a way to handle an error for this case here and dynamicPricing.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good thought, I made M3-7063 to account for this. We should display some error in lieu of the price comparison when selectedRegionPrice can't be calculated.

I wanted to clarify what you meant by dynamicPricing.ts. We're returning basePrice when there's no increase in our map, the feature flag is off, or we don't have regionId. Are we concerned about the regionId somehow getting set incorrectly or an issue with LD?

* @param regionId The region to get the price for
* @returns backup pricing information for this specific linode type in a region
*/
export const getLinodeBackupPrice = (
Copy link
Contributor

Choose a reason for hiding this comment

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

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Aug 28, 2023
@abailly-akamai
Copy link
Contributor Author

@mjac0bs thx will address this feedback but meanwhile, regarding #9570 (comment) and dynamic pricing, I am referring to this line: https://github.com/linode/manager/blob/develop/packages/manager/src/utilities/pricing/dynamicPricing.ts#L43

if regionId is undefined for whatever reason, we will not run the price comparison. We probably want to handle this case on its own and also display an error (or whatever way we want to handle it)

@abailly-akamai abailly-akamai merged commit 392f9c2 into linode:develop Aug 29, 2023
mjac0bs added a commit to mjac0bs/manager that referenced this pull request Aug 29, 2023
mjac0bs added a commit that referenced this pull request Aug 29, 2023
* 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 #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
corya-akamai pushed a commit to corya-akamai/manager that referenced this pull request Sep 6, 2023
…de#9570)

* feat: [M3-6968] Initial commit - set up current data

* feat: [M3-6968] UI for migration dynamic pricing

* feat: [M3-6968] styling adjustment

* feat: [M3-6968] with with prop forwarding

* feat: [M3-6968] ad unit test

* feat: [M3-6968] improve unit test

* feat: [M3-6968] post rebase fix

* feat: [M3-6968] fix test

* Added changeset: DC Dynamic pricing information for migration flow

* feat: [M3-6968] improve display logic based on fedback

* feat: [M3-6968] save work

* feat: [M3-6968] save work

* feat: [M3-6968] test update

* Update packages/manager/.changeset/pr-9570-changed-1692743440177.md

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>

* Update packages/manager/.changeset/pr-9570-changed-1692743440177.md

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>

* feat: [M3-6968] cleanup

* feat: [M3-6968] fix hourly display and improve test

* feat: [M3-6968] handle backups

* feat: [M3-6968] test for backups

* feat: [M3-6968] cleanup 1

* feat: [M3-6968] fix identation issue

* feat: [M3-6968] fix identation issue

* feat: [M3-6968] fix failing test

* feat: [M3-6968] small feedback

* feat: [M3-6968] fix test

---------

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
corya-akamai pushed a commit to corya-akamai/manager that referenced this pull request Sep 6, 2023
)

* 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
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