mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added public snapshot test, hosted on snapshots.raintank.io
This commit is contained in:
parent
49a0ea53c7
commit
a5fac17f2b
@ -82,6 +82,11 @@
|
||||
<i ng-if="loading" class="fa fa-spinner fa-spin"></i>
|
||||
</button>
|
||||
|
||||
<button class="btn btn-primary btn" ng-click="createSnapshot(true)" ng-if="!snapshotUrl" ng-disabled="loading">
|
||||
Create Public snapshot (snapshots.raintank.io)
|
||||
<i ng-if="loading" class="fa fa-spinner fa-spin"></i>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -12,17 +12,29 @@ function (angular) {
|
||||
name: $scope.dashboard.title
|
||||
};
|
||||
|
||||
$scope.createSnapshot = function() {
|
||||
$scope.createSnapshot = function(makePublic) {
|
||||
$scope.dashboard.snapshot = true;
|
||||
$scope.loading = true;
|
||||
$rootScope.$broadcast('refresh');
|
||||
|
||||
$timeout(function() {
|
||||
var dash = angular.copy($scope.dashboard);
|
||||
backendSrv.post('/api/snapshots/', {dashboard: dash}).then(function(results) {
|
||||
dash.title = $scope.snapshot.name;
|
||||
|
||||
var apiUrl = '/api/snapshots';
|
||||
|
||||
if (makePublic) {
|
||||
apiUrl = 'http://snapshots.raintank.io/api/snapshots';
|
||||
}
|
||||
|
||||
backendSrv.post(apiUrl, {dashboard: dash}).then(function(results) {
|
||||
$scope.loading = false;
|
||||
|
||||
var baseUrl = $location.absUrl().replace($location.url(), "");
|
||||
if (makePublic) {
|
||||
baseUrl = 'http://snapshots.raintank.io';
|
||||
}
|
||||
|
||||
$scope.snapshotUrl = baseUrl + '/dashboard/snapshots/' + results.key;
|
||||
|
||||
}, function() {
|
||||
|
Loading…
Reference in New Issue
Block a user