Ver código fonte

feat(): fixed share modal

Torkel Ödegaard 10 anos atrás
pai
commit
3c3d3c9ec6

+ 1 - 1
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'});
       }
 

+ 12 - 1
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
+   });
+ }
 }

+ 2 - 1
public/app/features/panel/partials/soloPanel.html

@@ -2,7 +2,8 @@
 	<div class="row-fluid">
 		<div class="span12">
 			<div class="panel nospace" ng-if="panel" style="width: 100%">
-				<panel-loader type="panel.type" ng-cloak></panel-loader>
+				<panel-loader dashboard="dashboard" row="row" panel="panel">
+				</panel-loader>
 			</div>
 		</div>
 </div>

+ 1 - 6
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();
   });
-
 });

+ 1 - 1
public/app/plugins/panel/dashlist/editor.html

@@ -13,7 +13,7 @@
 			<div class="clearfix"></div>
 		</div>
 	</div>
-	<div class="section" style="margin-bottom: 20px" ng-if="panel.mode === 'search'">
+	<div class="section" style="margin-bottom: 20px" ng-if="ctrl.panel.mode === 'search'">
 		<div class="tight-form last">
 			<ul class="tight-form-list">
 				<li class="tight-form-item" style="width: 110px">