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
Alerting: Add templates autocomplete #53655
Conversation
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/29814 |
…-template-editor-autocomplete
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/31436 |
@jessover9000 Please take a look at the @brendamuir Please take a look at the user-facing messages. Can we improve them? |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/32239 |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/32269 |
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/32303 |
…-template-editor-autocomplete
…rting/35726-template-editor-autocomplete' of github.com:grafana/grafana into alerting/35726-template-editor-autocomplete
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/32623 |
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 fine to me now.
…-template-editor-autocomplete
LGTM! |
Hello, sorry for the late comment, I somehow missed the Github notification. So from a UX perspective, I personally found it a bit difficult to make sense of everything that’s going on here. I have only seen the screenshot and not the whole thing, so I still have a lot of questions and don't fully understand everything. Maybe I need to see a demo and have a call about this 😅
|
public/app/features/alerting/unified/components/receivers/TemplateDataDocs.tsx
Outdated
Show resolved
Hide resolved
public/app/features/alerting/unified/components/receivers/TemplateForm.tsx
Outdated
Show resolved
Hide resolved
const insertFallback = typeof label === 'string' ? label : label.label; | ||
const labelObject = typeof label === 'string' ? { label: label, description: detail } : { ...label }; | ||
|
||
labelObject.description ??= detail; |
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've never really seen a good use-case for logical nullish assignments, why do we want to assign description
only if it's null
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.
I want to use detail
only as a fallback value if description
doesn't exist. For some suggestions I wanted the description
to be different from the detail
. Simply skipping the description
for some entries causes a worse user experience.
Suggestions look better in the editor if configured this way
public/app/features/alerting/unified/components/receivers/TemplateDataDocs.tsx
Outdated
Show resolved
Hide resolved
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/33554 |
Thanks for your feedback @jessover9000!
If the user has experience with any templating language, they will be looking for this table. It references what data is available for use inside the template.
The autocomplete feature does it to some extent.
Definitely! We've done already research in this regard yet it's a pretty complex task, beyond the scope of this one
We sort them in the same way in our docs and I feel the order is from the most important (most frequently used) to the least important ones |
…-template-editor-autocomplete
Drone build failed: https://drone.grafana.net/grafana/grafana-enterprise/33566 |
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 amazing, LGTM! 🚀
…-template-editor-autocomplete
What this PR does / why we need it:
This PR adds a basic autocomplete feature to the template's editor.
It also includes inline documentation for available template data
Which issue(s) this PR fixes:
Fixes #35726
Special notes for your reviewer: