From c42d09b26759fe0adc0fb303a6276dc69ed6e81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 29 Mar 2015 15:01:27 +0200 Subject: [PATCH] Enabled snapshot sharing of single panels, enabled sharing of snapshot dashboards (but you cannot snapshot a snapshot --- public/app/features/dashboard/dashboardSrv.js | 13 +++++ .../dashboard/partials/shareModal.html | 4 +- .../app/features/dashboard/shareModalCtrl.js | 20 +++---- .../features/dashboard/shareSnapshotCtrl.js | 58 +++++++++++-------- public/app/features/panel/soloPanelCtrl.js | 16 +---- public/test/specs/helpers.js | 1 + public/test/specs/shareModalCtrl-specs.js | 17 +++--- 7 files changed, 67 insertions(+), 62 deletions(-) diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 20f04b421d7..dc01a328b12 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -78,6 +78,19 @@ function (angular, $, kbn, _, moment) { } }; + p.getPanelById = function(id) { + for (var i = 0; i < this.rows.length; i++) { + var row = this.rows[i]; + for (var j = 0; j < row.panels.length; j++) { + var panel = row.panels[j]; + if (panel.id === id) { + return panel; + } + } + } + return null; + }; + p.rowSpan = function(row) { return _.reduce(row.panels, function(p,v) { return p + v.span; diff --git a/public/app/features/dashboard/partials/shareModal.html b/public/app/features/dashboard/partials/shareModal.html index b6b722465f9..881d30ada97 100644 --- a/public/app/features/dashboard/partials/shareModal.html +++ b/public/app/features/dashboard/partials/shareModal.html @@ -1,4 +1,4 @@ -