Commit 89eedd59 by Torkel Ödegaard

Merge pull request #3008 from mtanda/prometheus_link

Revert prometheus graph view link
parents 89ce1a51 c1d592b7
...@@ -21,6 +21,7 @@ function (angular, _, moment, dateMath) { ...@@ -21,6 +21,7 @@ function (angular, _, moment, dateMath) {
this.name = datasource.name; this.name = datasource.name;
this.supportMetrics = true; this.supportMetrics = true;
this.url = datasource.url; this.url = datasource.url;
this.directUrl = datasource.directUrl;
this.basicAuth = datasource.basicAuth; this.basicAuth = datasource.basicAuth;
this.lastErrors = {}; this.lastErrors = {};
} }
......
...@@ -110,6 +110,11 @@ ...@@ -110,6 +110,11 @@
ng-change="refreshMetricData()"> ng-change="refreshMetricData()">
</select> </select>
</li> </li>
<li class="tight-form-item">
<a href="{{linkToPrometheus()}}" target="_blank" bs-tooltip="'Link to Graph in Prometheus'">
<i class="fa fa-share-square-o"></i>
</a>
</li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
......
...@@ -44,6 +44,21 @@ function (angular, _) { ...@@ -44,6 +44,21 @@ function (angular, _) {
.then(callback); .then(callback);
}; };
$scope.linkToPrometheus = function() {
var range = Math.ceil(($scope.range.to.valueOf() - $scope.range.from.valueOf()) / 1000);
var endTime = $scope.range.to.utc().format('YYYY-MM-DD HH:MM');
var expr = {
expr: $scope.target.expr,
range_input: range + 's',
end_input: endTime,
step_input: '',
stacked: $scope.panel.stack,
tab: 0
};
var hash = encodeURIComponent(JSON.stringify([expr]));
return $scope.datasource.directUrl + '/graph#' + hash;
};
$scope.init(); $scope.init();
}); });
......
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