|
|
@@ -20,6 +20,8 @@ function dynamicDashScenario(desc, func) {
|
|
|
|
|
|
beforeEach(angularMocks.inject(function(dashboardSrv) {
|
|
|
ctx.dashboardSrv = dashboardSrv;
|
|
|
+ ctx.variableSrv = {};
|
|
|
+
|
|
|
var model = {
|
|
|
rows: [],
|
|
|
templating: { list: [] }
|
|
|
@@ -27,8 +29,10 @@ function dynamicDashScenario(desc, func) {
|
|
|
|
|
|
setupFunc(model);
|
|
|
ctx.dash = ctx.dashboardSrv.create(model);
|
|
|
+ ctx.variableSrv.variables = ctx.dash.templating.list;
|
|
|
ctx.dynamicDashboardSrv = new DynamicDashboardSrv();
|
|
|
- ctx.dynamicDashboardSrv.init(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.init(ctx.dash, ctx.variableSrv);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
ctx.rows = ctx.dash.rows;
|
|
|
}));
|
|
|
};
|
|
|
@@ -78,7 +82,7 @@ dynamicDashScenario('given dashboard with panel repeat', function(ctx) {
|
|
|
beforeEach(function() {
|
|
|
repeatedPanelAfterIteration1 = ctx.rows[0].panels[1];
|
|
|
ctx.rows[0].panels[0].fill = 10;
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should have reused same panel instances', function() {
|
|
|
@@ -102,7 +106,7 @@ dynamicDashScenario('given dashboard with panel repeat', function(ctx) {
|
|
|
options: [{text: 'se1', value: 'se1', selected: true}]
|
|
|
});
|
|
|
ctx.rows[0].panels[0].repeat = "server";
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should remove scopedVars value for last variable', function() {
|
|
|
@@ -117,7 +121,7 @@ dynamicDashScenario('given dashboard with panel repeat', function(ctx) {
|
|
|
describe('After a second iteration and selected values reduced', function() {
|
|
|
beforeEach(function() {
|
|
|
ctx.dash.templating.list[0].options[1].selected = false;
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should clean up repeated panel', function() {
|
|
|
@@ -128,7 +132,7 @@ dynamicDashScenario('given dashboard with panel repeat', function(ctx) {
|
|
|
describe('After a second iteration and panel repeat is turned off', function() {
|
|
|
beforeEach(function() {
|
|
|
ctx.rows[0].panels[0].repeat = null;
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should clean up repeated panel', function() {
|
|
|
@@ -199,7 +203,7 @@ dynamicDashScenario('given dashboard with row repeat', function(ctx) {
|
|
|
beforeEach(function() {
|
|
|
repeatedRowAfterFirstIteration = ctx.rows[1];
|
|
|
ctx.rows[0].height = 500;
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should still only have 2 rows', function() {
|
|
|
@@ -218,7 +222,7 @@ dynamicDashScenario('given dashboard with row repeat', function(ctx) {
|
|
|
describe('After a second iteration and selected values reduced', function() {
|
|
|
beforeEach(function() {
|
|
|
ctx.dash.templating.list[0].options[1].selected = false;
|
|
|
- ctx.dynamicDashboardSrv.update(ctx.dash);
|
|
|
+ ctx.dynamicDashboardSrv.process();
|
|
|
});
|
|
|
|
|
|
it('should remove repeated second row', function() {
|