Commit fc2a0691 by Torkel Ödegaard

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

parent 39240713
...@@ -6,7 +6,6 @@ import moment from 'moment'; ...@@ -6,7 +6,6 @@ import moment from 'moment';
import _ from 'lodash'; import _ from 'lodash';
import coreModule from 'app/core/core_module'; import coreModule from 'app/core/core_module';
import {DynamicDashboardSrv} from './dynamic_dashboard_srv';
export class DashboardCtrl { export class DashboardCtrl {
...@@ -19,13 +18,13 @@ export class DashboardCtrl { ...@@ -19,13 +18,13 @@ export class DashboardCtrl {
templateValuesSrv, templateValuesSrv,
dashboardSrv, dashboardSrv,
unsavedChangesSrv, unsavedChangesSrv,
dynamicDashboardSrv,
dashboardViewStateSrv, dashboardViewStateSrv,
contextSrv, contextSrv,
$timeout) { $timeout) {
$scope.editor = { index: 0 }; $scope.editor = { index: 0 };
$scope.panels = config.panels; $scope.panels = config.panels;
$scope.dynamicDashboardSrv = new DynamicDashboardSrv();
var resizeEventTimeout; var resizeEventTimeout;
...@@ -43,7 +42,7 @@ export class DashboardCtrl { ...@@ -43,7 +42,7 @@ export class DashboardCtrl {
// template values service needs to initialize completely before // template values service needs to initialize completely before
// the rest of the dashboard can load // the rest of the dashboard can load
templateValuesSrv.init(dashboard).finally(function() { templateValuesSrv.init(dashboard).finally(function() {
$scope.dynamicDashboardSrv.init(dashboard); dynamicDashboardSrv.init(dashboard);
unsavedChangesSrv.init(dashboard, $scope); unsavedChangesSrv.init(dashboard, $scope);
...@@ -64,7 +63,7 @@ export class DashboardCtrl { ...@@ -64,7 +63,7 @@ export class DashboardCtrl {
}; };
$scope.templateVariableUpdated = function() { $scope.templateVariableUpdated = function() {
$scope.dynamicDashboardSrv.update($scope.dashboard); dynamicDashboardSrv.update($scope.dashboard);
}; };
$scope.updateSubmenuVisibility = function() { $scope.updateSubmenuVisibility = function() {
......
...@@ -184,3 +184,5 @@ export class DynamicDashboardSrv { ...@@ -184,3 +184,5 @@ export class DynamicDashboardSrv {
} }
} }
coreModule.service('dynamicDashboardSrv', DynamicDashboardSrv);
...@@ -23,28 +23,8 @@ ...@@ -23,28 +23,8 @@
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
</label> </label>
</div> </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> </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"> <div class="gf-form-button-row">
<button type="button" class="btn gf-form-btn width-10 btn-success" ng-click="ctrl.save()"> <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 <i class="fa fa-save"></i> Save to file
......
...@@ -12,7 +12,6 @@ export class SubmenuCtrl { ...@@ -12,7 +12,6 @@ export class SubmenuCtrl {
constructor(private $rootScope, constructor(private $rootScope,
private templateValuesSrv, private templateValuesSrv,
private templateSrv, private templateSrv,
private dynamicDashboardSrv,
private $location) { private $location) {
this.annotations = this.dashboard.templating.list; this.annotations = this.dashboard.templating.list;
this.variables = this.dashboard.templating.list; this.variables = this.dashboard.templating.list;
...@@ -45,7 +44,6 @@ export class SubmenuCtrl { ...@@ -45,7 +44,6 @@ export class SubmenuCtrl {
variableUpdated(variable) { variableUpdated(variable) {
this.templateValuesSrv.variableUpdated(variable).then(() => { this.templateValuesSrv.variableUpdated(variable).then(() => {
this.dynamicDashboardSrv.update(this.dashboard);
this.updateUrlParamsWithCurrentVariables(); this.updateUrlParamsWithCurrentVariables();
this.$rootScope.$emit('template-variable-value-updated'); this.$rootScope.$emit('template-variable-value-updated');
this.$rootScope.$broadcast('refresh'); this.$rootScope.$broadcast('refresh');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment