Skip to content

Commit daccf43

Browse files
author
Laurie T. Malau
committed
[usage] More useful notification
1 parent 5cf2cb8 commit daccf43

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

components/dashboard/src/AppNotifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function AppNotifications() {
5454
showIcon={true}
5555
className="flex rounded mb-2 w-full"
5656
>
57-
<span>{topNotification}</span>
57+
<div>{topNotification}</div>
5858
</Alert>
5959
</div>
6060
);

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,10 +2254,22 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
22542254
const billingMode = await this.billingModes.getBillingModeForUser(user, new Date());
22552255
if (billingMode.mode === "usage-based") {
22562256
const limit = await this.billingService.checkUsageLimitReached(user);
2257+
let teamOrUser;
2258+
switch (limit.attributionId.kind) {
2259+
case "user": {
2260+
teamOrUser = await this.userDB.findUserById(limit.attributionId.userId);
2261+
break;
2262+
}
2263+
case "team": {
2264+
teamOrUser = await this.teamDB.findTeamById(limit.attributionId.teamId);
2265+
break;
2266+
}
2267+
}
2268+
22572269
if (limit.reached) {
2258-
result.unshift("The usage limit is reached.");
2270+
result.unshift(`The usage limit for ${teamOrUser?.name} is reached.`);
22592271
} else if (limit.almostReached) {
2260-
result.unshift("The usage limit is almost reached.");
2272+
result.unshift(`The usage limit for ${teamOrUser?.name} is almost reached.`);
22612273
}
22622274
}
22632275
} catch (error) {

0 commit comments

Comments
 (0)