From 86e9d2cf07b983415e287f12b32107aa9d6d62e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 20 Mar 2015 13:33:52 -0400 Subject: [PATCH] more work on repeating row --- src/app/directives/templateParamSelector.js | 6 ++---- src/app/features/dashboard/dynamicDashboardSrv.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/directives/templateParamSelector.js b/src/app/directives/templateParamSelector.js index df3b668496e..6cd2ce5a964 100644 --- a/src/app/directives/templateParamSelector.js +++ b/src/app/directives/templateParamSelector.js @@ -102,7 +102,6 @@ function (angular, app, _, $) { scope.selectorOpen = true; scope.giveFocus = 1; scope.oldCurrentText = variable.current.text; - var currentValues = variable.current.value; if (_.isString(currentValues)) { @@ -110,11 +109,10 @@ function (angular, app, _, $) { } scope.options = _.map(variable.options, function(option) { - var op = {text: option.text, value: option.value}; if (_.indexOf(currentValues, option.value) >= 0) { - op.selected = true; + option.selected = true; } - return op; + return option; }); $timeout(function() { diff --git a/src/app/features/dashboard/dynamicDashboardSrv.js b/src/app/features/dashboard/dynamicDashboardSrv.js index 8af85bc0aba..49070e8ce49 100644 --- a/src/app/features/dashboard/dynamicDashboardSrv.js +++ b/src/app/features/dashboard/dynamicDashboardSrv.js @@ -10,6 +10,7 @@ function (angular, _) { module.service('dynamicDashboardSrv', function() { this.init = function(dashboard) { + this.removeLinkedPanels(dashboard); this.handlePanelRepeats(dashboard); }; @@ -25,6 +26,7 @@ function (angular, _) { for (j = 0; j < row.panels.length; j++) { panel = row.panels[j]; if (panel.linked) { + console.log('removing panel: ' + panel.id); row.panels = _.without(row.panels, panel); j = j - 1; } @@ -52,7 +54,14 @@ function (angular, _) { return; } - _.each(variable.options, function(option, index) { + var selected; + if (variable.current.text === 'All') { + selected = variable.options.slice(1, variable.options.length); + } else { + selected = _.filter(variable.options, {selected: true}); + } + + _.each(selected, function(option, index) { if (index > 0) { var copy = dashboard.duplicatePanel(panel, row); copy.repeat = null;