mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
Merge pull request #3008 from mtanda/prometheus_link
Revert prometheus graph view link
This commit is contained in:
commit
89eedd59a8
@ -21,6 +21,7 @@ function (angular, _, moment, dateMath) {
|
||||
this.name = datasource.name;
|
||||
this.supportMetrics = true;
|
||||
this.url = datasource.url;
|
||||
this.directUrl = datasource.directUrl;
|
||||
this.basicAuth = datasource.basicAuth;
|
||||
this.lastErrors = {};
|
||||
}
|
||||
|
@ -110,6 +110,11 @@
|
||||
ng-change="refreshMetricData()">
|
||||
</select>
|
||||
</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>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
@ -44,6 +44,21 @@ function (angular, _) {
|
||||
.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();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user