You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/05/17 16:01:05 UTC
ambari git commit: AMBARI-16710. UI sends wrong request and get's
error: host component cannot be created because it already exists
(akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 0ed6f8a8e -> 9dccb666f
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/9dccb666
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9dccb666
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9dccb666
Branch: refs/heads/trunk
Commit: 9dccb666fd71b1cadbeb5c16cbc8bc0d12b50cb9
Parents: 0ed6f8a
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue May 17 17:53:44 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue May 17 19:00:57 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/9dccb666/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/9dccb666/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/9dccb666/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/9dccb666/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/9dccb666/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;
+ });
+ });
});