ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [16/50] ambari git commit: AMBARI-14770 Config page has half shown button. (atkach)
Date Tue, 26 Jan 2016 21:45:19 GMT
AMBARI-14770 Config page has half shown button. (atkach)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7485883f38d2604885edc17c478a8fbac2f39a0c
Parents: 5acbc4d
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Fri Jan 22 15:39:22 2016 +0200
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Fri Jan 22 20:43:08 2016 +0200

----------------------------------------------------------------------
 .../views/common/configs/config_history_flow.js |  8 ++
 .../app/views/common/quick_view_link_view.js    |  3 +
 .../app/views/main/service/info/summary.js      | 11 ++-
 .../test/views/common/quick_link_view_test.js   | 94 +++++++++++++++++++-
 .../views/main/service/info/summary_test.js     | 56 ++++++++++++
 5 files changed, 167 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7485883f/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index eea297f..134c3e0 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -91,6 +91,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
     var groupName = this.get('controller.selectedConfigGroup.isDefault') ? 'default'
         : this.get('controller.selectedConfigGroup.name');
     var groupId = this.get('controller.selectedConfigGroup.configGroupId');
+    var self = this;
 
     this.get('allServiceVersions').forEach(function (version) {
       version.set('isDisabled', !(version.get('groupName') === groupName));
@@ -100,6 +101,13 @@ App.ConfigHistoryFlowView = Em.View.extend({
       return (s.get('groupId') === groupId) || s.get('groupName') == 'default';
     });
 
+    if (!serviceVersions.findProperty('isDisplayed')) {
+      //recompute serviceVersions if displayed version absent
+      Em.run.next(function() {
+        self.propertyDidChange('controller.selectedConfigGroup.name');
+      });
+    }
+
     return serviceVersions.sort(function (a, b) {
       return Em.get(b, 'createTime') - Em.get(a, 'createTime');
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7485883f/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index 604d24d..5b26201 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -512,6 +512,9 @@ App.QuickViewLinks = Em.View.extend({
         publicHostName: App.get('singleNodeAlias')
       }];
     }
+    if (Em.isNone(this.get('content.hostComponents'))) {
+      return [];
+    }
     var hosts = [];
     switch (serviceName) {
       case 'OOZIE':

http://git-wip-us.apache.org/repos/asf/ambari/blob/7485883f/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 1797448..ae37f87 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -163,19 +163,22 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
 
   setComponentsContent: function() {
     Em.run.next(function() {
-      var masters = this.get('service.hostComponents').filterProperty('isMaster');
+      if (Em.isNone(this.get('service'))) {
+        return;
+      }
+      var masters = this.get('service.masterComponents').toArray();
       var slaves = this.get('service.slaveComponents').toArray();
       var clients = this.get('service.clientComponents').toArray();
 
-      if (this.get('mastersLength') != masters.length) {
+      if (this.get('mastersLength') !== masters.length) {
         this.updateComponentList(this.get('mastersObj'), masters);
         this.set('mastersLength', masters.length);
       }
-      if (this.get('slavesLength') != slaves.length) {
+      if (this.get('slavesLength') !== slaves.length) {
         this.updateComponentList(this.get('slavesObj'), slaves);
         this.set('slavesLength', slaves.length);
       }
-      if (this.get('clientsLength') != clients.length) {
+      if (this.get('clientsLength') !== clients.length) {
         this.updateComponentList(this.get('clientObj'), clients);
         this.set('clientsLength', clients.length);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7485883f/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index 7f9d1ed..f619e87 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -853,7 +853,7 @@ describe('App.QuickViewLinks', function () {
             {
               'type': 'yarn-site',
               'properties': {'yarn.timeline-service.webapp.https.address': 'c6401.ambari.apache.org:8090'}
-            },
+            }
           ],
         'result': '8090'
       })
@@ -871,4 +871,96 @@ describe('App.QuickViewLinks', function () {
     }, this);
   });
 
+  describe("#getHosts()", function() {
+
+    beforeEach(function() {
+      sinon.stub(quickViewLinks, 'processOozieHosts').returns(['oozieHost']);
+      sinon.stub(quickViewLinks, 'processHdfsHosts').returns(['hdfsHost']);
+      sinon.stub(quickViewLinks, 'processHbaseHosts').returns(['hbaseHost']);
+      sinon.stub(quickViewLinks, 'processYarnHosts').returns(['yarnHost']);
+      sinon.stub(quickViewLinks, 'findHosts').returns(['host1']);
+      App.set('singleNodeInstall', false);
+      quickViewLinks.set('content', Em.Object.create({
+        hostComponents: []
+      }));
+    });
+    afterEach(function() {
+      quickViewLinks.processOozieHosts.restore();
+      quickViewLinks.processHdfsHosts.restore();
+      quickViewLinks.processHbaseHosts.restore();
+      quickViewLinks.findHosts.restore();
+      quickViewLinks.processYarnHosts.restore();
+    });
+
+    it("singleNodeInstall is true", function() {
+      App.set('singleNodeInstall', true);
+      App.set('singleNodeAlias', 'host1');
+      expect(quickViewLinks.getHosts({}, 'S1')).to.eql([{
+        hostName: 'host1',
+        publicHostName: 'host1'
+      }])
+    });
+
+    it("content is null", function() {
+      quickViewLinks.set('content', null);
+      expect(quickViewLinks.getHosts({}, 'S1')).to.be.empty;
+    });
+
+    it("OOZIE service", function() {
+      expect(quickViewLinks.getHosts({}, 'OOZIE')).to.eql(['oozieHost']);
+      expect(quickViewLinks.findHosts.calledWith('OOZIE_SERVER', {})).to.be.true;
+      expect(quickViewLinks.processOozieHosts.calledOnce).to.be.true;
+    });
+
+    it("HDFS service", function() {
+      expect(quickViewLinks.getHosts({}, 'HDFS')).to.eql(['hdfsHost']);
+      expect(quickViewLinks.findHosts.calledWith('NAMENODE', {})).to.be.true;
+      expect(quickViewLinks.processHdfsHosts.calledOnce).to.be.true;
+    });
+
+    it("HBASE service", function() {
+      expect(quickViewLinks.getHosts({}, 'HBASE')).to.eql(['hbaseHost']);
+      expect(quickViewLinks.findHosts.calledWith('HBASE_MASTER', {})).to.be.true;
+      expect(quickViewLinks.processHbaseHosts.calledOnce).to.be.true;
+    });
+
+    it("YARN service", function() {
+      expect(quickViewLinks.getHosts({}, 'YARN')).to.eql(['yarnHost']);
+      expect(quickViewLinks.findHosts.calledWith('RESOURCEMANAGER', {})).to.be.true;
+      expect(quickViewLinks.processYarnHosts.calledOnce).to.be.true;
+    });
+
+    it("STORM service", function() {
+      expect(quickViewLinks.getHosts({}, 'STORM')).to.eql(['host1']);
+      expect(quickViewLinks.findHosts.calledWith('STORM_UI_SERVER', {})).to.be.true;
+    });
+
+    it("ACCUMULO service", function() {
+      expect(quickViewLinks.getHosts({}, 'ACCUMULO')).to.eql(['host1']);
+      expect(quickViewLinks.findHosts.calledWith('ACCUMULO_MONITOR', {})).to.be.true;
+    });
+
+    it("ATLAS service", function() {
+      expect(quickViewLinks.getHosts({}, 'ATLAS')).to.eql(['host1']);
+      expect(quickViewLinks.findHosts.calledWith('ATLAS_SERVER', {})).to.be.true;
+    });
+
+    it("custom service without master", function() {
+      expect(quickViewLinks.getHosts({}, 'S1')).to.be.empty;
+    });
+
+    it("custom service with master", function() {
+      quickViewLinks.set('content', Em.Object.create({
+        hostComponents: [
+          Em.Object.create({
+            isMaster: true,
+            componentName: 'C1'
+          })
+        ]
+      }));
+      expect(quickViewLinks.getHosts({}, 'S1')).to.eql(['host1']);
+      expect(quickViewLinks.findHosts.calledWith('C1', {})).to.be.true;
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/7485883f/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 72e468d..bc0388b 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -524,4 +524,60 @@ describe('App.MainServiceInfoSummaryView', function() {
 
   });
 
+  describe("#setComponentsContent()", function() {
+
+    beforeEach(function() {
+      sinon.stub(Em.run, 'next', Em.clb);
+      sinon.stub(view, 'updateComponentList');
+      view.set('service', Em.Object.create({
+        masterComponents: [],
+        slaveComponents: [],
+        clientComponents: []
+      }));
+      view.setProperties({
+        mastersLength: 0,
+        slavesLength: 0,
+        clientsLength: 0,
+        mastersObj: ['master'],
+        slavesObj: ['slave'],
+        clientObj: ['client']
+      });
+    });
+    afterEach(function() {
+      Em.run.next.restore();
+      view.updateComponentList.restore();
+    });
+
+    it("service is null", function() {
+      view.set('service', null);
+      view.setComponentsContent();
+      expect(Em.run.next.calledOnce).to.be.true;
+      expect(view.updateComponentList.called).to.be.false
+    });
+
+    it("update master length", function() {
+      view.set('mastersLength', 1);
+      view.setComponentsContent();
+      expect(Em.run.next.calledOnce).to.be.true;
+      expect(view.updateComponentList.calledWith(['master'], [])).to.be.true;
+      expect(view.get('mastersLength')).to.be.equal(0);
+    });
+
+    it("update slave length", function() {
+      view.set('slavesLength', 1);
+      view.setComponentsContent();
+      expect(Em.run.next.calledOnce).to.be.true;
+      expect(view.updateComponentList.calledWith(['slave'], [])).to.be.true;
+      expect(view.get('slavesLength')).to.be.equal(0);
+    });
+
+    it("update client length", function() {
+      view.set('clientsLength', 1);
+      view.setComponentsContent();
+      expect(Em.run.next.calledOnce).to.be.true;
+      expect(view.updateComponentList.calledWith(['client'], [])).to.be.true;
+      expect(view.get('clientsLength')).be.equal(0);
+    });
+  });
+
 });
\ No newline at end of file


Mime
View raw message