Просмотр исходного кода

feat(export): fixed refactoring issue with dynamic dashbord srv

Torkel Ödegaard 9 лет назад
Родитель
Сommit
fc2a069180

+ 3 - 4
public/app/features/dashboard/dashboard_ctrl.ts

@@ -6,7 +6,6 @@ import moment from 'moment';
 import _ from 'lodash';
 
 import coreModule from 'app/core/core_module';
-import {DynamicDashboardSrv} from './dynamic_dashboard_srv';
 
 export class DashboardCtrl {
 
@@ -19,13 +18,13 @@ export class DashboardCtrl {
     templateValuesSrv,
     dashboardSrv,
     unsavedChangesSrv,
+    dynamicDashboardSrv,
     dashboardViewStateSrv,
     contextSrv,
     $timeout) {
 
       $scope.editor = { index: 0 };
       $scope.panels = config.panels;
-      $scope.dynamicDashboardSrv = new DynamicDashboardSrv();
 
       var resizeEventTimeout;
 
@@ -43,7 +42,7 @@ export class DashboardCtrl {
         // template values service needs to initialize completely before
         // the rest of the dashboard can load
         templateValuesSrv.init(dashboard).finally(function() {
-          $scope.dynamicDashboardSrv.init(dashboard);
+          dynamicDashboardSrv.init(dashboard);
 
           unsavedChangesSrv.init(dashboard, $scope);
 
@@ -64,7 +63,7 @@ export class DashboardCtrl {
       };
 
       $scope.templateVariableUpdated = function() {
-        $scope.dynamicDashboardSrv.update($scope.dashboard);
+        dynamicDashboardSrv.update($scope.dashboard);
       };
 
       $scope.updateSubmenuVisibility = function() {

+ 2 - 0
public/app/features/dashboard/dynamic_dashboard_srv.ts

@@ -184,3 +184,5 @@ export class DynamicDashboardSrv {
   }
 }
 
+coreModule.service('dynamicDashboardSrv', DynamicDashboardSrv);
+

+ 0 - 20
public/app/features/dashboard/export/export_modal.html

@@ -23,28 +23,8 @@
 					<i class="fa fa-check"></i>
 				</label>
 			</div>
-			<div class="gf-form gf-form--grow">
-				<label class="gf-form-label width-8">Description</label>
-				<input type="text" class="gf-form-input" ng-model="ctrl.dash.description" ng-change="ctrl.titleChanged()">
-				<label class="gf-form-label text-success" ng-show="ctrl.dash.description">
-					<i class="fa fa-check"></i>
-				</label>
-			</div>
 		</div>
 
-		<!-- <h3 class="section&#45;heading"> -->
-		<!-- 	Dashboard data sources -->
-		<!-- </h3> -->
-		<!--  -->
-		<!-- <div class="gf&#45;form&#45;group"> -->
-		<!-- 	<div class="gf&#45;form&#45;inline" ng&#45;repeat="input in ctrl.dash.__inputs"> -->
-		<!-- 		<div class="gf&#45;form width&#45;25"> -->
-		<!-- 			<label class="gf&#45;form&#45;label width&#45;8">Name</label> -->
-		<!-- 			<input type="text" class="gf&#45;form&#45;input" ng&#45;model="input.name"> -->
-		<!-- 		</div> -->
-		<!-- 	</div> -->
-		<!-- </div> -->
-
 		<div class="gf-form-button-row">
 			<button type="button" class="btn gf-form-btn width-10 btn-success" ng-click="ctrl.save()">
 				<i class="fa fa-save"></i> Save to file

+ 0 - 2
public/app/features/dashboard/submenu/submenu.ts

@@ -12,7 +12,6 @@ export class SubmenuCtrl {
   constructor(private $rootScope,
               private templateValuesSrv,
               private templateSrv,
-              private dynamicDashboardSrv,
               private $location) {
     this.annotations = this.dashboard.templating.list;
     this.variables = this.dashboard.templating.list;
@@ -45,7 +44,6 @@ export class SubmenuCtrl {
 
   variableUpdated(variable) {
     this.templateValuesSrv.variableUpdated(variable).then(() => {
-      this.dynamicDashboardSrv.update(this.dashboard);
       this.updateUrlParamsWithCurrentVariables();
       this.$rootScope.$emit('template-variable-value-updated');
       this.$rootScope.$broadcast('refresh');