File tree Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import { useEffect , useState } from "react" ;
8
8
import Alert from "./components/Alert" ;
9
- import { getGitpodService } from "./service/service" ;
9
+ import { getGitpodService , gitpodHostUrl } from "./service/service" ;
10
10
11
11
const KEY_APP_NOTIFICATIONS = "gitpod-app-notifications" ;
12
12
@@ -36,6 +36,7 @@ export function AppNotifications() {
36
36
} ;
37
37
38
38
const topNotification = notifications [ 0 ] ;
39
+
39
40
if ( topNotification === undefined ) {
40
41
return null ;
41
42
}
@@ -54,7 +55,18 @@ export function AppNotifications() {
54
55
showIcon = { true }
55
56
className = "flex rounded mb-2 w-full"
56
57
>
57
- < span > { topNotification } </ span >
58
+ < span > { topNotification } </ span > Manage
59
+ < a
60
+ className = "gp-link hover:text-gray-600"
61
+ href = {
62
+ notifications . length > 1
63
+ ? `${ gitpodHostUrl } t/${ notifications [ notifications . length - 1 ] } /billing`
64
+ : `${ gitpodHostUrl } billing`
65
+ }
66
+ >
67
+ { " " }
68
+ billing.
69
+ </ a >
58
70
</ Alert >
59
71
</ div >
60
72
) ;
Original file line number Diff line number Diff line change @@ -2254,10 +2254,28 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
2254
2254
const billingMode = await this . billingModes . getBillingModeForUser ( user , new Date ( ) ) ;
2255
2255
if ( billingMode . mode === "usage-based" ) {
2256
2256
const limit = await this . billingService . checkUsageLimitReached ( user ) ;
2257
- if ( limit . reached ) {
2258
- result . unshift ( "The usage limit is reached." ) ;
2259
- } else if ( limit . almostReached ) {
2260
- result . unshift ( "The usage limit is almost reached." ) ;
2257
+ let teamOrUser ;
2258
+ switch ( limit . attributionId . kind ) {
2259
+ case "user" : {
2260
+ if ( limit . reached ) {
2261
+ result . unshift ( `You have reached your usage limit.` ) ;
2262
+ } else if ( limit . almostReached ) {
2263
+ result . unshift ( `You have almost reached your usage limit.` ) ;
2264
+ }
2265
+ break ;
2266
+ }
2267
+ case "team" : {
2268
+ teamOrUser = await this . teamDB . findTeamById ( limit . attributionId . teamId ) ;
2269
+ if ( teamOrUser ) {
2270
+ result . push ( teamOrUser ?. slug ) ;
2271
+ if ( limit . reached ) {
2272
+ result . unshift ( `Your team ${ teamOrUser ?. name } has reached its usage limit.` ) ;
2273
+ } else if ( limit . almostReached ) {
2274
+ result . unshift ( `Your team ${ teamOrUser ?. name } has almost reached its usage limit.` ) ;
2275
+ }
2276
+ }
2277
+ break ;
2278
+ }
2261
2279
}
2262
2280
}
2263
2281
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments