-
Notifications
You must be signed in to change notification settings - Fork 405
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
feat: Add alert message in the FE when exceeded the API usage #4027
feat: Add alert message in the FE when exceeded the API usage #4027
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Uffizzi Preview |
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 code looks good to me, but just to be safe try to get @kyle-ssg to review it since he's better at frontend code review than I am.
Also, just a reminder that we discussed adding a feature flag for this. Please add it and share the flag name with me so we can test this on staging when we're ready.
<b>{apiOrganisationUsage?.results[0].percent_usage}</b> | ||
{'% '} |
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.
Tiny nit: the %
should be within the bold tag, since it looks weird to bold just the number without the percent.
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.
Done, also I added the flag name in the description PR.
@novakzaballa as discussed, this code should be mostly deleted (sorry!). We should reuse the code in |
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.
Looks good from my perspective, but still try to get @kyle-ssg to look it over for FE bugs.
<> | ||
Your organisation has exceeded its API usage quota{' '} | ||
<b>{`(${error}).`}</b>{' '} | ||
{Utils.getPlanName(this.props.organisationPlan) === 'Free' ? ( | ||
<b>Please upgrade your plan to continue receiving service.</b> | ||
) : ( | ||
<b>Automated billing for the overages may apply.</b> | ||
)} | ||
</> |
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 bolding of the error amount looks weird because the end of the sentence extends into the next one. I recommend doing it like this:
<> | |
Your organisation has exceeded its API usage quota{' '} | |
<b>{`(${error}).`}</b>{' '} | |
{Utils.getPlanName(this.props.organisationPlan) === 'Free' ? ( | |
<b>Please upgrade your plan to continue receiving service.</b> | |
) : ( | |
<b>Automated billing for the overages may apply.</b> | |
)} | |
</> | |
<> | |
Your organisation has exceeded its API usage quota{' '} | |
{`(${error}).`}{' '} | |
{Utils.getPlanName(this.props.organisationPlan) === 'Free' ? ( | |
<b>Please upgrade your plan to continue receiving service.</b> | |
) : ( | |
<b>Automated billing for the overages may apply.</b> | |
)} | |
</> |
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.
Done
…or-api-usage-notification
@matthewelwell Done |
body = { ...body, ...{ billing_period: 'current_billing_period' } } | ||
} | ||
|
||
const { data: totalApiCalls } = useGetOrganisationUsageQuery(body, { |
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.
Can’t this just go into the new component ? It may as well be just self contained / can be added anywhere
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.
I'm not quite sure I understand your suggestion. Are you suggesting using this hook in the new QuotaExceededMessagecomponent?
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.
Yes or just move the QuotaExceededMessagecomponent to this, it doesn't look like it's necessary
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.
Done
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
How did you test this code?