You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/03/14 00:15:27 UTC
svn commit: r1456263 - in /incubator/ambari/trunk: ./
ambari-web/app/controllers/ ambari-web/app/controllers/main/admin/
ambari-web/app/controllers/main/admin/security/add/
ambari-web/app/controllers/main/host/
ambari-web/app/controllers/main/service/ ...
Author: yusaku
Date: Wed Mar 13 23:15:26 2013
New Revision: 1456263
URL: http://svn.apache.org/r1456263
Log:
AMBARI-1604. Refactor wizard classes. (yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/installer.js
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/trunk/ambari-web/app/data/mock/step3_single_host.js
incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js
incubator/ambari/trunk/ambari-web/app/routes/add_service_routes.js
incubator/ambari/trunk/ambari-web/app/routes/installer.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Mar 13 23:15:26 2013
@@ -116,6 +116,8 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1604. Refactor wizard classes. (yusaku)
+
AMBARI-1583. Add unit tests for various Ambari Web components. (yusaku)
AMBARI-1491. Add task plots to job swimlane diagram. (billie via yusaku)
Modified: incubator/ambari/trunk/ambari-web/app/controllers/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/installer.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/installer.js Wed Mar 13 23:15:26 2013
@@ -60,25 +60,6 @@ App.InstallerController = App.WizardCont
},
/**
- * Save data, which user filled, to main controller
- * @param stepController App.WizardStep3Controller
- */
- saveConfirmedHosts: function (stepController) {
- var hostInfo = {};
- stepController.get('content.hosts').forEach(function (_host) {
- hostInfo[_host.name] = {
- name: _host.name,
- cpu: _host.cpu,
- memory: _host.memory,
- disk_info: _host.disk_info,
- bootStatus: _host.bootStatus,
- isInstalled: false
- };
- });
- this.set('content.hosts', hostInfo);
- this.save('hosts');
- },
- /**
* Load confirmed hosts.
* Will be used at <code>Assign Masters(step5)</code> step
*/
@@ -87,28 +68,6 @@ App.InstallerController = App.WizardCont
},
/**
- * Save data after installation to main controller
- * @param stepController App.WizardStep9Controller
- */
- saveInstalledHosts: function (stepController) {
- var hosts = stepController.get('hosts');
- var hostInfo = App.db.getHosts();
-
- for (var index in hostInfo) {
- var host = hosts.findProperty('name', hostInfo[index].name);
- if (host) {
- hostInfo[index].status = host.status;
- //tasks should be empty because they loads from the server
- //hostInfo[index].tasks = host.tasks;
- hostInfo[index].message = host.message;
- hostInfo[index].progress = host.progress;
- }
- }
- this.set('content.hosts', hostInfo);
- this.save('hosts');
- },
-
- /**
* Load services data. Will be used at <code>Select services(step4)</code> step
*/
loadServices: function () {
@@ -171,50 +130,6 @@ App.InstallerController = App.WizardCont
},
/**
- * Save slaveHostComponents to main controller
- * @param stepController called at the submission of step6
- */
- saveSlaveComponentHosts: function (stepController) {
-
- var hosts = stepController.get('hosts');
- var headers = stepController.get('headers');
-
- var formattedHosts = Ember.Object.create();
- headers.forEach(function(header) {
- formattedHosts.set(header.get('name'), []);
- });
-
- hosts.forEach(function (host) {
-
- var checkboxes = host.get('checkboxes');
- headers.forEach(function(header) {
- var cb = checkboxes.findProperty('title', header.get('label'));
- if (cb.get('checked')) {
- formattedHosts.get(header.get('name')).push({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: cb.get('installed')
- });
- }
- });
- });
-
- var slaveComponentHosts = [];
-
- headers.forEach(function(header) {
- slaveComponentHosts.push({
- componentName: header.get('name'),
- displayName: header.get('label').replace(/\s/g, ''),
- hosts: formattedHosts.get(header.get('name'))
- });
- });
-
- App.db.setSlaveComponentHosts(slaveComponentHosts);
- console.log('InstallerController.saveSlaveComponentHosts: saved hosts ', slaveComponentHosts);
- this.set('content.slaveComponentHosts', slaveComponentHosts);
- },
-
- /**
* Load master component hosts data for using in required step controllers
*/
loadSlaveComponentHosts: function () {
@@ -267,29 +182,6 @@ App.InstallerController = App.WizardCont
App.db.setServiceConfigProperties(serviceConfigProperties);
this.set('content.serviceConfigProperties', serviceConfigProperties);
-
- //TODO: Uncomment below code to enable slave Configuration
- /*
- var slaveConfigProperties = [];
- stepController.get('stepConfigs').forEach(function (_content) {
- if (_content.get('configCategories').someProperty('isForSlaveComponent', true)) {
- var slaveCategory = _content.get('configCategories').findProperty('isForSlaveComponent', true);
- slaveCategory.get('slaveConfigs.groups').forEach(function (_group) {
- _group.get('properties').forEach(function (_property) {
- var displayType = _property.get('displayType');
- if (displayType === 'directories' || displayType === 'directory') {
- var value = _property.get('value').trim().split(/\s+/g).join(',');
- _property.set('value', value);
- }
- _property.set('storeValue', _property.get('value'));
- }, this);
- }, this);
- slaveConfigProperties.pushObject(slaveCategory.get('slaveConfigs'));
- }
- }, this);
- App.db.setSlaveProperties(slaveConfigProperties);
- this.set('content.slaveGroupProperties', slaveConfigProperties);
- */
},
/**
@@ -347,9 +239,6 @@ App.InstallerController = App.WizardCont
case '8':
case '7':
this.loadServiceConfigProperties();
- // loadSlaveGroupProperties depends on loadSlaveComponentHosts; call loadSlaveComponentHosts first
- // this.loadSlaveComponentHosts();
- // this.loadSlaveGroupProperties();
case '6':
this.loadSlaveComponentHosts();
this.loadClients();
@@ -367,8 +256,6 @@ App.InstallerController = App.WizardCont
}
},
-
-
loadAdvancedConfigs: function () {
var configs = [];
App.db.getSelectedServiceNames().forEach(function (_serviceName) {
@@ -383,7 +270,6 @@ App.InstallerController = App.WizardCont
* Generate serviceProperties save it to localdata
* called form stepController step6WizardController
*/
-
loadAdvancedConfig: function (serviceName) {
var self = this;
var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + App.get('stackVersionURL') + '/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js Wed Mar 13 23:15:26 2013
@@ -68,22 +68,6 @@ App.AddSecurityController = App.WizardCo
},
/**
- * return true if cluster data is loaded and false otherwise
- */
- dataLoading: function () {
- var dfd = $.Deferred();
- this.connectOutlet('loading');
- var interval = setInterval(function () {
- if (App.router.get('clusterController.isLoaded')) {
- dfd.resolve();
- clearInterval(interval);
- }
- }, 50);
- return dfd.promise();
- },
-
-
- /**
* Loads all installed services
*/
loadServices: function () {
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/stack_upgrade_controller.js Wed Mar 13 23:15:26 2013
@@ -39,8 +39,7 @@ App.StackUpgradeController = App.WizardC
upgradeVersion: function(){
return App.router.get('mainAdminClusterController.upgradeVersion');
}.property('App.router.mainAdminClusterController.upgradeVersion'),
- controllerName: 'stackUpgradeController',
- isWizard: true
+ controllerName: 'stackUpgradeController'
}),
/**
@@ -102,8 +101,7 @@ App.StackUpgradeController = App.WizardC
upgradeVersion: function(){
return App.router.get('mainAdminClusterController.upgradeVersion');
}.property('App.router.mainAdminClusterController.upgradeVersion'),
- 'controllerName': this.get('content.controllerName'),
- 'isWizard': !(this.get('content.controllerName') === 'installerController')
+ 'controllerName': 'stackUpgradeController'
}));
this.set('currentStep', 0);
this.clearStorageData();
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/add_controller.js Wed Mar 13 23:15:26 2013
@@ -50,8 +50,7 @@ App.AddHostController = App.WizardContro
masterComponentHosts: null,
serviceConfigProperties: null,
advancedServiceConfig: null,
- controllerName: 'addHostController',
- isWizard: true
+ controllerName: 'addHostController'
}),
components:require('data/service_components'),
@@ -90,53 +89,6 @@ App.AddHostController = App.WizardContro
},
/**
- * Save data, which user filled, to main controller
- * @param stepController App.WizardStep3Controller
- */
- saveConfirmedHosts: function (stepController) {
- var hostInfo = {};
-
- stepController.get('content.hosts').forEach(function (_host) {
- hostInfo[_host.name] = {
- name: _host.name,
- cpu: _host.cpu,
- memory: _host.memory,
- disk_info: _host.disk_info,
- bootStatus: _host.bootStatus,
- isInstalled: false
- };
- });
-
-
- console.log('addHostController:saveConfirmedHosts: save hosts ', hostInfo);
- App.db.setHosts(hostInfo);
- this.set('content.hosts', hostInfo);
- },
-
- /**
- * Save data after installation to main controller
- * @param stepController App.WizardStep9Controller
- */
- saveInstalledHosts: function (stepController) {
- var hosts = stepController.get('hosts');
- var hostInfo = App.db.getHosts();
-
- for (var index in hostInfo) {
- var host = hosts.findProperty('name', hostInfo[index].name);
- if (host) {
- hostInfo[index].status = host.status;
- //tasks should be empty because they loads from the server
- //hostInfo[index].tasks = host.tasks;
- hostInfo[index].message = host.message;
- hostInfo[index].progress = host.progress;
- }
- }
- App.db.setHosts(hostInfo);
- this.set('content.hosts', hostInfo);
- console.log('addHostController:saveInstalledHosts: save hosts ', hostInfo);
- },
-
- /**
* Load services data from server.
*/
loadServicesFromServer: function() {
@@ -158,7 +110,6 @@ App.AddHostController = App.WizardContro
*/
loadServices: function () {
var servicesInfo = App.db.getService();
-
servicesInfo.forEach(function (item, index) {
servicesInfo[index] = Em.Object.create(item);
});
@@ -166,7 +117,7 @@ App.AddHostController = App.WizardContro
console.log('AddHostController.loadServices: loaded data ', servicesInfo);
var serviceNames = servicesInfo.filterProperty('isSelected', true).mapProperty('serviceName');
console.log('selected services ', serviceNames);
- this.set('content.missMasterStep', !serviceNames.contains('HBASE') && !serviceNames.contains('ZOOKEEPER'));
+ this.set('content.skipMasterStep', !serviceNames.contains('HBASE') && !serviceNames.contains('ZOOKEEPER'));
},
/**
@@ -229,50 +180,6 @@ App.AddHostController = App.WizardContro
},
/**
- * Save slaveHostComponents to main controller
- * @param stepController
- */
- saveSlaveComponentHosts: function (stepController) {
-
- var hosts = stepController.get('hosts');
- var headers = stepController.get('headers');
-
- var formattedHosts = Ember.Object.create();
- headers.forEach(function(header) {
- formattedHosts.set(header.get('name'), []);
- });
-
- hosts.forEach(function (host) {
-
- var checkboxes = host.get('checkboxes');
- headers.forEach(function(header) {
- var cb = checkboxes.findProperty('title', header.get('label'));
- if (cb.get('checked')) {
- formattedHosts.get(header.get('name')).push({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: cb.get('installed')
- });
- }
- });
- });
-
- var slaveComponentHosts = [];
-
- headers.forEach(function(header) {
- slaveComponentHosts.push({
- componentName: header.get('name'),
- displayName: header.get('label').replace(/\s/g, ''),
- hosts: formattedHosts.get(header.get('name'))
- });
- });
-
- App.db.setSlaveComponentHosts(slaveComponentHosts);
- console.log('addHostController.slaveComponentHosts: saved hosts', slaveComponentHosts);
- this.set('content.slaveComponentHosts', slaveComponentHosts);
- },
-
- /**
* return slaveComponents bound to hosts
* @return {Array}
*/
@@ -383,28 +290,6 @@ App.AddHostController = App.WizardContro
App.db.setServiceConfigProperties(serviceConfigProperties);
this.set('content.serviceConfigProperties', serviceConfigProperties);
-
- //TODO: Uncomment below code to enable slave Configuration
-
- /*var slaveConfigProperties = [];
- stepController.get('stepConfigs').forEach(function (_content) {
- if (_content.get('configCategories').someProperty('isForSlaveComponent', true)) {
- var slaveCategory = _content.get('configCategories').findProperty('isForSlaveComponent', true);
- slaveCategory.get('slaveConfigs.groups').forEach(function (_group) {
- _group.get('properties').forEach(function (_property) {
- var displayType = _property.get('displayType');
- if (displayType === 'directories' || displayType === 'directory') {
- var value = _property.get('value').trim().split(/\s+/g).join(',');
- _property.set('value', value);
- }
- _property.set('storeValue', _property.get('value'));
- }, this);
- }, this);
- slaveConfigProperties.pushObject(slaveCategory.get('slaveConfigs'));
- }
- }, this);
- App.db.setSlaveProperties(slaveConfigProperties);
- this.set('content.slaveGroupProperties', slaveConfigProperties);*/
},
/**
@@ -426,21 +311,6 @@ App.AddHostController = App.WizardContro
},
/**
- * return true if cluster data is loaded and false otherwise
- */
- dataLoading: function () {
- var dfd = $.Deferred();
- this.connectOutlet('loading');
- var interval = setInterval(function () {
- if (App.router.get('clusterController.isLoaded')) {
- dfd.resolve();
- clearInterval(interval);
- }
- }, 50);
- return dfd.promise();
- },
-
- /**
* Generate clients list for selected services and save it to model
* @param stepController step4WizardController
*/
@@ -508,7 +378,7 @@ App.AddHostController = App.WizardContro
*/
loadAdvancedConfig: function (serviceName) {
var self = this;
- var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + '/stacks/HDP/version/1.2.0/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
+ var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + App.get('stackVersionURL') + '/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
var method = 'GET';
$.ajax({
type: method,
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/add_controller.js Wed Mar 13 23:15:26 2013
@@ -50,8 +50,7 @@ App.AddServiceController = App.WizardCon
masterComponentHosts: null,
serviceConfigProperties: null,
advancedServiceConfig: null,
- controllerName: 'addServiceController',
- isWizard: true
+ controllerName: 'addServiceController'
}),
/**
@@ -89,28 +88,6 @@ App.AddServiceController = App.WizardCon
},
/**
- * Save data after installation to main controller
- * @param stepController App.WizardStep9Controller
- */
- saveInstalledHosts: function (stepController) {
- var hosts = stepController.get('hosts');
- var hostInfo = App.db.getHosts();
-
- for (var index in hostInfo) {
- hostInfo[index].status = "pending";
- var host = hosts.findProperty('name', hostInfo[index].name);
- if (host) {
- hostInfo[index].status = host.status;
- hostInfo[index].message = host.message;
- hostInfo[index].progress = host.progress;
- }
- }
- this.set('content.hosts', hostInfo);
- this.save('hosts');
- console.log('AddServiceController:saveInstalledHosts: save hosts ', hostInfo);
- },
-
- /**
* Load services data from server.
*/
loadServicesFromServer: function() {
@@ -141,7 +118,7 @@ App.AddServiceController = App.WizardCon
var serviceNames = servicesInfo.filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName');
console.log('selected services ', serviceNames);
- this.set('content.missSlavesStep', !serviceNames.contains('MAPREDUCE') && !serviceNames.contains('HBASE'));
+ this.set('content.skipSlavesStep', !serviceNames.contains('MAPREDUCE') && !serviceNames.contains('HBASE'));
},
/**
@@ -158,7 +135,7 @@ App.AddServiceController = App.WizardCon
App.db.setSelectedServiceNames(serviceNames);
console.log('AddServiceController.selectedServiceNames:', serviceNames);
- this.set('content.missSlavesStep', !serviceNames.contains('MAPREDUCE') && !serviceNames.contains('HBASE'));
+ this.set('content.skipSlavesStep', !serviceNames.contains('MAPREDUCE') && !serviceNames.contains('HBASE'));
},
/**
@@ -184,7 +161,7 @@ App.AddServiceController = App.WizardCon
App.db.setMasterComponentHosts(masterComponentHosts);
this.set('content.masterComponentHosts', masterComponentHosts);
- this.set('content.missMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
+ this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
},
/**
@@ -206,85 +183,7 @@ App.AddServiceController = App.WizardCon
this.set("content.masterComponentHosts", masterComponentHosts);
console.log("AddServiceController.loadMasterComponentHosts: loaded hosts ", masterComponentHosts);
- this.set('content.missMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
- },
-
- /**
- * Save slaveHostComponents to main controller
- * @param stepController
- */
- saveSlaveComponentHosts: function (stepController) {
-
- var hosts = stepController.get('hosts');
- var isMrSelected = stepController.get('isMrSelected');
- var isHbSelected = stepController.get('isHbSelected');
-
- var dataNodeHosts = [];
- var taskTrackerHosts = [];
- var regionServerHosts = [];
- var clientHosts = [];
-
- hosts.forEach(function (host) {
-
- if (host.get('isDataNode')) {
- dataNodeHosts.push({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: host.get('isDataNodeInstalled')
- });
- }
- if (isMrSelected && host.get('isTaskTracker')) {
- taskTrackerHosts.push({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: host.get('isTaskTrackerInstalled')
- });
- }
- if (isHbSelected && host.get('isRegionServer')) {
- regionServerHosts.push({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: host.get('isRegionServerInstalled')
- });
- }
- if (host.get('isClient')) {
- clientHosts.pushObject({
- hostName: host.hostName,
- group: 'Default',
- isInstalled: host.get('isClientInstalled')
- });
- }
- }, this);
-
- var slaveComponentHosts = [];
- slaveComponentHosts.push({
- componentName: 'DATANODE',
- displayName: 'DataNode',
- hosts: dataNodeHosts
- });
- if (isMrSelected) {
- slaveComponentHosts.push({
- componentName: 'TASKTRACKER',
- displayName: 'TaskTracker',
- hosts: taskTrackerHosts
- });
- }
- if (isHbSelected) {
- slaveComponentHosts.push({
- componentName: 'HBASE_REGIONSERVER',
- displayName: 'RegionServer',
- hosts: regionServerHosts
- });
- }
- slaveComponentHosts.pushObject({
- componentName: 'CLIENT',
- displayName: 'client',
- hosts: clientHosts
- });
-
- App.db.setSlaveComponentHosts(slaveComponentHosts);
- console.log('addServiceController.slaveComponentHosts: saved hosts', slaveComponentHosts);
- this.set('content.slaveComponentHosts', slaveComponentHosts);
+ this.set('content.skipMasterStep', this.get('content.masterComponentHosts').everyProperty('isInstalled', true));
},
/**
@@ -404,28 +303,6 @@ App.AddServiceController = App.WizardCon
App.db.setServiceConfigProperties(serviceConfigProperties);
this.set('content.serviceConfigProperties', serviceConfigProperties);
-
- //TODO: Uncomment below code to enable slave Configuration
-
- /*var slaveConfigProperties = [];
- stepController.get('stepConfigs').forEach(function (_content) {
- if (_content.get('configCategories').someProperty('isForSlaveComponent', true)) {
- var slaveCategory = _content.get('configCategories').findProperty('isForSlaveComponent', true);
- slaveCategory.get('slaveConfigs.groups').forEach(function (_group) {
- _group.get('properties').forEach(function (_property) {
- var displayType = _property.get('displayType');
- if (displayType === 'directories' || displayType === 'directory') {
- var value = _property.get('value').trim().split(/\s+/g).join(',');
- _property.set('value', value);
- }
- _property.set('storeValue', _property.get('value'));
- }, this);
- }, this);
- slaveConfigProperties.pushObject(slaveCategory.get('slaveConfigs'));
- }
- }, this);
- App.db.setSlaveProperties(slaveConfigProperties);
- this.set('content.slaveGroupProperties', slaveConfigProperties);*/
},
/**
@@ -447,25 +324,6 @@ App.AddServiceController = App.WizardCon
},
/**
- * return true if cluster data is loaded and false otherwise
- */
- dataLoading: function(){
- var dfd = $.Deferred();
- this.connectOutlet('loading');
- if (App.router.get('clusterController.isLoaded')){
- dfd.resolve();
- } else{
- var interval = setInterval(function(){
- if (App.router.get('clusterController.isLoaded')){
- dfd.resolve();
- clearInterval(interval);
- }
- },50);
- }
- return dfd.promise();
- },
-
- /**
* Generate clients list for selected services and save it to model
* @param stepController step4WizardController
*/
@@ -529,7 +387,7 @@ App.AddServiceController = App.WizardCon
*/
loadAdvancedConfig: function (serviceName) {
var self = this;
- var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + App.get('stackVersionURL') +'/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
+ var url = (App.testMode) ? '/data/wizard/stack/hdp/version01/' + serviceName + '.json' : App.apiPrefix + App.get('stackVersionURL') + '/services/' + serviceName; // TODO: get this url from the stack selected by the user in Install Options page
var method = 'GET';
$.ajax({
type: method,
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/reassign_controller.js Wed Mar 13 23:15:26 2013
@@ -51,7 +51,6 @@ App.ReassignMasterController = App.Wizar
serviceConfigProperties: null,
advancedServiceConfig: null,
controllerName: 'reassignMasterController',
- isWizard: true,
reassign: null
}),
@@ -64,25 +63,6 @@ App.ReassignMasterController = App.Wizar
},
/**
- * return true if cluster data is loaded and false otherwise
- */
- dataLoading: function(){
- var dfd = $.Deferred();
- this.connectOutlet('loading');
- if (App.router.get('clusterController.isLoaded')){
- dfd.resolve();
- } else{
- var interval = setInterval(function(){
- if (App.router.get('clusterController.isLoaded')){
- dfd.resolve();
- clearInterval(interval);
- }
- },50);
- }
- return dfd.promise();
- },
-
- /**
* Load services data from server.
*/
loadServicesFromServer: function() {
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard.js Wed Mar 13 23:15:26 2013
@@ -59,14 +59,6 @@ App.WizardController = Em.Controller.ext
}
},
- prevInstallStatus: function () {
- console.log('Inside the prevInstallStep function: The name is ' + App.router.get('loginController.loginName'));
- var result = App.db.isCompleted()
- if (result == '1') {
- return true;
- }
- }.property('App.router.loginController.loginName'),
-
/**
* Set current step to new value.
* Method moved from App.router.setInstallerCurrentStep
@@ -199,7 +191,7 @@ App.WizardController = Em.Controller.ext
},
/**
- * Temporary function for wizardStep9, before back-end integration
+ * Initialize host status info for step9
*/
setInfoForStep9: function () {
@@ -392,8 +384,7 @@ App.WizardController = Em.Controller.ext
clear: function () {
this.set('content', Ember.Object.create({
- 'controllerName': this.get('content.controllerName'),
- 'isWizard': !(this.get('content.controllerName') === 'installerController')
+ 'controllerName': this.get('content.controllerName')
}));
this.set('currentStep', 0);
this.clearStorageData();
@@ -513,32 +504,6 @@ App.WizardController = Em.Controller.ext
App.db.setService(apiService);
},
- /**
- * Load properties for group of slaves to model
- */
- loadSlaveGroupProperties: function () {
- var groupConfigProperties = App.db.getSlaveProperties() ? App.db.getSlaveProperties() : this.get('content.slaveComponentHosts');
- if (groupConfigProperties) {
- groupConfigProperties.forEach(function (_slaveComponentObj) {
- if (_slaveComponentObj.groups) {
- var groups = [];
- _slaveComponentObj.groups.forEach(function (_group) {
- var properties = [];
- _group.properties.forEach(function (_property) {
- var property = App.ServiceConfigProperty.create(_property);
- property.set('value', _property.storeValue);
- properties.pushObject(property);
- }, this);
- _group.properties = properties;
- groups.pushObject(App.Group.create(_group));
- }, this);
- _slaveComponentObj.groups = groups;
- }
- }, this);
- }
- this.set('content.slaveGroupProperties', groupConfigProperties);
- },
-
registerErrPopup: function (header, message) {
App.ModalPopup.show({
header: header,
@@ -551,6 +516,114 @@ App.WizardController = Em.Controller.ext
message: message
})
});
+ },
+
+ /**
+ * Save hosts that the user confirmed to proceed with from step 3
+ * @param stepController App.WizardStep3Controller
+ */
+ saveConfirmedHosts: function (stepController) {
+ var hostInfo = {};
+
+ stepController.get('content.hosts').forEach(function (_host) {
+ hostInfo[_host.name] = {
+ name: _host.name,
+ cpu: _host.cpu,
+ memory: _host.memory,
+ disk_info: _host.disk_info,
+ bootStatus: _host.bootStatus,
+ isInstalled: false
+ };
+ });
+ console.log('wizardController:saveConfirmedHosts: save hosts ', hostInfo);
+ App.db.setHosts(hostInfo);
+ this.set('content.hosts', hostInfo);
+ },
+
+ /**
+ * Save data after installation to main controller
+ * @param stepController App.WizardStep9Controller
+ */
+ saveInstalledHosts: function (stepController) {
+ var hosts = stepController.get('hosts');
+ var hostInfo = App.db.getHosts();
+
+ for (var index in hostInfo) {
+ hostInfo[index].status = "pending";
+ var host = hosts.findProperty('name', hostInfo[index].name);
+ if (host) {
+ hostInfo[index].status = host.status;
+ hostInfo[index].message = host.message;
+ hostInfo[index].progress = host.progress;
+ }
+ }
+ this.set('content.hosts', hostInfo);
+ this.save('hosts');
+ console.log('wizardController:saveInstalledHosts: save hosts ', hostInfo);
+ },
+
+ /**
+ * Save slaveHostComponents to main controller
+ * @param stepController
+ */
+ saveSlaveComponentHosts: function (stepController) {
+
+ var hosts = stepController.get('hosts');
+ var headers = stepController.get('headers');
+
+ var formattedHosts = Ember.Object.create();
+ headers.forEach(function(header) {
+ formattedHosts.set(header.get('name'), []);
+ });
+
+ hosts.forEach(function (host) {
+
+ var checkboxes = host.get('checkboxes');
+ headers.forEach(function(header) {
+ var cb = checkboxes.findProperty('title', header.get('label'));
+ if (cb.get('checked')) {
+ formattedHosts.get(header.get('name')).push({
+ hostName: host.hostName,
+ group: 'Default',
+ isInstalled: cb.get('installed')
+ });
+ }
+ });
+ });
+
+ var slaveComponentHosts = [];
+
+ headers.forEach(function(header) {
+ slaveComponentHosts.push({
+ componentName: header.get('name'),
+ displayName: header.get('label').replace(/\s/g, ''),
+ hosts: formattedHosts.get(header.get('name'))
+ });
+ });
+
+ App.db.setSlaveComponentHosts(slaveComponentHosts);
+ console.log('wizardController.slaveComponentHosts: saved hosts', slaveComponentHosts);
+ this.set('content.slaveComponentHosts', slaveComponentHosts);
+ },
+
+ /**
+ * Return true if cluster data is loaded and false otherwise.
+ * This is used for all wizard controllers except for installer wizard.
+ */
+ dataLoading: function(){
+ var dfd = $.Deferred();
+ this.connectOutlet('loading');
+ if (App.router.get('clusterController.isLoaded')){
+ dfd.resolve();
+ } else{
+ var interval = setInterval(function(){
+ if (App.router.get('clusterController.isLoaded')){
+ dfd.resolve();
+ clearInterval(interval);
+ }
+ },50);
+ }
+ return dfd.promise();
}
})
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step10_controller.js Wed Mar 13 23:15:26 2013
@@ -21,10 +21,6 @@ var App = require('app');
App.WizardStep10Controller = Em.Controller.extend({
clusterInfo: [],
- /**
- * check if were added regionservers then NAGIOS services should be restarted
- * to update number of regionservers in NAGIOS
- */
isNagiosRestartRequired: function() {
return this.get('content.controllerName') !== 'installerController' && App.Service.find('NAGIOS').get('isLoaded');
}.property(),
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step6_controller.js Wed Mar 13 23:15:26 2013
@@ -226,12 +226,12 @@ App.WizardStep6Controller = Em.Controlle
this.render();
if (this.get('isMasters')) {
- if(this.get('content.missMasterStep')) {
+ if(this.get('content.skipMasterStep')) {
App.router.send('next');
}
}
else {
- if(this.get('content.missSlavesStep')) {
+ if(this.get('content.skipSlavesStep')) {
App.router.send('next');
}
}
Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js Wed Mar 13 23:15:26 2013
@@ -895,7 +895,7 @@ App.WizardStep8Controller = Em.Controlle
createCluster: function () {
- if (this.get('content.isWizard')) {
+ if (this.get('content.controllerName') !== 'installerController') {
return false;
}
@@ -1170,22 +1170,19 @@ App.WizardStep8Controller = Em.Controlle
createConfigurations: function () {
var selectedServices = this.get('selectedServices');
- if (!this.get('content.isWizard')) {
+ if (this.get('content.controllerName') == 'installerController') {
this.createConfigSiteForService(this.createGlobalSiteObj());
// this.createGlobalSitePerSlaveGroup();
this.createConfigSiteForService(this.createCoreSiteObj());
this.createConfigSiteForService(this.createHdfsSiteObj());
- //this.createHdfsSitePerSlaveGroup('HDFS');
}
if (selectedServices.someProperty('serviceName', 'MAPREDUCE')) {
this.createConfigSiteForService(this.createMrSiteObj());
this.createConfigSiteForService(this.createCapacityScheduler());
- this.createConfigSiteForService(this.createMapredQueue());
- //this.createMrSitePerSlaveGroup('MAPREDUCE');
+ this.createConfigSiteForService(this.createMapredQueueAcls());
}
if (selectedServices.someProperty('serviceName', 'HBASE')) {
this.createConfigSiteForService(this.createHbaseSiteObj());
- //this.createHbaseSitePerSlaveGroup('HBASE');
}
if (selectedServices.someProperty('serviceName', 'OOZIE')) {
this.createConfigSiteForService(this.createOozieSiteObj('OOZIE'));
@@ -1235,34 +1232,6 @@ App.WizardStep8Controller = Em.Controlle
return {"type": "global", "tag": "version1", "properties": globalSiteProperties};
},
- createGlobalSitePerSlaveGroup: function () {
- this.get('slaveComponentConfig.components').forEach(function (_component) {
- _component.groups.forEach(function (_group) {
- var globalSiteProperties = {};
- var properties = _group.properties;
- properties.forEach(function (_property) {
- if (!/_hosts?$/.test(_property.name)) {
- // append "m" to JVM memory options except for hadoop_heapsize
- if (/_heapsize|_newsize|_maxnewsize$/.test(_property.name) && _property.name !== 'hadoop_heapsize') {
- globalSiteProperties[_property.name] = _property.value + "m";
- } else {
- globalSiteProperties[_property.name] = _property.storeValue;
- }
- console.log("STEP8: name of the global property is: " + _property.name);
- console.log("STEP8: value of the global property is: " + _property.storeValue);
- }
- }, this);
- var config = _group.configVersion.config;
- for (var index in config) {
- if (index === 'datanode-global' || index === 'tasktracker-global' || index === 'regionserver-global') {
- var data = {"type": index, "tag": config[index], "properties": globalSiteProperties};
- this.createConfigSiteForService(data);
- }
- }
- }, this);
- }, this);
- },
-
createCoreSiteObj: function () {
var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
var coreSiteProperties = {};
@@ -1294,28 +1263,6 @@ App.WizardStep8Controller = Em.Controlle
return {"type": "hdfs-site", "tag": "version1", "properties": hdfsProperties };
},
- createHdfsSitePerSlaveGroup: function (serviceName) {
- var hdfsSite = this.createHdfsSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = hdfsSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": hdfsSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- console.log("The value of globalConfig is: " + JSON.stringify(siteProperties));
- this.createConfigSiteForService(data);
- }, this);
- },
-
createMrSiteObj: function () {
var configs = this.get('configs').filterProperty('filename', 'mapred-site.xml');
var mrProperties = {};
@@ -1338,7 +1285,7 @@ App.WizardStep8Controller = Em.Controlle
return {type: 'capacity-scheduler', tag: 'version1', properties: csProperties};
},
- createMapredQueue: function () {
+ createMapredQueueAcls: function () {
var configs = this.get('configs').filterProperty('filename', 'mapred-queue-acls.xml');
var mqProperties = {};
configs.forEach(function (_configProperty) {
@@ -1349,27 +1296,6 @@ App.WizardStep8Controller = Em.Controlle
return {type: 'mapred-queue-acls', tag: 'version1', properties: mqProperties};
},
- createMrSitePerSlaveGroup: function (serviceName) {
- var mrSite = this.createMrSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = mrSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": mrSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- this.createConfigSiteForService(data);
- }, this);
- },
-
createHbaseSiteObj: function () {
var configs = this.get('configs').filterProperty('filename', 'hbase-site.xml');
var hbaseProperties = {};
@@ -1379,27 +1305,6 @@ App.WizardStep8Controller = Em.Controlle
return {type: 'hbase-site', tag: 'version1', properties: hbaseProperties};
},
- createHbaseSitePerSlaveGroup: function (serviceName) {
- var hbaseSite = this.createHbaseSiteObj();
- var component = this.get('slaveComponentConfig.components').findProperty('serviceName', serviceName);
- component.groups.forEach(function (_group) {
- var siteProperties = hbaseSite.properties;
- _group.properties.forEach(function (_property) {
- this.get('configMapping').forEach(function (_config) {
- if (_config.templateName.contains(_property.name)) {
- this.get('globals').findProperty('name', _property.name).value = _property.storeValue;
- var value = this.getGlobConfigValue(_config.templateName, _config.value);
- if (siteProperties[_config.name]) {
- siteProperties[_config.name] = value;
- }
- }
- }, this);
- }, this);
- var data = {"type": hbaseSite.type, "tag": _group.siteVersion, "properties": siteProperties};
- this.createConfigSiteForService(data);
- }, this);
- },
-
createOozieSiteObj: function (serviceName) {
var configs = this.get('configs').filterProperty('filename', 'oozie-site.xml');
var oozieProperties = {};
@@ -1450,36 +1355,6 @@ App.WizardStep8Controller = Em.Controlle
});
},
- applyCreatedConfToSlaveGroups: function () {
- this.get('slaveComponentConfig.components').forEach(function (_component) {
- _component.groups.forEach(function (_group) {
- var aggregatedHostNames = '';
- _group.hostNames.forEach(function (_hostName, index) {
- aggregatedHostNames += 'HostRoles/host_name=' + _hostName;
- if (index !== _group.hostNames.length - 1) {
- aggregatedHostNames += '|';
- }
- }, this);
- console.log("The aggregated hostNames value is: " + aggregatedHostNames);
- this.applyCreatedConfToSlaveGroup(aggregatedHostNames, 'PUT', _group.configVersion, _group.groupName);
- }, this);
- }, this);
- },
-
- applyCreatedConfToSlaveGroup: function (aggregatedHostNames, httpMethod, data, groupName) {
- console.log("Inside applyCreatedConfToHost");
- var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/host_components?' + aggregatedHostNames;
-
- this.ajax({
- type: httpMethod,
- url: url,
- data: JSON.stringify(data),
- beforeSend: function () {
- console.log("BeforeSend: applyCreatedConfToSlaveGroup for group: " + groupName);
- }
- });
- },
-
getConfigForService: function (serviceName) {
switch (serviceName) {
case 'HDFS':
Modified: incubator/ambari/trunk/ambari-web/app/data/mock/step3_single_host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/mock/step3_single_host.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/mock/step3_single_host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/mock/step3_single_host.js Wed Mar 13 23:15:26 2013
@@ -16,8 +16,6 @@
* limitations under the License.
*/
-
-
module.exports = new Ember.Set([
{
name: '192.168.1.2',
Modified: incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_host_routes.js Wed Mar 13 23:15:26 2013
@@ -174,7 +174,7 @@ module.exports = Em.Route.extend({
},
back: function(router) {
var controller = router.get('addHostController');
- if(!controller.get('content.missMasterStep')) {
+ if(!controller.get('content.skipMasterStep')) {
router.transitionTo('step2');
}
else {
@@ -206,7 +206,7 @@ module.exports = Em.Route.extend({
},
back: function(router) {
var controller = router.get('addHostController');
- if(!controller.get('content.missMasterStep')) {
+ if(!controller.get('content.skipMasterStep')) {
router.transitionTo('step2');
}
else {
Modified: incubator/ambari/trunk/ambari-web/app/routes/add_service_routes.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_service_routes.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_service_routes.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_service_routes.js Wed Mar 13 23:15:26 2013
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+var App = require('app');
+
module.exports = Em.Route.extend({
route: '/services/add',
@@ -123,7 +125,7 @@ module.exports = Em.Route.extend({
},
back: function(router){
var controller = router.get('addServiceController');
- if(!controller.get('content.missMasterStep')){
+ if(!controller.get('content.skipMasterStep')){
router.transitionTo('step2');
} else {
router.transitionTo('step1');
@@ -138,7 +140,6 @@ module.exports = Em.Route.extend({
addServiceController.get('content').set('serviceConfigProperties', null);
App.db.setServiceConfigProperties(null);
App.db.setSlaveProperties(null);
- //addServiceController.loadSlaveGroupProperties();
addServiceController.loadAdvancedConfigs();
router.transitionTo('step4');
}
@@ -158,9 +159,9 @@ module.exports = Em.Route.extend({
},
back: function(router){
var controller = router.get('addServiceController');
- if(!controller.get('content.missSlavesStep')){
+ if(!controller.get('content.skipSlavesStep')){
router.transitionTo('step3');
- } else if(!controller.get('content.missMasterStep')) {
+ } else if(!controller.get('content.skipMasterStep')) {
router.transitionTo('step2');
} else {
router.transitionTo('step1');
Modified: incubator/ambari/trunk/ambari-web/app/routes/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/installer.js?rev=1456263&r1=1456262&r2=1456263&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/installer.js Wed Mar 13 23:15:26 2013
@@ -243,7 +243,6 @@ module.exports = Em.Route.extend({
controller.get('content').set('serviceConfigProperties', null);
App.db.setServiceConfigProperties(null);
App.db.setSlaveProperties(null);
- controller.loadSlaveGroupProperties();
controller.loadAdvancedConfigs();
router.transitionTo('step7');
}