-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
DataLinks: Fixes datalinks with onClick and variables in url not being interpolated #86253
base: main
Are you sure you want to change the base?
Conversation
Thanks for contributing and fixing this! |
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.
@gng0 thank you for contributing to Grafana 🙌🏾 . I see some failures in our CI, can you update your branch with the latest main?
🙏🏾
Done! @axelavargas |
Hi @torkelo, just wanted to follow up on the continuous-integration/drone/pr build which is pending. The details links me to a page mentioning - "Build is blocked, please, contact repo admin in order to proceed" |
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.
Hey @gng0, I checked the code and noticed some missing href processing in the approach :), I left a comment.
I will be keeping an eye on this PR, as soon as the change is implemented, I will approve :)
@@ -470,7 +470,7 @@ export const getLinksSupplier = | |||
|
|||
if (link.onClick) { | |||
linkModel = { | |||
href: link.url, | |||
href: replaceVariables(link.url, dataLinkScopedVars, VariableFormatID.UriEncode), |
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.
Hey @gng0 👋🏾, thanks for contributing to this change 🙌🏾 . Can you refactor this part to contain the same href processing we do in the else
condition?
.....
if (href) {
href = locationUtil.assureBaseUrl(href.replace(/\n/g, ''));
href = replaceVariables(href, dataLinkScopedVars, VariableFormatID.UriEncode);
href = locationUtil.processUrl(href);
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.
Thanks for catching that @axelavargas
I've just made the change!
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.
🥳
🤔 the CI is failing again, prettier issues: Output of the CI
|
Hi @gng0, The prettier formatting probably doesn't happen because you don't have the pre-commit hooks configured :) https://github.com/grafana/grafana/blob/main/contribute/developer-guide.md#configure-precommit-hooks Can I ask you to give a check, run prettier on the pushed code so we can merge? I can't push to your fork to fix it 😄 Thank you! |
@axelavargas @ivanortegaalba just bumping this 😄 |
Added the replaceVariables method to be used on the link url when an onClick handler is provided.
Fixed a unit test and added another test for this fix. More details in the issue
Fixes #86242