ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-8350. Usability: confusing typeahead widget for host selection when there are more than 25 hosts in the cluster (onechiporenko)
Date Mon, 17 Nov 2014 17:25:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e7cfd66c9 -> cc076cf34


AMBARI-8350. Usability: confusing typeahead widget for host selection when there are more
than 25 hosts in the cluster (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cc076cf3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cc076cf3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cc076cf3

Branch: refs/heads/trunk
Commit: cc076cf34c2533fb29932b6df2ea4c8c20a34568
Parents: e7cfd66
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Mon Nov 17 19:21:29 2014 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Mon Nov 17 19:21:29 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/views/wizard/step5_view.js       | 9 ++++++---
 ambari-web/test/views/wizard/step5_view_test.js | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cc076cf3/ambari-web/app/views/wizard/step5_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step5_view.js b/ambari-web/app/views/wizard/step5_view.js
index c65a462..cf2f52a 100644
--- a/ambari-web/app/views/wizard/step5_view.js
+++ b/ambari-web/app/views/wizard/step5_view.js
@@ -73,7 +73,7 @@ App.InputHostView = Em.TextField.extend(App.SelectHost, {
    */
   changeHandler: function() {
     if (!this.shouldChangeHandlerBeCalled()) return;
-    var host = this.get('controller.hosts').findProperty('host_info', this.get('value'));
+    var host = this.get('controller.hosts').findProperty('host_name', this.get('value'));
     if (Em.isNone(host)) {
       this.get('controller').updateIsHostNameValidFlag(this.get("component.component_name"),
this.get("component.serviceComponentId"), false);
       return;
@@ -84,11 +84,14 @@ App.InputHostView = Em.TextField.extend(App.SelectHost, {
 
   didInsertElement: function () {
     this.initContent();
-    var value = this.get('content').findProperty('host_name', this.get('component.selectedHost')).get('host_info');
+    var value = this.get('content').findProperty('host_name', this.get('component.selectedHost')).get('host_name');
     this.set("value", value);
     var content = this.get('content').mapProperty('host_info'),
       self = this,
-      typeahead = this.$().typeahead({items: 10, source: content, minLength: 0});
+      updater = function (item) {
+        return self.get('content').findProperty('host_info', item).get('host_name');
+      },
+      typeahead = this.$().typeahead({items: 10, source: content, updater: updater, minLength:
0});
     typeahead.on('blur', function() {
       self.change();
     }).on('keyup', function(e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cc076cf3/ambari-web/test/views/wizard/step5_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step5_view_test.js b/ambari-web/test/views/wizard/step5_view_test.js
index 5cf778e..89789a9 100644
--- a/ambari-web/test/views/wizard/step5_view_test.js
+++ b/ambari-web/test/views/wizard/step5_view_test.js
@@ -163,10 +163,10 @@ describe('App.InputHostView', function() {
       expect(view.initContent.calledOnce).to.equal(true);
     });
 
-    it('should set selectedHost host_info to value', function() {
+    it('should set selectedHost host_name to value', function() {
       view.set('value', '');
       view.didInsertElement();
-      expect(view.get('value')).to.equal('h1 info');
+      expect(view.get('value')).to.equal('h1');
     });
 
   });
@@ -177,7 +177,7 @@ describe('App.InputHostView', function() {
       view.get('controller').reopen({multipleComponents: ['HBASE_MASTER', 'ZOOKEEPER_SERVER']});
       view.set('component', {component_name: 'ZOOKEEPER_SERVER', serviceComponentId: 1});
       view.set('controller.hosts', [Em.Object.create({host_info: 'h1 info', host_name: 'h1'})]);
-      view.set('value', 'h1 info');
+      view.set('value', 'h1');
       view.set('controller.rebalanceComponentHostsCounter', 0);
       view.set('controller.componentToRebalance', '');
       sinon.stub(view.get('controller'), 'assignHostToMaster', Em.K);


Mime
View raw message