You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by lp...@apache.org on 2017/09/05 09:41:17 UTC
[22/50] [abbrv] ambari git commit: AMBARI-21852 Add Host wizard
breaks on large clusters when persisting data in localStorage. (atkach)
AMBARI-21852 Add Host wizard breaks on large clusters when persisting data in localStorage. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d1d6df90
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d1d6df90
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d1d6df90
Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d1d6df9030efa316fa6ccc227ed3148899a7760c
Parents: 12c22ed
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Aug 31 13:25:57 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Aug 31 14:09:28 2017 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/installer.js | 12 +++---------
ambari-web/app/controllers/wizard.js | 6 +-----
ambari-web/app/mixins/wizard/wizardHostsLoading.js | 2 +-
ambari-web/app/utils/ajax/ajax.js | 2 +-
ambari-web/app/utils/db.js | 8 --------
ambari-web/app/views/main/service/reassign_view.js | 2 +-
ambari-web/test/controllers/wizard_test.js | 4 ++--
.../resourceManager/wizard_view_test.js | 11 ++++++-----
.../test/views/main/service/reassign_view_test.js | 13 +++++++------
9 files changed, 22 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index d149379..b17cc1f 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -83,7 +83,9 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
'recommendations',
'recommendationsHostGroups',
'recommendationsConfigs',
- 'componentsFromConfigs'
+ 'componentsFromConfigs',
+ 'operatingSystems',
+ 'repositories'
],
init: function () {
@@ -127,14 +129,6 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
},
/**
- * Load confirmed hosts.
- * Will be used at <code>Assign Masters(step5)</code> step
- */
- loadConfirmedHosts: function () {
- this.set('content.hosts', this.getDBProperty('hosts') || {});
- },
-
- /**
* Load services data. Will be used at <code>Select services(step4)</code> step
*/
loadServices: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index d709d7e..573bd8d 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -1252,11 +1252,7 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
* Will be used at <code>Assign Masters(step5)</code> step
*/
loadConfirmedHosts: function () {
- var hosts = App.db.getHosts();
-
- if (hosts) {
- this.set('content.hosts', hosts);
- }
+ this.set('content.hosts', this.getDBProperty('hosts') || {});
},
loadHosts: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/mixins/wizard/wizardHostsLoading.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardHostsLoading.js b/ambari-web/app/mixins/wizard/wizardHostsLoading.js
index 950b51e..db3c7aa 100644
--- a/ambari-web/app/mixins/wizard/wizardHostsLoading.js
+++ b/ambari-web/app/mixins/wizard/wizardHostsLoading.js
@@ -59,7 +59,7 @@ App.WizardHostsLoading = Em.Mixin.create({
isInstalled: true
};
});
- App.db.setHosts(hosts);
+ this.get('controller').setDBProperty('hosts', hosts);
this.set('controller.content.hosts', hosts);
this.set('isLoaded', true);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 260417c..941f5a1 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2623,7 +2623,7 @@ var urls = {
'mock': ''
},
'hosts.confirmed': {
- 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/os_type,Hosts/os_arch,Hosts/ip,Hosts/maintenance_state,host_components/HostRoles/state&minimal_response=true',
+ 'real': '/clusters/{clusterName}/hosts?fields=host_components/HostRoles/state&minimal_response=true',
'mock': '/data/hosts/HDP2/hosts.json'
},
'hosts.with_searchTerm': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index eddd7ef..3e0b65a 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -229,10 +229,6 @@ App.db.unselectHosts = function (hostsToUnselect = []) {
let selectedHosts = App.db.getSelectedHosts();
selectedHosts = selectedHosts.filter(host => hostsToUnselect.indexOf(host) === -1);
App.db.setSelectedHosts(selectedHosts);
-}
-
-App.db.setHosts = function (hostInfo) {
- App.db.set('Installer', 'hostInfo', hostInfo);
};
App.db.setMasterComponentHosts = function (masterComponentHosts) {
@@ -428,10 +424,6 @@ App.db.getAllHostNames = function () {
return App.db.get('Installer', 'hostNames');
};
-App.db.getHosts = function () {
- return App.db.get('Installer', 'hostInfo');
-};
-
App.db.getMasterToReassign = function () {
return App.db.get('ReassignMaster', 'masterComponent');
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/app/views/main/service/reassign_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/reassign_view.js b/ambari-web/app/views/main/service/reassign_view.js
index c7c1228..d0a5478 100644
--- a/ambari-web/app/views/main/service/reassign_view.js
+++ b/ambari-web/app/views/main/service/reassign_view.js
@@ -53,7 +53,7 @@ App.ReassignMasterView = Em.View.extend(App.WizardMenuMixin, {
isInstalled: true
};
});
- App.db.setHosts(hosts);
+ this.get('controller').setDBProperty('hosts', hosts);
this.set('controller.content.hosts', hosts);
this.set('isLoaded', true);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/test/controllers/wizard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js
index db215a2..0f70959 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -857,14 +857,14 @@ describe('App.WizardController', function () {
describe('#loadConfirmedHosts', function () {
beforeEach(function(){
- sinon.stub(App.db, 'getHosts').returns(Em.A([
+ sinon.stub(wizardController, 'getDBProperty').returns(Em.A([
Em.Object.create({
name: 'h1'
})
]));
});
afterEach(function(){
- App.db.getHosts.restore();
+ wizardController.getDBProperty.restore();
});
it('should load hosts from db', function () {
wizardController.loadConfirmedHosts();
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js b/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
index 9f3b6a6..a3a8e61 100644
--- a/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
+++ b/ambari-web/test/views/main/admin/highAvailability/resourceManager/wizard_view_test.js
@@ -28,7 +28,8 @@ describe('App.RMHighAvailabilityWizardView', function () {
view = App.RMHighAvailabilityWizardView.create({
controller: Em.Object.create({
content: Em.Object.create(),
- setLowerStepsDisable: Em.K
+ setLowerStepsDisable: Em.K,
+ setDBProperty: Em.K
})
});
});
@@ -92,13 +93,13 @@ describe('App.RMHighAvailabilityWizardView', function () {
};
beforeEach(function() {
- sinon.stub(App.db, 'setHosts');
+ sinon.stub(view.get('controller'), 'setDBProperty');
});
afterEach(function() {
- App.db.setHosts.restore();
+ view.get('controller').setDBProperty.restore();
});
- it("App.db.setHosts should be called", function () {
+ it("setDBProperty should be called", function () {
view.loadHostsSuccessCallback(data);
expect(view.get('isLoaded')).to.be.true;
expect(view.get('controller.content.hosts')).to.be.eql({
@@ -108,7 +109,7 @@ describe('App.RMHighAvailabilityWizardView', function () {
"isInstalled": true
}
});
- expect(App.db.setHosts.calledWith({
+ expect(view.get('controller').setDBProperty.calledWith('hosts', {
"host1": {
"name": "host1",
"bootStatus": "REGISTERED",
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1d6df90/ambari-web/test/views/main/service/reassign_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/reassign_view_test.js b/ambari-web/test/views/main/service/reassign_view_test.js
index 4de4aad..eaca5ea 100644
--- a/ambari-web/test/views/main/service/reassign_view_test.js
+++ b/ambari-web/test/views/main/service/reassign_view_test.js
@@ -26,7 +26,8 @@ describe('App.ReassignMasterView', function () {
beforeEach(function() {
view = App.ReassignMasterView.create({
controller: Em.Object.create({
- content: Em.Object.create()
+ content: Em.Object.create(),
+ setDBProperty: Em.K
})
});
});
@@ -68,21 +69,21 @@ describe('App.ReassignMasterView', function () {
items: [
{
Hosts: {
- host_name: 'host1',
+ host_name: 'host1'
}
}
]
};
beforeEach(function() {
- sinon.stub(App.db, 'setHosts');
+ sinon.stub(view.get('controller'), 'setDBProperty');
view.loadHostsSuccessCallback(data);
});
afterEach(function() {
- App.db.setHosts.restore();
+ view.get('controller').setDBProperty.restore();
});
- it('setHosts should be called', function() {
- expect(App.db.setHosts.calledWith(
+ it('setDBProperty should be called', function() {
+ expect(view.get('controller').setDBProperty.calledWith('hosts',
{
"host1": {
"bootStatus": "REGISTERED",