diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js
index d8772fa3988..04ef5ae4f2d 100644
--- a/public/app/features/dashboard/dashboardCtrl.js
+++ b/public/app/features/dashboard/dashboardCtrl.js
@@ -75,7 +75,7 @@ function (angular, $, config) {
};
$scope.updateSubmenuVisibility = function() {
- $scope.submenuEnabled = $scope.dashboard.hasTemplateVarsOrAnnotations();
+ $scope.submenuEnabled = $scope.dashboard.isSubmenuFeaturesEnabled();
};
$scope.setWindowTitleAndTheme = function() {
diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js
index 2cc73aaeb9f..303ba32c650 100644
--- a/public/app/features/dashboard/dashboardSrv.js
+++ b/public/app/features/dashboard/dashboardSrv.js
@@ -146,8 +146,8 @@ function (angular, $, kbn, _, moment) {
row.panels.push(panel);
};
- p.hasTemplateVarsOrAnnotations = function() {
- return this.templating.list.length > 0 || this.annotations.list.length > 0;
+ p.isSubmenuFeaturesEnabled = function() {
+ return this.templating.list.length > 0 || this.annotations.list.length > 0 || this.links.length > 0;
};
p.getPanelInfoById = function(panelId) {
diff --git a/public/app/features/dashlinks/module.html b/public/app/features/dashlinks/module.html
index a1f2b719bf3..951d530ae8c 100644
--- a/public/app/features/dashlinks/module.html
+++ b/public/app/features/dashlinks/module.html
@@ -1 +1,4 @@
-
dash links
+
+
+
+
diff --git a/public/app/features/dashlinks/module.js b/public/app/features/dashlinks/module.js
index a15bcacc670..78d7265c387 100644
--- a/public/app/features/dashlinks/module.js
+++ b/public/app/features/dashlinks/module.js
@@ -13,23 +13,36 @@ function (angular, _) {
dashboard: "="
},
restrict: 'E',
- controller: 'DashLinkCtrl',
+ controller: 'DashLinkEditorCtrl',
templateUrl: 'app/features/dashlinks/editor.html',
link: function() {
}
};
- }).directive('dashLinks', function() {
+ }).directive('dashLink', function(linkSrv) {
return {
scope: {
- dashboard: "="
+ link: "="
},
restrict: 'E',
controller: 'DashLinkCtrl',
templateUrl: 'app/features/dashlinks/module.html',
- link: function() {
+ link: function(scope, elem) {
+
+ function update() {
+ var linkInfo = linkSrv.getPanelLinkAnchorInfo(scope.link);
+ elem.find("span").text(linkInfo.title);
+ elem.find("a").attr("href", linkInfo.href);
+ }
+
+ update();
+ scope.$on('refresh', update);
}
};
- }).controller('DashLinkCtrl', function($scope, backendSrv) {
+ })
+ .controller("DashLinkCtrl", function($scope) {
+
+ })
+ .controller('DashLinkEditorCtrl', function($scope, backendSrv) {
$scope.dashboard.links = $scope.dashboard.links || [];
diff --git a/public/app/features/panellinks/linkSrv.js b/public/app/features/panellinks/linkSrv.js
index b877a76a0fa..1ba85976c8e 100644
--- a/public/app/features/panellinks/linkSrv.js
+++ b/public/app/features/panellinks/linkSrv.js
@@ -16,7 +16,6 @@ function (angular, kbn) {
info.href = templateSrv.replace(link.url || '');
info.title = templateSrv.replace(link.title || '');
info.href += '?';
-
}
else {
info.title = templateSrv.replace(link.title || '');
diff --git a/public/app/partials/submenu.html b/public/app/partials/submenu.html
index 7fa9ce5c7eb..58d8fffe9d5 100644
--- a/public/app/partials/submenu.html
+++ b/public/app/partials/submenu.html
@@ -19,12 +19,7 @@