From 3c3d3c9ec6a40e34212e870c41b85b2da294a41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 28 Jan 2016 18:05:49 -0500 Subject: [PATCH] feat(): fixed share modal --- public/app/features/dashboard/shareModalCtrl.js | 2 +- public/app/features/panel/panel_ctrl.ts | 13 ++++++++++++- public/app/features/panel/partials/soloPanel.html | 3 ++- public/app/features/panel/solo_panel_ctrl.js | 7 +------ public/app/plugins/panel/dashlist/editor.html | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/public/app/features/dashboard/shareModalCtrl.js b/public/app/features/dashboard/shareModalCtrl.js index b723660abe7..97abf36c65a 100644 --- a/public/app/features/dashboard/shareModalCtrl.js +++ b/public/app/features/dashboard/shareModalCtrl.js @@ -26,7 +26,7 @@ function (angular, _, require, config) { $scope.modalTitle = 'Share Dashboard'; } - if (!$scope.dashboardMeta.isSnapshot) { + if (!$scope.dashboard.meta.isSnapshot) { $scope.tabs.push({title: 'Snapshot sharing', src: 'shareSnapshot.html'}); } diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 70ffb0e8f4f..1b4749fd1cf 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -100,7 +100,7 @@ export class PanelCtrl { menu.push({text: 'View', click: 'ctrl.viewPanel(); dismiss();'}); menu.push({text: 'Edit', click: 'ctrl.editPanel(); dismiss();', role: 'Editor'}); menu.push({text: 'Duplicate', click: 'ctrl.duplicate()', role: 'Editor' }); - menu.push({text: 'Share', click: 'ctrl.share(); dismiss();'}); + menu.push({text: 'Share', click: 'ctrl.sharePanel(); dismiss();'}); return menu; } @@ -165,4 +165,15 @@ export class PanelCtrl { this.row.panels.splice(index, 0, newPanel); }); } + + sharePanel() { + var shareScope = this.$scope.$new(); + shareScope.panel = this.panel; + shareScope.dashboard = this.dashboard; + + this.publishAppEvent('show-modal', { + src: './app/features/dashboard/partials/shareModal.html', + scope: shareScope + }); + } } diff --git a/public/app/features/panel/partials/soloPanel.html b/public/app/features/panel/partials/soloPanel.html index b040bf8dc72..d2a4f38844f 100644 --- a/public/app/features/panel/partials/soloPanel.html +++ b/public/app/features/panel/partials/soloPanel.html @@ -2,7 +2,8 @@
- + +
diff --git a/public/app/features/panel/solo_panel_ctrl.js b/public/app/features/panel/solo_panel_ctrl.js index c51f9c61a9d..313c2014de2 100644 --- a/public/app/features/panel/solo_panel_ctrl.js +++ b/public/app/features/panel/solo_panel_ctrl.js @@ -39,13 +39,8 @@ function (angular, $) { } $scope.panel.span = 12; - $scope.dashboardViewState = {registerPanel: function() { }, state: {}}; }; - if (!$scope.skipAutoInit) { - $scope.init(); - } - + $scope.init(); }); - }); diff --git a/public/app/plugins/panel/dashlist/editor.html b/public/app/plugins/panel/dashlist/editor.html index 7e8f91ab002..c3b99faa369 100644 --- a/public/app/plugins/panel/dashlist/editor.html +++ b/public/app/plugins/panel/dashlist/editor.html @@ -13,7 +13,7 @@
-
+