Commit 0c56ae4f by Torkel Ödegaard

more work on, #1944

parent 1e196fc0
...@@ -75,7 +75,7 @@ function (angular, $, config) { ...@@ -75,7 +75,7 @@ function (angular, $, config) {
}; };
$scope.updateSubmenuVisibility = function() { $scope.updateSubmenuVisibility = function() {
$scope.submenuEnabled = $scope.dashboard.hasTemplateVarsOrAnnotations(); $scope.submenuEnabled = $scope.dashboard.isSubmenuFeaturesEnabled();
}; };
$scope.setWindowTitleAndTheme = function() { $scope.setWindowTitleAndTheme = function() {
......
...@@ -146,8 +146,8 @@ function (angular, $, kbn, _, moment) { ...@@ -146,8 +146,8 @@ function (angular, $, kbn, _, moment) {
row.panels.push(panel); row.panels.push(panel);
}; };
p.hasTemplateVarsOrAnnotations = function() { p.isSubmenuFeaturesEnabled = function() {
return this.templating.list.length > 0 || this.annotations.list.length > 0; return this.templating.list.length > 0 || this.annotations.list.length > 0 || this.links.length > 0;
}; };
p.getPanelInfoById = function(panelId) { p.getPanelInfoById = function(panelId) {
......
<h5>dash links</h5> <a class="pointer">
<i class="fa fa-th-large"></i>
<span></span>
</a>
...@@ -13,23 +13,36 @@ function (angular, _) { ...@@ -13,23 +13,36 @@ function (angular, _) {
dashboard: "=" dashboard: "="
}, },
restrict: 'E', restrict: 'E',
controller: 'DashLinkCtrl', controller: 'DashLinkEditorCtrl',
templateUrl: 'app/features/dashlinks/editor.html', templateUrl: 'app/features/dashlinks/editor.html',
link: function() { link: function() {
} }
}; };
}).directive('dashLinks', function() { }).directive('dashLink', function(linkSrv) {
return { return {
scope: { scope: {
dashboard: "=" link: "="
}, },
restrict: 'E', restrict: 'E',
controller: 'DashLinkCtrl', controller: 'DashLinkCtrl',
templateUrl: 'app/features/dashlinks/module.html', 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 || []; $scope.dashboard.links = $scope.dashboard.links || [];
......
...@@ -16,7 +16,6 @@ function (angular, kbn) { ...@@ -16,7 +16,6 @@ function (angular, kbn) {
info.href = templateSrv.replace(link.url || ''); info.href = templateSrv.replace(link.url || '');
info.title = templateSrv.replace(link.title || ''); info.title = templateSrv.replace(link.title || '');
info.href += '?'; info.href += '?';
} }
else { else {
info.title = templateSrv.replace(link.title || ''); info.title = templateSrv.replace(link.title || '');
......
...@@ -19,12 +19,7 @@ ...@@ -19,12 +19,7 @@
</ul> </ul>
<ul class="tight-form-list pull-right" ng-if="dashboard.links.length > 0"> <ul class="tight-form-list pull-right" ng-if="dashboard.links.length > 0">
<li ng-repeat="link in dashboard.links" class="tight-form-item"> <dash-link ng-repeat="link in dashboard.links" link="link" class="tight-form-item"></dash-link>
<a class="pointer">
<i class="fa fa-th-large"></i>
{{link.title}}
</a>
</li>
</ul> </ul>
<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