ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-16710. UI sends wrong request and get's error: host component cannot be created because it already exists (akovalenko)
Date Tue, 17 May 2016 16:01:51 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 27a6fda5e -> a9cccc70c


AMBARI-16710. UI sends wrong request and get's error: host component cannot be created because
it already exists (akovalenko)


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

Branch: refs/heads/branch-2.4
Commit: a9cccc70cfaa990fd8632e8e4507aca5476b5cd3
Parents: 27a6fda
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Tue May 17 19:01:40 2016 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Tue May 17 19:01:40 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js  |  4 ++--
 ambari-web/app/templates/main/host/summary.hbs   |  2 +-
 ambari-web/app/views/main/host/summary.js        |  9 ++++++++-
 .../test/controllers/main/host/details_test.js   |  4 +---
 ambari-web/test/views/main/host/summary_test.js  | 19 +++++++++++++++++++
 5 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cccc70/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 374b077..1473df9 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2367,13 +2367,13 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
     });
   },
 
-  installClients: function (event) {
+  installClients: function (components) {
     var clientsToInstall = [],
       clientsToAdd = [],
       missedComponents = [],
       dependentComponents = [],
       self = this;
-    event.context.forEach(function (component) {
+    components.forEach(function (component) {
       if (['INIT', 'INSTALL_FAILED'].contains(component.get('workStatus'))) {
         clientsToInstall.push(component);
       } else if (typeof component.get('workStatus') == 'undefined') {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cccc70/ambari-web/app/templates/main/host/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs
index 3398bb2..729c00b 100644
--- a/ambari-web/app/templates/main/host/summary.hbs
+++ b/ambari-web/app/templates/main/host/summary.hbs
@@ -91,7 +91,7 @@
                         </a>
                       </li>
                       <li>
-                        <a href="javascript:void(null)" {{bindAttr class="view.areClientsNotInstalled::disabled"
}} data-toggle="modal" {{action installClients view.notInstalledClientComponents target="controller"}}>
+                        <a href="javascript:void(null)" {{bindAttr class="view.areClientsNotInstalled::disabled"
}} data-toggle="modal" {{action installClients target="view"}}>
                           {{t host.host.details.installClients}}
                         </a>
                       </li>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cccc70/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index ef666e9..ebef6e6 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -332,5 +332,12 @@ App.MainHostSummaryView = Em.View.extend(App.TimeRangeMixin, {
     });
 
     return options;
-  }.property('controller')
+  }.property('controller'),
+
+  /**
+   * Call installClients method from controller for not installed components
+   */
+  installClients: function () {
+    this.get('controller').installClients(this.get('notInstalledClientComponents'));
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cccc70/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 93f07cf..db061a7 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -2917,9 +2917,7 @@ describe('App.MainHostDetailsController', function () {
           sinon.stub(controller, 'checkComponentDependencies', function (componentName) {
             return item.dependencies[componentName];
           });
-          controller.installClients({
-            context: item.context
-          });
+          controller.installClients(item.context);
         });
 
         it('getSecurityType is ' + (item.getKDCSessionStateCalled ? '' : 'not') + ' called',
function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cccc70/ambari-web/test/views/main/host/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/summary_test.js b/ambari-web/test/views/main/host/summary_test.js
index 14e92da..62d04f1 100644
--- a/ambari-web/test/views/main/host/summary_test.js
+++ b/ambari-web/test/views/main/host/summary_test.js
@@ -643,4 +643,23 @@ describe('App.MainHostSummaryView', function() {
       expect(mainHostSummaryView.hasCardinalityConflict('C1')).to.be.false;
     });
   });
+
+  describe("#installClients()", function () {
+
+    beforeEach(function () {
+      var controller = {installClients: Em.K};
+      sinon.spy(controller, 'installClients');
+      mainHostSummaryView.set('controller', controller);
+      mainHostSummaryView.reopen({'notInstalledClientComponents': [1,2,3]});
+    });
+
+    afterEach(function () {
+      mainHostSummaryView.get('controller.installClients').restore();
+    });
+
+    it("should call installClients method from controller", function () {
+      mainHostSummaryView.installClients();
+      expect(mainHostSummaryView.get('controller.installClients').calledWith([1,2,3])).to.be.true;
+    });
+  });
 });


Mime
View raw message