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

Docs: Add documentation about setMigrationHandler for panels #1213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

academo
Copy link
Member

@academo academo commented Oct 14, 2024

What this PR does / why we need it:

Adds a documentation page for the setMigrationHandlers for panels.

Which issue(s) this PR fixes:

closes #1128

Special notes for your reviewer:

@academo academo requested a review from a team as a code owner October 14, 2024 09:48
@academo academo requested review from jackw and removed request for a team October 14, 2024 09:48
Copy link

github-actions bot commented Oct 14, 2024

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

✨ This PR can be merged. It will not be considered when calculating future versions of the npm packages and will not appear in the changelogs.

@academo academo added type/docs Changes only affect the documentation no-changelog Don't include in changelog and version calculations documentation Changes only affect the documentation and removed no-changelog Don't include in changelog and version calculations labels Oct 14, 2024
Copy link
Contributor

@andresmgot andresmgot left a comment

Choose a reason for hiding this comment

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

Mostly LGTM! I have some small sugestions / questions.


# Add a migration handler to your panel plugin

As you develop and maintain your Grafana panel plugin, you may need to make changes to the panel options structure. These changes can potentially break existing dashboard configurations.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd mention that if breaking changes exist, the major version should be bumped and migration guidance should be provided.

}
```

### Version-specific adjustments
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe also an example to check the plugin version? something like:

  const pluginVersion = panel?.pluginVersion ?? '';
  if (pluginVersion.startsWith('1.0')) {
    // Do migration
  }

Comment on lines +43 to +45
The migration handler is only called when the stored panel version differs from the loaded panel version. (e.g. after an update)

The migration handler will be called until the user manually edits and saves the panel.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe...

Suggested change
The migration handler is only called when the stored panel version differs from the loaded panel version. (e.g. after an update)
The migration handler will be called until the user manually edits and saves the panel.
The migration handler is only called when the installed plugin version differs from the version used to generate a panel. Changes made to the panel are not automatically persisted, users need to manually save the dashboard after a panel is migrated.

@@ -0,0 +1,151 @@
---
id: migration-handler-for-panels
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure how to structure this but I was thinking on a generic page with general information about plugin migrations (e.g. when to use it) and then split in different pages:

  • Migrations for panel plugins
  • Migration for frontend datasources
  • Migration for backend datasources
  • (Maybe in the future?) Migration for apps

I guess this is fine for the first guide but we may need to restructure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation no-changelog Don't include in changelog and version calculations type/docs Changes only affect the documentation
Projects
Status: 🔬 In review
Development

Successfully merging this pull request may close these issues.

Docs: Add docs about setMigrationHandler
2 participants