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

Plugins: Extend panel menu with links from plugins #63089

Merged
merged 41 commits into from Mar 2, 2023

Conversation

jackw
Copy link
Contributor

@jackw jackw commented Feb 8, 2023

What is this feature?
This PR adds the functionality for app plugins to add additional menu items to the dashboard panel menu.

In PR #61663 we introduced the plugin extension registry and allowed links to be registered statically via plugin.json. Whilst working on this PR we've decided to remove this in favour of only allowing extension links to be registered via the AppPlugin APIs. We believe this will make it much easier for us and plugin developers to understand and maintain.

The example below show case how to extend the dashboard panel menu with a link:

  1. First of all you need to enable preload: true for your plugin. We are collecting the extensions during the preload process of a plugin.
  2. Secondly you need to configure an extension for your plugin. Example: https://github.com/grafana/grafana-plugin-examples/blob/mckn/plugin-link-tests/examples/app-basic/src/module.ts
  3. You can now navigate to a dashboard and enjoy the power of plugin extensions in the panel menu.

extensions

Why do we need this feature?
To improve the user experience by making the UI feel less fragmented into different apps rather than one unified experience.

Who is this feature for?
End users and plugin developers

Which issue(s) does this PR fix?:
Related Epic #61658

Special notes for your reviewer:

Todo:

  • Limit the length of the extension title prior to rendering it in the menu.
  • Set a max number of items a plugin can add to the menu.
  • Add id to the extension so we have something to connect the dynamic part to.
  • Running configure function in a context with error handling.
  • Make sure that we don't explode if a promise is returned in the configure function.
  • Should we allow the path to be configured? Maybe only query string params?
  • Make sure that the panel context contains most of the information available in the panel.
  • Remove ability to register extension links statically via plugin.json.
  • Add validation of the values passed in the configureLinkExtension function.

@mckn mckn added the no-changelog Skip including change in changelog/release notes label Feb 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2023

⚠️   Possible breaking changes

(Open the links below in a new tab to go to the correct steps)

grafana-data has possible breaking changes (more info)
grafana-runtime has possible breaking changes (more info)

Console output
Read our guideline

@grafanabot grafanabot added the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Feb 9, 2023
@mckn mckn removed the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Feb 13, 2023
@mckn
Copy link
Contributor

mckn commented Feb 13, 2023

⚠️   Possible breaking changes

(Open the links below in a new tab to go to the correct steps)

grafana-runtime has possible breaking changes (more info)

Console output Read our guideline

This feature is not yet released as part of a Grafana version so it is okay for us to break the APIs.

@mckn mckn added add to changelog and removed no-changelog Skip including change in changelog/release notes labels Feb 13, 2023
@grafanabot grafanabot added the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Feb 13, 2023
@mckn mckn requested review from a team, Eve832 and josmperez as code owners February 23, 2023 13:30
@mckn mckn requested review from ashharrison90, mckn, dprokop, ivanortegaalba, marefr, andresmgot, sakjur, papagian, yangkb09 and academo and removed request for a team and mckn February 23, 2023 13:30
Copy link
Contributor

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@jackw jackw merged commit 8c8f584 into main Mar 2, 2023
@jackw jackw deleted the panel-menu-link-extensions branch March 2, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/backend area/frontend area/plugins/app App Plugins area/plugins levitate breaking change A label indicating a breaking change and assigned by Levitate. no-backport Skip backport of PR type/docs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants