Torkel Ödegaard 10 лет назад
Родитель
Сommit
86e9d2cf07

+ 2 - 4
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() {

+ 10 - 1
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;