diff --git a/pkg/api/api.go b/pkg/api/api.go index 4fc76a6e8ba..4683e95fa40 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -43,6 +43,7 @@ func Register(r *macaron.Macaron) { // dashboard snapshots r.Post("/api/snapshots/", bind(m.CreateDashboardSnapshotCommand{}), CreateDashboardSnapshot) + r.Get("/dashboard/snapshots/*", Index) r.Get("/api/snapshots/:key", GetDashboardSnapshot) // authed api diff --git a/src/app/features/dashboard/dashboardSrv.js b/src/app/features/dashboard/dashboardSrv.js index 90ec885ed41..77b19b3edd2 100644 --- a/src/app/features/dashboard/dashboardSrv.js +++ b/src/app/features/dashboard/dashboardSrv.js @@ -67,6 +67,16 @@ function (angular, $, kbn, _, moment) { return max + 1; }; + p.forEachPanel = function(callback) { + var i, j, row; + for (i = 0; i < this.rows.length; i++) { + row = this.rows[i]; + for (j = 0; j < row.panels.length; j++) { + callback(row.panels[j], row); + } + } + }; + p.rowSpan = function(row) { return _.reduce(row.panels, function(p,v) { return p + v.span; diff --git a/src/app/features/dashboard/partials/shareDashboard.html b/src/app/features/dashboard/partials/shareDashboard.html index 1afd4a20a84..bfe126b390f 100644 --- a/src/app/features/dashboard/partials/shareDashboard.html +++ b/src/app/features/dashboard/partials/shareDashboard.html @@ -1,7 +1,7 @@ -
-
Share dashboard and data with anyone
-

- +

+ + + +
+
+ +
+
+
    +
  • + Snapshot name +
  • +
  • + +
  • +
+
+
+
+ +
+ +
+
+
+ + + + + +

+ + This will create a snapshot of the dashboard and the data currently visible. It will be saved and you will get a link, anyone with this link will be able view view the dashboard and the data currently visible. + + Panel metric queries and panel drilldown links are removed.

-
-
-
    -
  • - Snapshot name -
  • -
  • - -
  • -
-
-
-
- -
-
- - - - -
-
- - - - -
diff --git a/src/app/features/dashboard/shareSnapshotCtrl.js b/src/app/features/dashboard/shareSnapshotCtrl.js index acc0f38d946..6f4e21cd70d 100644 --- a/src/app/features/dashboard/shareSnapshotCtrl.js +++ b/src/app/features/dashboard/shareSnapshotCtrl.js @@ -21,6 +21,11 @@ function (angular) { var dash = angular.copy($scope.dashboard); dash.title = $scope.snapshot.name; + dash.forEachPanel(function(panel){ + panel.targets = []; + panel.links = []; + }); + var apiUrl = '/api/snapshots'; if (makePublic) { diff --git a/src/css/less/gfbox.less b/src/css/less/gfbox.less index 12b16974162..995ccb5b435 100644 --- a/src/css/less/gfbox.less +++ b/src/css/less/gfbox.less @@ -96,3 +96,21 @@ } } } + +.share-snapshot { + text-align: center; + + .share-snapshot-header { + .fa { + position: absolute; + font-size: 600%; + left: 41%; + color: @grafanaTargetFuncBackground; + z-index: -1; + } + + position: relative; + z-index: 1000; + line-height: 106px; + } +}