diff --git a/public/app/features/dashlinks/module.js b/public/app/features/dashlinks/module.js index 7be8ffbd87b..9fc1bc4d4b5 100644 --- a/public/app/features/dashlinks/module.js +++ b/public/app/features/dashlinks/module.js @@ -105,7 +105,7 @@ function (angular, _) { }]); } - return $scope.searchDashboards(linkDef); + return $scope.searchDashboards(linkDef, 7); } if (linkDef.type === 'link') { @@ -131,8 +131,8 @@ function (angular, _) { }); } - $scope.searchDashboards = function(link) { - return backendSrv.search({tag: link.tags}).then(function(results) { + $scope.searchDashboards = function(link, limit) { + return backendSrv.search({tag: link.tags, limit: limit}).then(function(results) { return _.reduce(results, function(memo, dash) { // do not add current dashboard if (dash.id !== currentDashId) { @@ -150,7 +150,7 @@ function (angular, _) { }; $scope.fillDropdown = function(link) { - $scope.searchDashboards(link).then(function(results) { + $scope.searchDashboards(link, 100).then(function(results) { _.each(results, function(hit) { hit.url = linkSrv.getLinkUrl(hit); }); diff --git a/public/app/features/panellinks/linkSrv.js b/public/app/features/panellinks/linkSrv.js index 2f943b13f08..c11cdb40b52 100644 --- a/public/app/features/panellinks/linkSrv.js +++ b/public/app/features/panellinks/linkSrv.js @@ -62,21 +62,34 @@ function (angular, kbn, _) { this.getPanelLinkAnchorInfo = function(link) { var info = {}; if (link.type === 'absolute') { - info.target = '_blank'; + info.target = link.targetBlank ? '_blank' : ''; info.href = templateSrv.replace(link.url || ''); info.title = templateSrv.replace(link.title || ''); info.href += '?'; } + else if (link.dashUri) { + info.href = 'dashboard/' + link.dashUri + '?'; + info.title = templateSrv.replace(link.title || ''); + } else { info.title = templateSrv.replace(link.title || ''); var slug = kbn.slugifyForUrl(link.dashboard || ''); info.href = 'dashboard/db/' + slug + '?'; } - var range = timeSrv.timeRangeForUrl(); - info.href += 'from=' + range.from; - info.href += '&to=' + range.to; + var params = {}; + if (link.keepTime) { + var range = timeSrv.timeRangeForUrl(); + params['from'] = range.from; + params['to'] = range.to; + } + + if (link.includeVars) { + templateSrv.fillVariableValuesForUrl(params); + } + + info.href = this.addParamsToUrl(info.href, params); if (link.params) { info.href += "&" + templateSrv.replace(link.params); } diff --git a/public/app/features/panellinks/module.html b/public/app/features/panellinks/module.html index 7b3020e587e..99f93d21eda 100644 --- a/public/app/features/panellinks/module.html +++ b/public/app/features/panellinks/module.html @@ -2,49 +2,73 @@