You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2018/09/21 11:47:42 UTC
[ambari] branch trunk updated: AMBARI-24667 JS errors during adding
hosts
This is an automated email from the ASF dual-hosted git repository.
atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 3231893 AMBARI-24667 JS errors during adding hosts
3231893 is described below
commit 3231893f6488bafed5d5c0d87d0aeaccb8d24498
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Fri Sep 21 10:39:41 2018 +0300
AMBARI-24667 JS errors during adding hosts
---
ambari-web/app/controllers/global/cluster_controller.js | 2 +-
.../test/controllers/global/cluster_controller_test.js | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 63b16f8..9e5b4f7 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -102,7 +102,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
loadClusterName: function (reload, deferred) {
var dfd = deferred || $.Deferred();
- if (App.get('clusterName') && !reload) {
+ if (App.get('clusterName') && App.get('clusterId') && !reload) {
App.set('clusterName', this.get('clusterName'));
this.set('isClusterNameLoaded', true);
dfd.resolve();
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index 839fbbb..0d89a12 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -80,6 +80,7 @@ describe('App.clusterController', function () {
return {
then: function (successCallback) {
App.set('clusterName', 'clusterNameFromServer');
+ App.set('clusterId', 1);
App.set('currentStackVersion', 'HDP-2.0.5');
successCallback();
}
@@ -93,6 +94,7 @@ describe('App.clusterController', function () {
it('if clusterName is "mycluster" and reload is false then clusterName stays the same', function () {
App.set('clusterName', 'mycluster');
+ App.set('clusterId', 1);
controller.loadClusterName(false);
expect(this.args).to.not.exists;
expect(App.get('clusterName')).to.equal('mycluster');
@@ -103,6 +105,7 @@ describe('App.clusterController', function () {
expect(this.args).to.exists;
expect(App.get('clusterName')).to.equal('clusterNameFromServer');
expect(App.get('currentStackVersion')).to.equal('HDP-2.0.5');
+ expect(App.get('clusterId')).to.equal(1);
});
it('reload is false and clusterName is empty', function () {
@@ -111,6 +114,17 @@ describe('App.clusterController', function () {
expect(this.args).to.exists;
expect(App.get('clusterName')).to.equal('clusterNameFromServer');
expect(App.get('currentStackVersion')).to.equal('HDP-2.0.5');
+ expect(App.get('clusterId')).to.equal(1);
+ });
+
+ it('reload is false and clusterName is set and clusterId is null', function () {
+ App.set('clusterName', 'c1');
+ App.set('clusterId', null);
+ controller.loadClusterName(false);
+ expect(this.args).to.exists;
+ expect(App.get('clusterName')).to.equal('clusterNameFromServer');
+ expect(App.get('clusterId')).to.equal(1);
+ expect(App.get('currentStackVersion')).to.equal('HDP-2.0.5');
});