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

Main improved dashboard links #622

Merged
merged 9 commits into from
Sep 29, 2023

Conversation

padraic-padraic
Copy link
Contributor

What does this do?

Extends the implementation of DashboardLink to support creating both direct links and lists of dashboards.

Why is it a good idea?

This enables grafanalib users to fully employ the DashboardLink feature. The previous JSON model was no longer accurate for recent grafana versions, meaning dashboard links were not properly generated. Here we add all available fields, allowing users to create dashboard links correctly from grafanalib.

Context

Dashboard Links are a way to create links along the top of a dashboard, linking either to other sets of dashboards from the same organization or arbitrary external resources. See the documentation here: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/manage-dashboard-links/#manage-dashboard-links

Questions

I have removed a parameter from the old DashboardLink class, dashboard; this could consistute a breaking change.

This parameter was not actually consumed by Grafana, so was in effect only acting as an internal alias to the title field. The title would only be shown if the DashboardLink.type attribute is set to link, something actually not possible before this PR. so I don't consider it to be a significant change. But, if desired, we can retain that alias-like behaviour to maintain API compatability.

@padraic-padraic
Copy link
Contributor Author

Thanks for approving the workflows, will work to correct the tests shortly!

@padraic-padraic
Copy link
Contributor Author

Looks like the issue is with py37/38 support, will push some fixes shortly.

@padraic-padraic
Copy link
Contributor Author

Running locally against Python 3.8 passes now, screenshot is provided 🙂
Screenshot 2023-09-08 at 10 50 57

Copy link
Collaborator

@JamesGibo JamesGibo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR it looks really good and well documented.
I spotted one issue that might be type that I would like you to check.

If you had time, you could add a test for this class to the tests, but as this Class did not previously have a test, I am happy to merge without this.

grafanalib/core.py Show resolved Hide resolved
Includes the ability to create direct links or a list of dashboard links,
extra options like includeVars and targetBlank.
Removing this parameter is a breaking change... It didn't actually
impact the generated link, other than acting as an alias to 'title'
in some cases. If preferred, I can restore it to retain that alias
behaviour, and perhaps add a warning log message?
Copy link
Collaborator

@JamesGibo JamesGibo left a comment

Choose a reason for hiding this comment

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

LGTM

@JamesGibo JamesGibo merged commit 6f36ce6 into weaveworks:main Sep 29, 2023
5 checks passed
@padraic-padraic padraic-padraic deleted the main-improved-dashboard-links branch July 24, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants