Pārlūkot izejas kodu

AMBARI-12193. Step2 installer. Popup with hosts contains duplicates (onechiporenko)

Oleg Nechiporenko 10 gadi atpakaļ
vecāks
revīzija
955cfce2c3

+ 1 - 1
ambari-web/app/controllers/wizard/step2_controller.js

@@ -345,7 +345,7 @@ App.WizardStep2Controller = Em.Controller.extend({
         hostNames.push(a);
         hostNames.push(a);
       }
       }
     });
     });
-    this.set('hostNameArr', hostNames);
+    this.set('hostNameArr', hostNames.uniq());
   },
   },
 
 
   /**
   /**

+ 10 - 1
ambari-web/test/controllers/wizard/step2_test.js

@@ -422,7 +422,16 @@ describe('App.WizardStep2Controller', function () {
         }
         }
       }
       }
       expect(result).to.equal(true);
       expect(result).to.equal(true);
-    })
+    });
+
+    it('should skip duplicates', function () {
+      var controller = App.WizardStep2Controller.create({
+        hostNameArr: ['host[1-3]', 'host2']
+      });
+      controller.parseHostNamesAsPatternExpression();
+      expect(controller.get('hostNameArr')).to.eql(['host1', 'host2', 'host3']);
+    });
+
   });
   });
 
 
   describe('#proceedNext()', function () {
   describe('#proceedNext()', function () {