You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2017/05/17 21:18:09 UTC
ambari git commit: AMBARI-21044 Add service wizard unresponsive while
adding HST via Ambari. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk bba703bc6 -> 292db86f0
AMBARI-21044 Add service wizard unresponsive while adding HST via Ambari. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/292db86f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/292db86f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/292db86f
Branch: refs/heads/trunk
Commit: 292db86f02e236615dc67576f66b856657898f17
Parents: bba703b
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed May 17 21:17:17 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu May 18 00:21:20 2017 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/installer.js | 15 ----
.../journalNode/step1_controller.js | 2 +-
.../service/manage_config_groups_controller.js | 89 ++++++++++++++++++--
ambari-web/app/controllers/wizard.js | 38 +--------
.../wizard/step7/assign_master_controller.js | 16 +++-
.../mixins/wizard/assign_master_components.js | 77 ++++++++++++-----
.../app/mixins/wizard/wizardHostsLoading.js | 6 +-
ambari-web/app/routes/add_service_routes.js | 1 +
ambari-web/app/routes/installer.js | 1 +
ambari-web/app/utils/ajax/ajax.js | 4 +
.../common/assign_master_components_view.js | 4 +
.../app/views/main/service/reassign_view.js | 4 -
ambari-web/test/controllers/installer_test.js | 12 ---
.../journalNode/step1_controller_test.js | 4 +-
.../main/service/add_controller_test.js | 54 +-----------
.../test/controllers/wizard/step5_test.js | 86 +++++++++++++------
ambari-web/test/controllers/wizard_test.js | 30 +------
.../resourceManager/wizard_view_test.js | 18 +---
.../views/main/service/reassign_view_test.js | 12 ---
19 files changed, 236 insertions(+), 237 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index ec280fa..db9623a 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -203,24 +203,9 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
for (var hostName in rawHosts) {
var host = rawHosts[hostName];
- var disksOverallCapacity = 0;
- var diskFree = 0;
- host.disk_info.forEach(function (disk) {
- disksOverallCapacity += parseFloat(disk.size);
- diskFree += parseFloat(disk.available);
- });
hosts.pushObject(Em.Object.create({
id: host.name,
- ip: host.ip,
- osType: host.os_type,
- osArch: host.os_arch,
hostName: host.name,
- publicHostName: host.name,
- cpu: host.cpu,
- memory: host.memory,
- diskInfo: host.disk_info,
- diskTotal: disksOverallCapacity / (1024 * 1024),
- diskFree: diskFree / (1024 * 1024),
hostComponents: host.hostComponents || []
}
))
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js
index b54986b..197596c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/journalNode/step1_controller.js
@@ -105,7 +105,7 @@ App.ManageJournalNodeWizardStep1Controller = Em.Controller.extend(App.BlueprintM
self.get('addableComponents').forEach(function (componentName) {
self.updateComponent(componentName);
}, self);
- self.set('isLoaded', true);
+ self.set('isRecommendationsLoaded', true);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
index 45c840a..a260652 100644
--- a/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
+++ b/ambari-web/app/controllers/main/service/manage_config_groups_controller.js
@@ -289,15 +289,13 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
*/
loadHosts: function() {
this.set('isLoaded', false);
- if (this.get('isInstaller')) {
- var allHosts = this.get('isAddService') ? App.router.get('addServiceController').get('allHosts') : App.router.get('installerController').get('allHosts');
- this.set('clusterHosts', allHosts);
- this.loadConfigGroups(this.get('serviceName'));
- }
- else {
+ if (this.get('isInstaller') && !this.get('isAddService')) {
+ var hostNames = App.router.get('installerController').get('allHosts').mapProperty('hostName').join();
+ this.loadInstallerHostsFromServer(hostNames);
+ } else {
this.loadHostsFromServer();
- this.loadConfigGroups(this.get('serviceName'));
}
+ this.loadConfigGroups(this.get('serviceName'));
},
/**
@@ -1000,6 +998,83 @@ App.ManageConfigGroupsController = Em.Controller.extend(App.ConfigOverridable, {
this.set('disablePrimary', !modified);
}.observes('subViewController.isHostsModified')
});
+ },
+
+ loadInstallerHostsFromServer: function (hostNames) {
+ return App.ajax.send({
+ name: 'hosts.info.install',
+ sender: this,
+ data: {
+ hostNames: hostNames
+ },
+ success: 'loadInstallerHostsSuccessCallback'
+ });
+ },
+
+ loadInstallerHostsSuccessCallback: function (data) {
+ var rawHosts = App.router.get('installerController.content.hosts'),
+ masterComponents = App.router.get('installerController.content.masterComponentHosts'),
+ slaveComponents = App.router.get('installerController.content.slaveComponentHosts'),
+ hosts = [];
+ masterComponents.forEach(function (component) {
+ var host = rawHosts[component.hostName];
+ if (host.hostComponents) {
+ host.hostComponents.push(Em.Object.create({
+ componentName: component.component,
+ displayName: component.display_name
+ }));
+ } else {
+ rawHosts[component.hostName].hostComponents = [
+ Em.Object.create({
+ componentName: component.component,
+ displayName: component.display_name
+ })
+ ]
+ }
+ });
+ slaveComponents.forEach(function (component) {
+ component.hosts.forEach(function (rawHost) {
+ var host = rawHosts[rawHost.hostName];
+ if (host.hostComponents) {
+ host.hostComponents.push(Em.Object.create({
+ componentName: component.componentName,
+ displayName: component.displayName
+ }));
+ } else {
+ rawHosts[rawHost.hostName].hostComponents = [
+ Em.Object.create({
+ componentName: component.componentName,
+ displayName: component.displayName
+ })
+ ]
+ }
+ });
+ });
+
+ data.items.forEach(function (host) {
+ var disksOverallCapacity = 0,
+ diskFree = 0;
+ host.Hosts.disk_info.forEach(function (disk) {
+ disksOverallCapacity += parseFloat(disk.size);
+ diskFree += parseFloat(disk.available);
+ });
+ hosts.pushObject(Em.Object.create({
+ id: host.Hosts.host_name,
+ ip: host.Hosts.ip,
+ osType: host.Hosts.os_type,
+ osArch: host.Hosts.os_arch,
+ hostName: host.Hosts.host_name,
+ publicHostName: host.Hosts.public_host_name,
+ cpu: host.Hosts.cpu_count,
+ memory: host.Hosts.total_mem.toFixed(2),
+ diskInfo: host.Hosts.disk_info,
+ diskTotal: disksOverallCapacity / (1024 * 1024),
+ diskFree: diskFree / (1024 * 1024),
+ hostComponents: (rawHosts[host.Hosts.host_name] && rawHosts[host.Hosts.host_name].hostComponents) || []
+ }));
+ });
+
+ this.set('clusterHosts', hosts);
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/controllers/wizard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard.js b/ambari-web/app/controllers/wizard.js
index a8a0249..efda62d 100644
--- a/ambari-web/app/controllers/wizard.js
+++ b/ambari-web/app/controllers/wizard.js
@@ -114,39 +114,21 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
allHosts: function () {
var dbHosts = this.get('content.hosts');
var hosts = [];
- var hostComponents = [];
for (var hostName in dbHosts) {
- hostComponents = [];
- var disksOverallCapacity = 0;
- var diskFree = 0;
+ var hostComponents = [];
dbHosts[hostName].hostComponents.forEach(function (componentName) {
hostComponents.push(Em.Object.create({
componentName: componentName,
displayName: App.format.role(componentName, false)
}));
});
- dbHosts[hostName].disk_info.forEach(function (disk) {
- disksOverallCapacity += parseFloat(disk.size);
- diskFree += parseFloat(disk.available);
- });
hosts.push(Em.Object.create({
id: hostName,
hostName: hostName,
- publicHostName: hostName,
- diskInfo: dbHosts[hostName].disk_info,
- diskTotal: disksOverallCapacity / (1024 * 1024),
- diskFree: diskFree / (1024 * 1024),
- disksMounted: dbHosts[hostName].disk_info.length,
- cpu: dbHosts[hostName].cpu,
- memory: dbHosts[hostName].memory,
- osType: dbHosts[hostName].osType ? dbHosts[hostName].osType: 0,
- osArch: dbHosts[hostName].osArch ? dbHosts[hostName].osArch : 0,
- ip: dbHosts[hostName].ip ? dbHosts[hostName].ip: 0,
- hostComponents: hostComponents,
- maintenanceState: dbHosts[hostName].maintenance_state
- }))
+ hostComponents: hostComponents
+ }));
}
return hosts;
}.property('content.hosts'),
@@ -771,13 +753,6 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
if (_host.bootStatus === 'REGISTERED') {
hosts[_host.name] = {
name: _host.name,
- cpu: _host.cpu,
- memory: _host.memory,
- disk_info: _host.disk_info,
- os_type: _host.os_type,
- os_arch: _host.os_arch,
- ip: _host.ip,
- maintenance_state: _host.maintenance_state,
bootStatus: _host.bootStatus,
isInstalled: false,
id: indx++
@@ -1308,13 +1283,6 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
response.items.forEach(function (item, indx) {
installedHosts[item.Hosts.host_name] = {
name: item.Hosts.host_name,
- cpu: item.Hosts.cpu_count,
- memory: item.Hosts.total_mem,
- disk_info: item.Hosts.disk_info,
- osType: item.Hosts.os_type,
- osArch: item.Hosts.os_arch,
- ip: item.Hosts.ip,
- maintenance_state: item.Hosts.maintenance_state,
bootStatus: "REGISTERED",
isInstalled: true,
hostComponents: item.host_components,
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
index 099931a..e8eaf47 100644
--- a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
+++ b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js
@@ -314,6 +314,7 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
this.set("hosts", result);
this.sortHosts(result);
+ this.set('isHostsLoaded', true);
}
},
@@ -642,5 +643,18 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App
});
}
return masterComponents;
- }
+ },
+
+ getHosts: function () {
+ var result,
+ parentController = this.get('content.controllerName');
+ if (parentController) {
+ result = this._super();
+ } else {
+ result = this.get('hosts').mapProperty('host_name');
+ }
+ return result;
+ },
+
+ clearStepOnExit: Em.K
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index 3e2a09a..7c4929f 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -250,10 +250,22 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
selectedServicesMasters: [],
/**
+ * Is hosts data loaded
+ * @type {bool}
+ */
+ isHostsLoaded: false,
+
+ /**
+ * Are recommendations loaded
+ * @type {bool}
+ */
+ isRecommendationsLoaded: false,
+
+ /**
* Is data for current step loaded
* @type {bool}
*/
- isLoaded: false,
+ isLoaded: Em.computed.and('isHostsLoaded', 'isRecommendationsLoaded'),
/**
* Is back from the next step
@@ -341,7 +353,7 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
}, this);
return mapping.sortProperty('host_name');
- }.property("selectedServicesMasters.@each.selectedHost", 'selectedServicesMasters.@each.isHostNameValid'),
+ }.property('selectedServicesMasters.@each.selectedHost', 'selectedServicesMasters.@each.isHostNameValid', 'isLoaded'),
/**
* Count of hosts without masters
@@ -484,7 +496,8 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
clearStep: function () {
this.setProperties({
hosts: [],
- isLoaded: false,
+ isHostsLoaded: false,
+ isRecommendationsLoaded: false,
backFromNextStep: false,
selectedServicesMasters: [],
servicesMasters: []
@@ -494,6 +507,10 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
}, this);
},
+ clearStepOnExit: function () {
+ this.clearStep();
+ },
+
/**
* Load controller data (hosts, host components etc)
* @method loadStep
@@ -511,7 +528,7 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
this.set('backFromNextStep',true);
}
this.getRecommendedHosts({
- hosts: this.get('hosts').mapProperty('host_name')
+ hosts: this.getHosts()
}).then(function() {
self.loadStepCallback(self.createComponentInstallationObjects(), self);
});
@@ -527,7 +544,7 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
self.get('addableComponents').forEach(function (componentName) {
self.updateComponent(componentName);
}, self);
- self.set('isLoaded', true);
+ self.set('isRecommendationsLoaded', true);
if (self.thereIsNoMasters() && !self.get('mastersToCreate').length) {
App.router.send('next');
}
@@ -579,25 +596,40 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
* @method renderHostInfo
*/
renderHostInfo: function () {
- var hostInfo = this.get('content.hosts');
- var result = [];
+ var isInstaller = (this.get('wizardController.name') === 'installerController' || this.get('content.controllerName') === 'installerController');
+ App.ajax.send({
+ name: isInstaller ? 'hosts.info.install' : 'hosts.high_availability.wizard',
+ sender: this,
+ data: {
+ hostNames: isInstaller ? this.getHosts().join() : null
+ },
+ success: 'loadWizardHostsSuccessCallback'
+ });
+ },
- for (var index in hostInfo) {
- var _host = hostInfo[index];
+ loadWizardHostsSuccessCallback: function (data) {
+ var hostInfo = this.get('content.hosts'),
+ result = [];
+ data.items.forEach(function (host) {
+ var hostName = host.Hosts.host_name,
+ _host = hostInfo[hostName],
+ cpu = host.Hosts.cpu_count,
+ memory = host.Hosts.total_mem.toFixed(2);
if (_host.bootStatus === 'REGISTERED') {
result.push(Em.Object.create({
- host_name: _host.name,
- cpu: _host.cpu,
- memory: _host.memory,
- disk_info: _host.disk_info,
- maintenance_state: _host.maintenance_state,
+ host_name: hostName,
+ cpu: cpu,
+ memory: memory,
+ disk_info: host.Hosts.disk_info,
+ maintenance_state: host.Hosts.maintenance_state,
isInstalled: _host.isInstalled,
- host_info: Em.I18n.t('installer.step5.hostInfo').fmt(_host.name, numberUtils.bytesToSize(_host.memory, 1, 'parseFloat', 1024), _host.cpu)
+ host_info: Em.I18n.t('installer.step5.hostInfo').fmt(hostName, numberUtils.bytesToSize(memory, 1, 'parseFloat', 1024), cpu)
}));
}
- }
- this.set("hosts", result);
+ }, this);
+ this.set('hosts', result);
this.sortHosts(this.get('hosts'));
+ this.set('isHostsLoaded', true);
},
/**
@@ -1101,7 +1133,8 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
},
recommendAndValidate: function(callback) {
- var self = this;
+ var self = this,
+ hostNames = this.getHosts();
if (this.get('validationInProgress')) {
this.set('runQueuedValidation', true);
@@ -1112,11 +1145,11 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
// load recommendations with partial request
this.getRecommendedHosts({
- hosts: this.get('hosts').mapProperty('host_name'),
+ hosts: hostNames,
components: this.getCurrentComponentHostMap()
}).then(function() {
self.validateSelectedHostComponents({
- hosts: self.get('hosts').mapProperty('host_name'),
+ hosts: hostNames,
blueprint: self.get('recommendations')
}).then(function() {
if (callback) {
@@ -1224,5 +1257,9 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
self.set('submitButtonClicked', false);
}
});
+ },
+
+ getHosts: function () {
+ return Em.keys(this.get('content.hosts'));
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 93dab02..950b51e 100644
--- a/ambari-web/app/mixins/wizard/wizardHostsLoading.js
+++ b/ambari-web/app/mixins/wizard/wizardHostsLoading.js
@@ -55,12 +55,8 @@ App.WizardHostsLoading = Em.Mixin.create({
data.items.forEach(function (item) {
hosts[item.Hosts.host_name] = {
name: item.Hosts.host_name,
- cpu: item.Hosts.cpu_count,
- memory: item.Hosts.total_mem,
- disk_info: item.Hosts.disk_info,
bootStatus: "REGISTERED",
- isInstalled: true,
- maintenance_state: item.Hosts.maintenance_state
+ isInstalled: true
};
});
App.db.setHosts(hosts);
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 89a4a36..1615f0d 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -167,6 +167,7 @@ module.exports = App.WizardRoute.extend({
controller.dataLoading().done(function () {
controller.loadAllPriorSteps().done(function () {
App.logger.logTimerIfMoreThan(consoleMsg.format(2));
+ wizardStep2Controller.set('wizardController', controller);
controller.connectOutlet('wizardStep5', controller.get('content'));
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index daefa48..eae03a7 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -315,6 +315,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
});
controller.setCurrentStep('5');
controller.loadAllPriorSteps().done(function () {
+ wizardStep5Controller.set('wizardController', controller);
controller.connectOutlet('wizardStep5', controller.get('content'));
self.scrollTop();
console.timeEnd('step5 connectOutlets');
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 0b584d8..4dc04f4 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2698,6 +2698,10 @@ var urls = {
'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name,host_components&minimal_response=true',
'mock': ''
},
+ 'hosts.info.install': {
+ 'real': '/hosts?Hosts/host_name.in({hostNames})&fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name&minimal_response=true',
+ 'mock': ''
+ },
'hosts.host_components.pre_load': {
real: '',
mock: '/data/hosts/HDP2/hosts.json',
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/app/views/common/assign_master_components_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/assign_master_components_view.js b/ambari-web/app/views/common/assign_master_components_view.js
index 892bcae..001667a 100644
--- a/ambari-web/app/views/common/assign_master_components_view.js
+++ b/ambari-web/app/views/common/assign_master_components_view.js
@@ -49,6 +49,10 @@ App.AssignMasterComponentsView = Em.View.extend({
didInsertElement: function () {
this.get('controller').loadStep();
+ },
+
+ willDestroyElement: function () {
+ this.get('controller').clearStepOnExit();
}
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 6885726..c7c1228 100644
--- a/ambari-web/app/views/main/service/reassign_view.js
+++ b/ambari-web/app/views/main/service/reassign_view.js
@@ -49,10 +49,6 @@ App.ReassignMasterView = Em.View.extend(App.WizardMenuMixin, {
data.items.forEach(function (item) {
hosts[item.Hosts.host_name] = {
name: item.Hosts.host_name,
- cpu: item.Hosts.cpu_count,
- memory: item.Hosts.total_mem,
- disk_info: item.Hosts.disk_info,
- maintenance_state: item.Hosts.maintenance_state,
bootStatus: "REGISTERED",
isInstalled: true
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/test/controllers/installer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js
index 94af88e..bc91a8e 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -736,10 +736,6 @@ describe('App.InstallerController', function () {
it ('Should return hosts', function() {
var hosts = {
'h1': {
- disk_info: Em.A([{
- available: 1,
- size: 10
- }]),
hostComponents: Em.A([])
}
};
@@ -765,14 +761,6 @@ describe('App.InstallerController', function () {
var res = JSON.parse(JSON.stringify(installerController.get('allHosts')));
expect(res).to.eql([
{
- "diskInfo": [
- {
- "available": 1,
- "size": 10
- }
- ],
- "diskTotal": 0.0000095367431640625,
- "diskFree": 9.5367431640625e-7,
"hostComponents": [
{
"componentName": "component",
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step1_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step1_controller_test.js
index 17f5ed2..9ae300c 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/journalNode/step1_controller_test.js
@@ -199,9 +199,9 @@ describe('App.ManageJournalNodeWizardStep1Controller', function () {
expect(controller.updateComponent.calledWith('C1')).to.be.true;
});
- it('isLoaded should be true', function() {
+ it('isRecommendationsLoaded should be true', function() {
controller.loadStepCallback([], controller);
- expect(controller.get('isLoaded')).to.be.true;
+ expect(controller.get('isRecommendationsLoaded')).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index a52c38f..1119176 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -167,25 +167,7 @@ describe('App.AddServiceController', function() {
describe('#loadHostsSuccessCallback', function () {
it('should load hosts to local db and model', function () {
- var diskInfo = [
- {
- available: '600000',
- used: '400000',
- percent: '40%',
- size: '10000000',
- type: 'ext4',
- mountpoint: '/'
- },
- {
- available: '500000',
- used: '300000',
- percent: '50%',
- size: '6000000',
- type: 'ext4',
- mountpoint: '/'
- }
- ],
- hostComponents = [
+ var hostComponents = [
[
{
HostRoles: {
@@ -219,31 +201,13 @@ describe('App.AddServiceController', function() {
items: [
{
Hosts: {
- cpu_count: 1,
- disk_info: [
- diskInfo[0]
- ],
host_name: 'h0',
- ip: '10.1.1.0',
- os_arch: 'x86_64',
- os_type: 'centos6',
- total_mem: 4194304,
- maintenance_state: 'ON'
},
host_components: hostComponents[0]
},
{
Hosts: {
- cpu_count: 2,
- disk_info: [
- diskInfo[1]
- ],
- host_name: 'h1',
- ip: '10.1.1.1',
- os_arch: 'x86',
- os_type: 'centos5',
- total_mem: 3145728,
- maintenance_state: 'OFF'
+ host_name: 'h1'
},
host_components: hostComponents[1]
}
@@ -252,29 +216,15 @@ describe('App.AddServiceController', function() {
expected = {
h0: {
name: 'h0',
- cpu: 1,
- memory: 4194304,
- disk_info: [diskInfo[0]],
- osType: 'centos6',
- osArch: 'x86_64',
- ip: '10.1.1.0',
bootStatus: 'REGISTERED',
isInstalled: true,
- maintenance_state: 'ON',
hostComponents: hostComponents[0],
id: 0
},
h1: {
name: 'h1',
- cpu: 2,
- memory: 3145728,
- disk_info: [diskInfo[1]],
- osType: 'centos5',
- osArch: 'x86',
- ip: '10.1.1.1',
bootStatus: 'REGISTERED',
isInstalled: true,
- maintenance_state: 'OFF',
hostComponents: hostComponents[1],
id: 1
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 3c9048d..57c33b2 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -94,56 +94,86 @@ describe('App.WizardStep5Controller', function () {
});
- describe('#renderHostInfo', function () {
+ describe('#loadWizardHostsSuccessCallback', function () {
var tests = Em.A([
{
- hosts: {
- h1: {memory: 4, cpu: 1, name: 'host1', bootStatus: 'INIT'},
- h2: {memory: 3, cpu: 1, name: 'host2', bootStatus: 'INIT'},
- h3: {memory: 2, cpu: 1, name: 'host3', bootStatus: 'INIT'},
- h4: {memory: 1, cpu: 1, name: 'host4', bootStatus: 'INIT'}
+ dbHosts: {
+ host1: {bootStatus: 'INIT'},
+ host2: {bootStatus: 'INIT'},
+ host3: {bootStatus: 'INIT'},
+ host4: {bootStatus: 'INIT'}
},
+ hosts: [
+ {Hosts: {total_mem: 4, cpu_count: 1, host_name: 'host1', bootStatus: 'INIT'}},
+ {Hosts: {total_mem: 3, cpu_count: 1, host_name: 'host2', bootStatus: 'INIT'}},
+ {Hosts: {total_mem: 2, cpu_count: 1, host_name: 'host3', bootStatus: 'INIT'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host4', bootStatus: 'INIT'}}
+ ],
m: 'no one host is REGISTERED',
e: []
},
{
- hosts: {
- h1: {memory: 4, cpu: 1, name: 'host1', bootStatus: 'REGISTERED'},
- h2: {memory: 3, cpu: 1, name: 'host2', bootStatus: 'REGISTERED'},
- h3: {memory: 2, cpu: 1, name: 'host3', bootStatus: 'REGISTERED'},
- h4: {memory: 1, cpu: 1, name: 'host4', bootStatus: 'REGISTERED'}
+ dbHosts: {
+ host1: {bootStatus: 'REGISTERED'},
+ host2: {bootStatus: 'REGISTERED'},
+ host3: {bootStatus: 'REGISTERED'},
+ host4: {bootStatus: 'REGISTERED'}
},
+ hosts: [
+ {Hosts: {total_mem: 4, cpu_count: 1, host_name: 'host1', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 3, cpu_count: 1, host_name: 'host2', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 2, cpu_count: 1, host_name: 'host3', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host4', bootStatus: 'REGISTERED'}}
+ ],
m: 'all hosts are REGISTERED, memory',
e: ['host1', 'host2', 'host3', 'host4']
},
{
- hosts: {
- h1: {memory: 1, cpu: 4, name: 'host1', bootStatus: 'REGISTERED'},
- h2: {memory: 1, cpu: 3, name: 'host2', bootStatus: 'REGISTERED'},
- h3: {memory: 1, cpu: 2, name: 'host3', bootStatus: 'REGISTERED'},
- h4: {memory: 1, cpu: 1, name: 'host4', bootStatus: 'REGISTERED'}
+ dbHosts: {
+ host1: {bootStatus: 'REGISTERED'},
+ host2: {bootStatus: 'REGISTERED'},
+ host3: {bootStatus: 'REGISTERED'},
+ host4: {bootStatus: 'REGISTERED'}
},
+ hosts: [
+ {Hosts: {total_mem: 1, cpu_count: 4, host_name: 'host1', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 3, host_name: 'host2', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 2, host_name: 'host3', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host4', bootStatus: 'REGISTERED'}}
+ ],
m: 'all hosts are REGISTERED, cpu',
e: ['host1', 'host2', 'host3', 'host4']
},
{
- hosts: {
- h1: {memory: 1, cpu: 1, name: 'host4', bootStatus: 'REGISTERED'},
- h2: {memory: 1, cpu: 1, name: 'host2', bootStatus: 'REGISTERED'},
- h3: {memory: 1, cpu: 1, name: 'host3', bootStatus: 'REGISTERED'},
- h4: {memory: 1, cpu: 1, name: 'host1', bootStatus: 'REGISTERED'}
+ dbHosts: {
+ host1: {bootStatus: 'REGISTERED'},
+ host2: {bootStatus: 'REGISTERED'},
+ host3: {bootStatus: 'REGISTERED'},
+ host4: {bootStatus: 'REGISTERED'}
},
+ hosts: [
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host4', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host2', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host3', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host1', bootStatus: 'REGISTERED'}}
+ ],
m: 'all hosts are REGISTERED, host_name',
e: ['host1', 'host2', 'host3', 'host4']
},
{
- hosts: {
- h1: {memory: 2, cpu: 1, name: 'host1', bootStatus: 'REGISTERED'},
- h2: {memory: 1, cpu: 2, name: 'host3', bootStatus: 'INIT'},
- h3: {memory: 1, cpu: 1, name: 'host4', bootStatus: 'REGISTERED'},
- h4: {memory: 1, cpu: 1, name: 'host2', bootStatus: 'INIT'}
+ dbHosts: {
+ host1: {bootStatus: 'REGISTERED'},
+ host2: {bootStatus: 'INIT'},
+ host3: {bootStatus: 'INIT'},
+ host4: {bootStatus: 'REGISTERED'}
},
+ hosts: [
+ {Hosts: {total_mem: 2, cpu_count: 1, host_name: 'host1', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 2, host_name: 'host3', bootStatus: 'INIT'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host4', bootStatus: 'REGISTERED'}},
+ {Hosts: {total_mem: 1, cpu_count: 1, host_name: 'host2', bootStatus: 'INIT'}}
+ ],
m: 'mix',
e: ['host1', 'host4']
}
@@ -151,8 +181,8 @@ describe('App.WizardStep5Controller', function () {
tests.forEach(function (test) {
it(test.m, function () {
- controller.set('content', {hosts: test.hosts});
- controller.renderHostInfo();
+ controller.set('content', {hosts: test.dbHosts});
+ controller.loadWizardHostsSuccessCallback({items: test.hosts});
var r = controller.get('hosts');
expect(Em.A(r).mapProperty('host_name')).to.eql(test.e);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 078f8ae..1ce96ed 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -1257,8 +1257,8 @@ describe('App.WizardController', function () {
it('should return all hosts', function () {
var hosts = {
- 'h1': {hostComponents: ['c1', 'c2'], disk_info: [{size: 2, available: 1}]},
- 'h2': {hostComponents: ['c3', 'c4'], disk_info: [{size: 2, available: 1}]}
+ 'h1': {hostComponents: ['c1', 'c2']},
+ 'h2': {hostComponents: ['c3', 'c4']}
};
var content = Em.Object.create({
@@ -1271,19 +1271,6 @@ describe('App.WizardController', function () {
{
"id": "h1",
"hostName": "h1",
- "publicHostName": "h1",
- "diskInfo": [
- {
- "size": 2,
- "available": 1
- }
- ],
- "diskTotal": 0.0000019073486328125,
- "diskFree": 9.5367431640625e-7,
- "disksMounted": 1,
- "osType": 0,
- "osArch": 0,
- "ip": 0,
"hostComponents": [
{
"componentName": "c1",
@@ -1298,19 +1285,6 @@ describe('App.WizardController', function () {
{
"id": "h2",
"hostName": "h2",
- "publicHostName": "h2",
- "diskInfo": [
- {
- "size": 2,
- "available": 1
- }
- ],
- "diskTotal": 0.0000019073486328125,
- "diskFree": 9.5367431640625e-7,
- "disksMounted": 1,
- "osType": 0,
- "osArch": 0,
- "ip": 0,
"hostComponents": [
{
"componentName": "c3",
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 d30be42..9f3b6a6 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
@@ -85,11 +85,7 @@ describe('App.RMHighAvailabilityWizardView', function () {
items: [
{
Hosts: {
- host_name: 'host1',
- cpu_count: 1,
- total_mem: 1,
- disk_info: {},
- maintenance_state: 'OFF'
+ host_name: 'host1'
}
}
]
@@ -108,23 +104,15 @@ describe('App.RMHighAvailabilityWizardView', function () {
expect(view.get('controller.content.hosts')).to.be.eql({
"host1": {
"name": "host1",
- "cpu": 1,
- "memory": 1,
- "disk_info": {},
"bootStatus": "REGISTERED",
- "isInstalled": true,
- "maintenance_state": "OFF"
+ "isInstalled": true
}
});
expect(App.db.setHosts.calledWith({
"host1": {
"name": "host1",
- "cpu": 1,
- "memory": 1,
- "disk_info": {},
"bootStatus": "REGISTERED",
- "isInstalled": true,
- "maintenance_state": "OFF"
+ "isInstalled": true
}
})).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/292db86f/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 f6ae81e..4de4aad 100644
--- a/ambari-web/test/views/main/service/reassign_view_test.js
+++ b/ambari-web/test/views/main/service/reassign_view_test.js
@@ -69,10 +69,6 @@ describe('App.ReassignMasterView', function () {
{
Hosts: {
host_name: 'host1',
- cpu_count: 1,
- total_mem: 1024,
- disk_info: {},
- maintenance_state: 'ON'
}
}
]
@@ -90,11 +86,7 @@ describe('App.ReassignMasterView', function () {
{
"host1": {
"bootStatus": "REGISTERED",
- "cpu": 1,
- "disk_info": {},
"isInstalled": true,
- "maintenance_state": "ON",
- "memory": 1024,
"name": "host1"
}
}
@@ -104,11 +96,7 @@ describe('App.ReassignMasterView', function () {
expect(view.get('controller.content.hosts')).to.be.eql({
"host1": {
"bootStatus": "REGISTERED",
- "cpu": 1,
- "disk_info": {},
"isInstalled": true,
- "maintenance_state": "ON",
- "memory": 1024,
"name": "host1"
}
});