diff --git a/src/app/features/dashboard/partials/shareDashboard.html b/src/app/features/dashboard/partials/shareDashboard.html index f96fe844a89..1afd4a20a84 100644 --- a/src/app/features/dashboard/partials/shareDashboard.html +++ b/src/app/features/dashboard/partials/shareDashboard.html @@ -82,6 +82,11 @@ + + diff --git a/src/app/features/dashboard/shareSnapshotCtrl.js b/src/app/features/dashboard/shareSnapshotCtrl.js index 2f316c71ada..acc0f38d946 100644 --- a/src/app/features/dashboard/shareSnapshotCtrl.js +++ b/src/app/features/dashboard/shareSnapshotCtrl.js @@ -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() {