-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[usage] More useful notification #13406
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-lau-notifications-13166.7 because the annotations in the pull request description changed |
started the job as gitpod-build-lau-notifications-13166.8 because the annotations in the pull request description changed |
/werft run 👍 started the job as gitpod-build-lau-notifications-13166.10 |
8c7d1ab
to
a9aedd8
Compare
Let's change the first sentence to
Thanks for that suggestion @laushinka. |
And for the personal usage account.
|
287581d
to
33ffda2
Compare
@jldec Changes done 🚀 |
Would it make sense to include in the warning message that 80% has been reached? Right now it says almost reached, but doesn't specify how urgent or how close the user is. |
@easyCZ Thanks! I can see how the uncertainty of the word "almost" can create some panic. If we specify a number with a wording like "Your team has reached 80% of its usage limit", we would have to commit reflecting the actual percentage, won't we? For example today I see the banner, but then I keep racking up the usage without increasing the limit, tomorrow or the next it wouldn't be 80% anymore. |
We could also include the actual percentage in the message. We already check for 0.8 * usage limit so we know how much it is. |
className="gp-link hover:text-gray-600" | ||
href={ | ||
notifications.length > 1 | ||
? `${gitpodHostUrl}t/${notifications[notifications.length - 1]}/billing` |
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.
Is it possible to use the topNotification
variable here? It would avoid us having to do the lookup.
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.
Do we actually need the gitpodHostURL
? I think we could make the URL relative which would avoid having to specify it here
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.
Is it possible to use the
topNotification
variable here?
How do you mean? topNotification
is the first sentence that includes the team name. The second entry in the array is the Manage billing
link.
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.
Ah, my bad. I misread the contents of those.
switch (limit.attributionId.kind) { | ||
case "user": { | ||
if (limit.reached) { | ||
result.unshift(`You have reached your usage limit.`); | ||
} else if (limit.almostReached) { | ||
result.unshift(`You have almost reached your usage limit.`); | ||
} | ||
break; | ||
} | ||
case "team": { | ||
teamOrUser = await this.teamDB.findTeamById(limit.attributionId.teamId); | ||
if (teamOrUser) { | ||
result.push(teamOrUser?.slug); | ||
if (limit.reached) { | ||
result.unshift(`Your team '${teamOrUser?.name}' has reached its usage limit.`); | ||
} else if (limit.almostReached) { | ||
result.unshift(`Your team '${teamOrUser?.name}' has almost reached its usage limit.`); | ||
} | ||
} | ||
break; | ||
} |
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.
The nesting here makes it quite hard to follow the main flow of the method. What if we refactored this block into a separate method and do something like
const usageNotification = getUsageNotificationForAttributionID(...)
if usageNotification.length > 0 { ... }
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.
Sorry @easyCZ I was refactoring this but forgot to hold and now it's merged!
@jldec also prefers putting 80% so I will replace the |
I think you should say |
Yes, nice suggestion! |
@laushinka I just tested this in a preview env . |
Aha, thanks! |
33ffda2
to
a3d9767
Compare
a3d9767
to
6dd22ea
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.
Description
Shows:
Related Issue(s)
Fixes #13166
How to test
Preview env
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide