-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add check to which plan the org is changing when applying the credits #1574
Conversation
} | ||
} | ||
|
||
$: billingPlan = getNewBillingPlan(selectedOrg); |
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.
@ArmanNik and @TorstenDittmann might now more on Svelte best practices, but I don't think we need to create a new function for this. You can put an if statement directly here like:
console/src/lib/layout/logs.svelte
Lines 66 to 68 in 4145174
$: if (execution?.errors) { | |
selectedResponse = 'errors'; | |
} |
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.
For now I've changed it to a ternary operation. The if statement way didn't seem to do the trick correctly (perhaps @TorstenDittmann or @ArmanNik can point out later on what I'm doing wrong there haha).
if (organization?.billingPlan === BillingPlan.SCALE) { | ||
return BillingPlan.SCALE; |
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.
I'm still a bit hesitant to hardcode stuff here. For example, enterprise plans will run into a problem with this logic.
Maybe we can rely on the plan order (after it gets fixed for the education plan)?
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.
Yeah definitely! However atm we don't have a plan order in code afaik?
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.
@ernstmul We don't have an exact order [there's tier-*
format though] but possibly we could check via getNextTier
, not 100% sure as it doesn't include anything about enterprise/custom tiers atm.
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.
tier-*
doesn't hold up anymore, since we now also have auto-1 and cont-1! getNextTier
would definitely work, but perhaps its nice get this info from BE?
src/routes/(console)/+layout.ts
Outdated
@@ -25,6 +25,7 @@ export const load: LayoutLoad = async ({ fetch, depends, parent }) => { | |||
let plansInfo = new Map<Tier, Plan>(); | |||
if (isCloud) { | |||
const plansArray = await sdk.forConsole.billing.getPlansInfo(); | |||
console.log('plansArray', plansArray); |
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.
leftover?
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.
oops, fixed!
if (organization?.billingPlan === BillingPlan.SCALE) { | ||
return BillingPlan.SCALE; |
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.
@ernstmul We don't have an exact order [there's tier-*
format though] but possibly we could check via getNextTier
, not 100% sure as it doesn't include anything about enterprise/custom tiers atm.
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.
Minor nitpick
What does this PR do?
Applying credits can make an organisation switch plans. This additional check prevents an organisation from downgrading when applying credits.
Have you read the Contributing Guidelines on issues?
✅