From 010baad5327afb67909be3aee81400ac12416fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 22 Sep 2014 12:54:02 +0200 Subject: [PATCH] Dashboard: fixed init of editable setting, #837 --- src/app/services/dashboard/dashboardSrv.js | 2 +- src/test/specs/dashboardSrv-specs.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app/services/dashboard/dashboardSrv.js b/src/app/services/dashboard/dashboardSrv.js index c6b386917ba..17313a207d5 100644 --- a/src/app/services/dashboard/dashboardSrv.js +++ b/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 || []; diff --git a/src/test/specs/dashboardSrv-specs.js b/src/test/specs/dashboardSrv-specs.js index f916279db98..862c2a6fc41 100644 --- a/src/test/specs/dashboardSrv-specs.js +++ b/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;