-
Notifications
You must be signed in to change notification settings - Fork 291
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
generate types, create http client and add exemplary usage #3384
Conversation
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.
wow 😍
@@ -41,6 +43,11 @@ export interface GroupedAlert { | |||
render_for_web: RenderForWeb; | |||
} | |||
|
|||
export type AlertGroup = components['schemas']['AlertGroup'] & { | |||
loading?: boolean; |
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.
just for my own curiosity, where is this loading
attribute used? Based on the name I'm guessing it's for... some loading state indicator? If so, could that state be managed external from the response objects we get back from the API? (would get rid of the need to have this type if I understand correctly)
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.
You're right and yes, our plan on the frontend is to move every loading state like that to a separate dedicated store. So that they are completely separated from models/domains themselves
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.
Nice!
|
||
| :warning: WARNING | | ||
| :------------------------------------------------------------------------------------------ | | ||
| Transition to this approach is [in progress](https://github.com/grafana/oncall/issues/3338) | |
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.
<3
.pre-commit-config.yaml
Outdated
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.
nit it seems most of our .yaml
files use double-quotes. We might want to consider configuring the quoted-strings
rule to make things consistent
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 switched to double quotes in this exact file. But across the codebase we have a mix now so yes, maybe in a separate PR we could change everything to double quotes and add a rule to yamllint
Looks very good 👍 |
# What this PR does #3330 - add a script that generates TS type definitions based on OnCall API OpenAPI schemas - support adding custom properties on the frontend if needed - add simple example of usage (for `'/labels/keys/'` endpoint) ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
What this PR does
#3330
'/labels/keys/'
endpoint)Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)