-
Notifications
You must be signed in to change notification settings - Fork 429
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: display warning and prevent creation on limit #2526
feat: display warning and prevent creation on limit #2526
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #2526 +/- ##
==========================================
- Coverage 95.52% 95.46% -0.07%
==========================================
Files 993 986 -7
Lines 28031 27689 -342
==========================================
- Hits 26778 26434 -344
- Misses 1253 1255 +2 ☔ View full report in Codecov by Sentry. |
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.
This looks good to me now. A minor nitpick would be to ask if we could add a little more margin between the 'Request more API calls' button and the items in the list above it. Maybe even making that button slightly smaller.
@@ -37,6 +37,12 @@ const AppActions = Object.assign({}, require('./base/_app-actions'), { | |||
projectId, | |||
}) | |||
}, | |||
getEnv(environmentId) { |
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 there a reason why we need to get the environment this way? It adds to tech debt, ideally it would be an action in useEnvironment.ts
frontend/web/components/Aside.js
Outdated
@@ -77,6 +78,7 @@ const Aside = class extends Component { | |||
? {} | |||
: { live_from_after: new Date().toISOString() }, | |||
) | |||
AppActions.getEnv(this.props.environmentId) |
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 confused by this, we're already getting the project's environments in AppActions.getProject
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.
This is triggered every time we change environments. It is done this way because we need to save the response to the store so we can use its data to determine the content of the alert and whether it will be displayed.
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.
We use the environment endpoint because the project one doesn't have the limits information we need, and Matt asked to keep it this way since it will be more efficient in terms of querying the DB
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.
After our conversation, I think this can now be removed.
frontend/web/components/App.js
Outdated
@@ -484,6 +507,31 @@ const App = class extends Component { | |||
</div> | |||
) : ( | |||
<Fragment> | |||
<Row> | |||
{user && |
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.
As mentioned on slack, I think this should be componentised so that you can use hooks to get the data.
@@ -83,6 +84,14 @@ const controller = { | |||
store.saved() | |||
}) | |||
}, | |||
getEnv: (envId) => { | |||
data.get(`${Project.api}environments/${envId}/`).then((environment) => { |
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 this used anymore?
frontend/web/components/Aside.js
Outdated
@@ -50,6 +50,7 @@ const Aside = class extends Component { | |||
? {} | |||
: { live_from_after: new Date().toISOString() }, | |||
) | |||
AppActions.getEnv(this.props.environmentId) |
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 need to do this
frontend/web/components/App.js
Outdated
@@ -288,6 +299,17 @@ const App = class extends Component { | |||
) | |||
const dismissed = flagsmith.getTrait('dismissed_announcement') | |||
const showBanner = !dismissed || dismissed !== announcementValue.id | |||
const maxApiCallsPercentage = Utils.calculateRemainingLimitsPercentage( |
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 this used anymore
frontend/web/components/App.js
Outdated
@@ -70,6 +74,13 @@ const App = class extends Component { | |||
AccountStore.getOrganisation()?.id && | |||
this.state.activeOrganisation !== AccountStore.getOrganisation().id | |||
) { | |||
getSubscriptionMetadata(getStore(), { |
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 this used anymore
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingChanges
How did you test this code?
Unit test added