From 7614ddb318b65133c3ddf5d77219a5601932dc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 Mar 2015 13:58:30 -0400 Subject: [PATCH] Updated design for snapshot sharing dialog, #1596 --- pkg/api/api.go | 1 + src/app/features/dashboard/dashboardSrv.js | 10 ++ .../dashboard/partials/shareDashboard.html | 93 +++++++++++-------- .../features/dashboard/shareSnapshotCtrl.js | 5 + src/css/less/gfbox.less | 18 ++++ 5 files changed, 89 insertions(+), 38 deletions(-) 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
-

- +

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; + } +}