Skip to content
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

Create plugin: Update data source templates #836

Merged
merged 4 commits into from
Mar 26, 2024

Conversation

sunker
Copy link
Contributor

@sunker sunker commented Mar 22, 2024

What this PR does / why we need it:

Was initially going to replace the usage of gf- classnames in forms, but found some more low hanging fruits in the data source templates that I'm fixing.

Which issue(s) this PR fixes:

Fixes #782

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@4.4.0-canary.836.aa6cb3b.0
npm install @grafana/plugin-e2e@0.24.0-canary.836.aa6cb3b.0
# or 
yarn add @grafana/create-plugin@4.4.0-canary.836.aa6cb3b.0
yarn add @grafana/plugin-e2e@0.24.0-canary.836.aa6cb3b.0

Copy link

github-actions bot commented Mar 22, 2024

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new patch release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@@ -79,7 +79,7 @@ export function QueryEditor({ query, onChange, onRunQuery }: Props) {
const { upperLimit, lowerLimit, tickInterval } = query;

return (
<div className="gf-form">
<>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could potentially use the new Box component here, but it does not change appearance so don't think we need it.

applyTemplateVariables(query: MyQuery, scopedVars: ScopedVars): Record<string, any> {
return {
...query,
queryText: getTemplateSrv().replace(query.queryText, scopedVars),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding scoped variables...currently the ds template for plugin.json doesn't specify any query options. Should we skip passing the scopredVars variable to getTemplateSrv().replace?

<div className="gf-form-group">
<InlineField label="Path" labelWidth={12}>
<>
<InlineField label="Path" labelWidth={14} interactive tooltip={'Json field returned to frontend'}>
Copy link
Contributor Author

@sunker sunker Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re label width: Opened a PR in Grafana to increase the width of the name field to 14. That way we at least give the plugin authors a chance to align field width across the entire page.

@sunker sunker added major Increment the major version when merged minor Increment the minor version when merged patch Increment the patch version when merged release Create a release when this pr is merged and removed major Increment the major version when merged minor Increment the minor version when merged labels Mar 22, 2024
@sunker sunker marked this pull request as ready for review March 22, 2024 12:14
@sunker sunker requested a review from a team as a code owner March 22, 2024 12:14
@sunker sunker requested review from Ukochka and a team and removed request for a team March 22, 2024 12:14
Copy link
Collaborator

@mckn mckn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think there are some more changes we can do to the config editor but lets do that in a follow up PR. Great work on this!

@sunker sunker merged commit 40d4f65 into main Mar 26, 2024
13 checks passed
@sunker sunker deleted the create-plugin/update-templates branch March 26, 2024 08:56
@grafana-plugins-platform-bot
Copy link

🚀 PR was released in @grafana/create-plugin@4.4.0, @grafana/plugin-e2e@0.24.0 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Use grafana/ui components in templates rather than referring to gf class names
2 participants