Skip to content

Commit e5f7c59

Browse files
committed
[dashboard] display credit usage
1 parent ea1090b commit e5f7c59

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

components/dashboard/src/components/UsageBasedBillingConfig.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ export default function UsageBasedBillingConfig({ attributionId }: Props) {
232232
<div className="flex flex-col mt-4 p-4 rounded-xl bg-gray-50 dark:bg-gray-800">
233233
<div className="uppercase text-sm text-gray-400 dark:text-gray-500">Balance</div>
234234
<div className="mt-1 text-xl font-semibold flex-grow">
235-
<span className="text-gray-900 dark:text-gray-100">{balance}</span>
235+
<span className="text-gray-900 dark:text-gray-100">
236+
{balance.toLocaleString(undefined, { maximumFractionDigits: 2 })}
237+
</span>
236238
<span className="text-gray-400 dark:text-gray-500"> Credits</span>
237239
</div>
238240
<div className="mt-4 text-sm flex text-gray-400 dark:text-gray-500">

components/dashboard/src/components/WorkspaceClass.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,23 @@ function WorkspaceClass(props: WorkspaceClassProps) {
5151
>
5252
{props.description}
5353
</div>
54-
<div className="text-xl font-semibold mt-1 mb-4">
55-
<svg viewBox="0 -4 50 50" xmlns="http://www.w3.org/2000/svg">
54+
<div className="text-xl my-1 flex-row flex align-middle">
55+
<svg
56+
viewBox={"0 -4 " + 2 * (props.powerUps || 1) + " 2"}
57+
xmlns="http://www.w3.org/2000/svg"
58+
className="h-3 my-1 mr-1"
59+
>
5660
{Array.from(Array(props.powerUps).keys()).map((i) => {
5761
return <ellipse cx={0.8 + i * 2.5} cy="-3" rx="0.8" ry="0.8" style={{ fill: "#FFB45B" }} />;
5862
})}
5963
</svg>
64+
<div
65+
className={`text-sm font-normal truncate w-full ${
66+
props.selected ? "text-gray-300 dark:text-gray-500" : "text-gray-500 dark:text-gray-400"
67+
}`}
68+
>
69+
{(props?.powerUps || 1) * 10} credits/hour
70+
</div>
6071
</div>
6172
</div>
6273
</div>

components/dashboard/src/settings/selectClass.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function SelectWorkspaceClass(props: SelectWorkspaceClassProps) {
4848
{supportedClasses.map((c) => {
4949
return (
5050
<WorkspaceClass
51-
additionalStyles="w-80 h-32"
51+
additionalStyles="w-80"
5252
selected={workspaceClass === c.id}
5353
onClick={() => actuallySetWorkspaceClass(c.id)}
5454
category={c.category}

components/server/ee/src/workspace/gitpod-server-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,7 +2155,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
21552155
try {
21562156
customer = (await this.billingService.getStripeCustomer({ attributionId })).customer;
21572157
} catch (e) {
2158-
console.error(e);
2158+
log.error(e);
21592159
}
21602160
if (customer) {
21612161
// NOTE: this is a temporary workaround, as long as we're not automatically re-create the customer
@@ -2171,7 +2171,7 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
21712171
return;
21722172
}
21732173

2174-
// otherwise we need to create a new costomer.
2174+
// otherwise we need to create a new customer.
21752175
try {
21762176
await this.billingService.createStripeCustomer({
21772177
attributionId,

components/usage/pkg/stripe/stripe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (c *Client) GetCustomerByAttributionID(ctx context.Context, attributionID s
215215
}
216216

217217
if len(customers) == 0 {
218-
return nil, status.Errorf(codes.NotFound, "no team customer found for attribution_id: %s", attributionID)
218+
return nil, status.Errorf(codes.NotFound, "no customer found for attribution_id: %s", attributionID)
219219
}
220220
if len(customers) > 1 {
221221
return nil, status.Errorf(codes.FailedPrecondition, "found multiple customers for attributiuon_id: %s", attributionID)

0 commit comments

Comments
 (0)