feat: [M3-7063] - Provide dynamic price error handling for DC-specific pricing#9660
feat: [M3-7063] - Provide dynamic price error handling for DC-specific pricing#9660mjac0bs merged 61 commits intolinode:developfrom
Conversation
…not be determined
mjac0bs
left a comment
There was a problem hiding this comment.
For others who may be looking at this PR: there is an associated UX ticket (UX-427) discussion and we're going to incorporate those changes here.
That should result in some clean up in components like Currency and DisplayPrice, so the price doesn't have to accept a string. And in dynamicPricing.ts, we'd return undefined instead of unknown.
In places where we have display text with "unknown", (e.g. the resize pool component), we can display an error message like below, rather than rendering something like Resized pool: $unknown/month.

For table cells with pricing data, where we'd fall back on unknown if there was an error, we will instead display $--.-- with an tooltip error icon. This could be a new ErrorCell component that accepts the error text and tooltip text as props.
(Formatting subject to change so wrapping issue would be fixed.)

packages/manager/src/features/Kubernetes/KubeCheckoutBar/NodePoolSummary.tsx
Outdated
Show resolved
Hide resolved
...er/src/features/Kubernetes/KubernetesClusterDetail/NodePoolsDisplay/ResizeNodePoolDrawer.tsx
Outdated
Show resolved
Hide resolved
Ah, nice catch @mjac0bs! I'll circle back and take another look soon
Haha I noticed that too -- I'm guessing I added it up before adding the $2.00 entry to the list... or maybe I'm just bad at basic math 😅 |
|
(@mjac0bs Should've mentioned above, but all of the failures can be disregarded!) |
abailly-akamai
left a comment
There was a problem hiding this comment.
Thanks for all your work on this!
It's hard to test every scenario but I could confirm most of them except for volumes create but I think it's because I was using null values for monthly & hourly VS an undefined data set.
|
Gonna check these off as I go through them:
|
| summaryItems.unshift({ | ||
| title: `$${ | ||
| renderMonthlyPriceToCorrectDecimalPlace(Number(price)) ?? UNKNOWN_PRICE | ||
| }/month`, | ||
| }); |
There was a problem hiding this comment.
I understand the intention here, but I'm not a fan of the extra complexity. Because the NodeBalancer price is hard-coded I don't see why we'd have to handle an unknown price.
Also, I'm not sure if the fallback logic makes sense here.
| summaryItems.unshift({ | |
| title: `$${ | |
| renderMonthlyPriceToCorrectDecimalPlace(Number(price)) ?? UNKNOWN_PRICE | |
| }/month`, | |
| }); | |
| summaryItems.unshift({ | |
| title: `$${ | |
| renderMonthlyPriceToCorrectDecimalPlace(Number(price)) | |
| }/month`, | |
| }); |
Also, it looks like renderMonthlyPriceToCorrectDecimalPlace won't properly handle a service that is $0. (not that we're going to many free products)
There was a problem hiding this comment.
Yeah, you're right that we really wouldn't end up needing to handle displaying an unknown price in this case because although price can be undefined, we're only displaying price in the summary once there is a valid region.
(And other than that, the fallback logic was just unnecessary there with the render function, and I probably just wasn't paying attention when doing some clean up, and missed it.)
As for:
looks like renderMonthlyPriceToCorrectDecimalPlace won't properly handle a service that is $0. (not that we're going to many free products)
In this case and in any other instances where we're using this in Cloud, I wouldn't expect these products to be free. Unless there's a likely situation that we'd encounter that, I think it's safer to leave as is so we don't risk inaccurately advertising free products.
|
Awesome work! Tested the functionality, had the following questions:
|
bnussman-akamai
left a comment
There was a problem hiding this comment.
Didn't find any regressions on any of the flows I checked!
|
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
@coliu-akamai Thanks for raising this and including your repro steps -- super helpful and I appreciate it! You were right; this was missed, because I forgot that the Kube plan table is a separate component. It has been fixed now. I've also disabled the add button if a row has a pricing error (not visible in this screenshot; made that change afterwards). Using the same mock/factory edits quoted above, just returning null for hourly: |
|
@mjac0bs awesome thanks! One other quick thing, the add button for the Shared CPU row on the Create Kubernetes flow doesn't get disabled (errors showing up now though! 🎉): |
@coliu-akamai - Thanks, fixed now in 4646b77. Also made a minor change to only disable |
|
The last e2e run failed for unrelated reasons: a database-create spec and a pipeline error (one that prevents the entire runner from executing tests). I ran |





Description 📝
Preview 📷
Enable Backups Modal
How to test 🧪
Here is a list of DC-specific pricing PRs. When testing this PR, first ensure that there are no regressions from prod in pricing behavior matches prod in all cases where there are NOT errors. (PRs that were copy changes, not price calculations, are already checked off.)
Then verify the error handling in the screenshots above is triggered when prices cannot be calculated correctly:
serverHandlers.ts, modifynanodeTypesto include a region_prices object with monthly and hourly prices ofnull.https://api.linode.com/v4/linode/types/g6-standard-1.