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

Dashboard: fixed init of editable setting, #837

Torkel Ödegaard 11 лет назад
Родитель
Сommit
010baad532
2 измененных файлов с 17 добавлено и 1 удалено
  1. 1 1
      src/app/services/dashboard/dashboardSrv.js
  2. 16 0
      src/test/specs/dashboardSrv-specs.js

+ 1 - 1
src/app/services/dashboard/dashboardSrv.js

@@ -25,7 +25,7 @@ function (angular, $, kbn, _, moment) {
       this.tags = data.tags || [];
       this.style = data.style || "dark";
       this.timezone = data.timezone || 'browser';
-      this.editable = data.editable || true;
+      this.editable = data.editable === false ? false : true;
       this.hideControls = data.hideControls || false;
       this.rows = data.rows || [];
       this.nav = data.nav || [];

+ 16 - 0
src/test/specs/dashboardSrv-specs.js

@@ -82,6 +82,22 @@ define([
 
   });
 
+  describe('when creating dashboard with editable false', function() {
+    var model;
+
+    beforeEach(module('grafana.services'));
+    beforeEach(inject(function(dashboardSrv) {
+      model = dashboardSrv.create({
+        editable: false
+      });
+    }));
+
+    it('should set editable false', function() {
+      expect(model.editable).to.be(false);
+    });
+
+  });
+
   describe('when creating dashboard with old schema', function() {
     var model;
     var graph;