Commit 17de1f28 by Torkel Ödegaard Committed by GitHub

Merge pull request #14646 from grafana/fix-dashboard-links

Fixed dashboard links not updating after variable or time range change
parents 0fd403a7 002f57ae
...@@ -6,6 +6,7 @@ function dashLinksContainer() { ...@@ -6,6 +6,7 @@ function dashLinksContainer() {
return { return {
scope: { scope: {
links: '=', links: '=',
dashboard: '=',
}, },
restrict: 'E', restrict: 'E',
controller: 'DashLinksContainerCtrl', controller: 'DashLinksContainerCtrl',
...@@ -20,6 +21,8 @@ function dashLink($compile, $sanitize, linkSrv) { ...@@ -20,6 +21,8 @@ function dashLink($compile, $sanitize, linkSrv) {
restrict: 'E', restrict: 'E',
link: (scope, elem) => { link: (scope, elem) => {
const link = scope.link; const link = scope.link;
const dashboard = scope.dashboard;
let template = let template =
'<div class="gf-form">' + '<div class="gf-form">' +
'<a class="pointer gf-form-label" data-placement="bottom"' + '<a class="pointer gf-form-label" data-placement="bottom"' +
...@@ -76,7 +79,7 @@ function dashLink($compile, $sanitize, linkSrv) { ...@@ -76,7 +79,7 @@ function dashLink($compile, $sanitize, linkSrv) {
} }
update(); update();
scope.$on('refresh', update); dashboard.events.on('refresh', update, scope);
}, },
}; };
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
<div ng-if="ctrl.dashboard.links.length > 0" > <div ng-if="ctrl.dashboard.links.length > 0" >
<dash-links-container links="ctrl.dashboard.links" class="gf-form-inline"></dash-links-container> <dash-links-container links="ctrl.dashboard.links" dashboard="ctrl.dashboard" class="gf-form-inline"></dash-links-container>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment