-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[admin] Allow credit adjustments #14594
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
Conversation
started the job as gitpod-build-sefftinge-ubp-grant-free-credits-14591.1 because the annotations in the pull request description changed |
/werft run 👍 started the job as gitpod-build-sefftinge-ubp-grant-free-credits-14591.2 |
c00c344
to
1b22a00
Compare
1b22a00
to
ba17816
Compare
1540756
to
ba17816
Compare
/werft run 👍 started the job as gitpod-build-sefftinge-ubp-grant-free-credits-14591.8 |
1c33b93
to
f6d393c
Compare
@svenefftinge - did you forget to push your changes to the branch? |
eef621d
to
040b1ef
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.
Thanks, @svenefftinge!
Looks great overall! UX could still be somewhat confusing in some edge cases or missing some user feedback on errors, but changes here look like a good great first iteration. 🛹
Left a few minor UX comments below. 🏓
} | ||
}} | ||
> | ||
Save |
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.
<Modal | ||
visible={editSpendingLimit} | ||
onClose={() => setEditSpendingLimit(false)} | ||
title="Update Usage Limit" |
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.
issue: When trying to update the usage limit for a team I get the following console error and the limit does not update. Is this known or expected?
Uncaught (in promise) Error: Failed to get Stripe Subscription ID for 'team:0faf0b45-1e5f-4c3c-b5ef-6bbe22f1da9f'
} | ||
}} | ||
> | ||
Save |
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.
question: Probably not the best line to comment about this, but when a user upgrades to UBP, the error returned when trying to change the usage limit from the admin dashboard below 1000 mentions again the 500 limit. Should this become 1000 or shall we change the error to become more generic?
/ {usageLimit} Credit{usageLimit === 1 ? "" : "s"} | ||
</span> | ||
<span className="text-gray-900 dark:text-gray-100">{used}</span> | ||
<span className="text-gray-400 dark:text-gray-500"> / {totalAvailable} Credits</span> |
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.
040b1ef
to
3d43ba9
Compare
UI nit - it's possible to grant negative credits using the up/down controls, but not by typing a minus. I think we should allow negative credit grants with a minus e.g. if an admin makes a mistake in a positive grant and wants to undo it with a negative grant. |
We should allow admins to enter a reason for updating the limit (just like they have for adding credits) |
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.
(wrong type)
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.
Checked code in components/server
, LGTM!
See a few minor remarks in comments, but that's definitely not blocking.
George reported some issues/errors, which I'm not sure if we need to address right away. If you think they should be addressed in a follow-up, we can merge it as is.
/hold
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.
Broadly looks okay. I'd personally like that a reason
- human readable explanation of the credit be included to help us understand retrospectively the WHY
min={-50000} | ||
max={50000} |
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.
[nit] Feels arbitrary, and if we want to enforce it, perhaps should do that on the backend anyway. I'd remove.
3d43ba9
to
c12f3b8
Compare
c12f3b8
to
d97b1e0
Compare
Yes, would be good, but it's not low-hanging. Can you create a follow-up issue? |
Works for me. What browser are you on? |
/unhold |
Description
Allows admins to view and alter the credit balance as well as adjusting the usage limit of team and user cost centers.
The spending in billing setting was showing the
<usage of the current period> / <usageLimit>
which is ignoring the total credit balance of an account. I have changed/fixed this in this PR as well.Since we now can issue one time credits (or even debits) and because users can go over their spending limit (with running workspaces), we compute the spending so that if a user has a positive balance we add the amount to the spending limit on the right. Also, the percentage bar below would be 0% instead of a negative number.
Here's an example where I granted 30 credits (in addition to a 500 spending limit and some small usage)
The case where someone uses more than their usage limit, is show like this:
For the admin dashboard I opted for separating balance and usage limit:

Related Issue(s)
Fixes #14591
Fixes #14739
Fixes #14367
How to test
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh