Author: yusaku
Date: Fri Jan 11 01:33:41 2013
New Revision: 1431782
URL: http://svn.apache.org/viewvc?rev=1431782&view=rev
Log:
AMBARI-1110. After clicking the deploy button on the Add Hosts wizard, the user
is always taken to the Installer Wizard Step 8 upon login. (Arun Kandregula via
yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/trunk/ambari-web/app/models/cluster_states.js
incubator/ambari/trunk/ambari-web/app/models/service_config.js
incubator/ambari/trunk/ambari-web/app/router.js
incubator/ambari/trunk/ambari-web/app/routes/add_host_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=1431782&r1=1431781&r2=1431782&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Jan 11 01:33:41 2013
@@ -675,6 +675,10 @@ AMBARI-666 branch (unreleased changes)
BUG FIXES
+ AMBARI-1110. After clicking the deploy button on the Add Hosts wizard, the
+ user is always taken to the Installer Wizard Step 8 upon login.
+ (Arun Kandregula via yusaku)
+
AMBARI-1152. Add Hosts wizard - Retry button does not trigger call to
backend. (yusaku)
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=1431782&r1=1431781&r2=1431782&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
Fri Jan 11 01:33:41 2013
@@ -748,11 +748,29 @@ App.WizardStep8Controller = Em.Controlle
if (App.testMode || !this.get('content.cluster.requestId')) {
// For recovery : set the cluster status
- App.clusterStatus.set('value', {
- clusterName: this.get('clusterName'),
- clusterState: 'CLUSTER_DEPLOY_PREP_2',
- localdb: App.db.data
- });
+
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ switch (this.get('content.controllerName')) {
+ case 'installerController' :
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'CLUSTER_DEPLOY_PREP_2',
+ wizardControllerName: this.get('content.controllerName'),
+ localdb: App.db.data,
+ });
+ break;
+
+ case 'addHostController' :
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
+ wizardControllerName: this.get('content.controllerName'),
+ localdb: App.db.data
+ });
+ break;
+ default :
+ break;
+ }
this.createCluster();
this.createSelectedServices();
Modified: incubator/ambari/trunk/ambari-web/app/models/cluster_states.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/cluster_states.js?rev=1431782&r1=1431781&r2=1431782&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/cluster_states.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/cluster_states.js Fri Jan 11
01:33:41 2013
@@ -15,91 +15,103 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- var App = require('app');
+var App = require('app');
- App.clusterStatus = Ember.Object.create({
- clusterName: '',
- validStates: ['CLUSTER_NOT_CREATED_1', 'CLUSTER_DEPLOY_PREP_2',
'CLUSTER_INSTALLING_3', 'CLUSTER_INSTALLED_4', 'CLUSTER_STARTED_5'],
- clusterState: 'CLUSTER_NOT_CREATED_1',
- localdb: null,
- key: function () {
- return 'CLUSTER_CURRENT_STATUS';
- }.property(),
- value: function (key, newValue) {
- // getter
- if (arguments.length == 1) {
-
- var url = App.apiPrefix + '/persist/' + this.get('key');
- jQuery.ajax(
- {
- url: url,
- context: this,
- async: false,
- success: function (response) {
- if (response) {
- var newValue = jQuery.parseJSON(response);
- if (newValue.clusterState)
- this.set('clusterState', newValue.clusterState);
- if (newValue.clusterName)
- this.set('clusterName', newValue.clusterName);
- if (newValue.localdb)
- this.set('localdb', newValue.localdb);
- } else {
- // default status already set
+App.clusterStatus = Ember.Object.create({
+ clusterName: '',
+ validStates: ['CLUSTER_NOT_CREATED_1', 'CLUSTER_DEPLOY_PREP_2',
'CLUSTER_INSTALLING_3', 'CLUSTER_INSTALLED_4', 'CLUSTER_STARTED_5',
'ADD_HOSTS_DEPLOY_PREP_2', 'ADD_HOSTS_INSTALLING_3', 'ADD_HOSTS_INSTALLED_4',
'ADD_HOSTS_COMPLETED_5'],
+ clusterState: 'CLUSTER_NOT_CREATED_1',
+ wizardControllerName: null,
+ localdb: null,
+ key: function () {
+ return 'CLUSTER_CURRENT_STATUS';
+ }.property(),
+ value: function (key, newValue) {
+ // getter
+ if (arguments.length == 1) {
+
+ var url = App.apiPrefix + '/persist/' + this.get('key');
+ jQuery.ajax(
+ {
+ url: url,
+ context: this,
+ async: false,
+ success: function (response) {
+ if (response) {
+ var newValue = jQuery.parseJSON(response);
+ if (newValue.clusterState) {
+ this.set('clusterState', newValue.clusterState);
+ }
+ if (newValue.clusterName) {
+ this.set('clusterName', newValue.clusterName);
+ }
+ if (newValue.wizardControllerName) {
+ this.set('wizardControllerName',
newValue.wizardControllerName);
}
- },
- error: function (xhr) {
- if (xhr.status == 404) {
- // default status already set
- console.log('Persist API did NOT find the key
CLUSTER_CURRENT_STATUS');
+ if (newValue.localdb) {
+ this.set('localdb', newValue.localdb);
}
+ } else {
+ // default status already set
+ }
+ },
+ error: function (xhr) {
+ if (xhr.status == 404) {
+ // default status already set
+ console.log('Persist API did NOT find the key
CLUSTER_CURRENT_STATUS');
}
}
- );
-
- return {
- clusterName: this.get('clusterName'),
- clusterState: this.get('clusterState'),
- localdb: this.get('localdb')
- };
-
- } else if (newValue) {
- //setter
- if (newValue.clusterState) {
- this.set('clusterState', newValue.clusterState);
- }
- if (newValue.clusterName) {
- this.set('clusterName', newValue.clusterName);
}
- if (newValue.localdb) {
- this.set('localdb', newValue.localdb);
- }
-
- var url = App.apiPrefix + '/persist/';
- var keyValuePair = {};
- var val = {
- clusterName: this.get('clusterName'),
- clusterState: this.get('clusterState'),
- localdb: this.get('localdb')
- };
- keyValuePair[this.get('key')] = JSON.stringify(val);
+ );
+ return {
+ clusterName: this.get('clusterName'),
+ clusterState: this.get('clusterState'),
+ wizardControllerName: this.get('wizardControllerName'),
+ localdb: this.get('localdb')
+ };
+
+ } else if (newValue) {
+ //setter
+ if (newValue.clusterState) {
+ this.set('clusterState', newValue.clusterState);
+ }
+ if (newValue.clusterName) {
+ this.set('clusterName', newValue.clusterName);
+ }
+ if (newValue.wizardControllerName) {
+ this.set('wizardControllerName', newValue.wizardControllerName);
+ }
+ if (newValue.localdb) {
+ this.set('localdb', newValue.localdb);
+ }
- jQuery.ajax({
- async: false,
- context: this,
- type: "POST",
- url: url,
- data: JSON.stringify(keyValuePair),
- beforeSend: function () {
- console.log('BeforeSend: persistKeyValues', keyValuePair);
- }
- });
+ var url = App.apiPrefix + '/persist/';
+ var keyValuePair = {};
+ var val = {
+ clusterName: this.get('clusterName'),
+ clusterState: this.get('clusterState'),
+ wizardControllerName: this.get('wizardControllerName'),
+ localdb: this.get('localdb')
+ };
+ keyValuePair[this.get('key')] = JSON.stringify(val);
+
+
+ jQuery.ajax({
+ async: false,
+ context: this,
+ type: "POST",
+ url: url,
+ data: JSON.stringify(keyValuePair),
+ beforeSend: function () {
+ console.log('BeforeSend: persistKeyValues', keyValuePair);
+ }
+ });
- return newValue;
+ return newValue;
- }
+ }
- }.property('clusterName', 'clusterState', 'localdb')
+ }.property('clusterName', 'clusterState', 'localdb')
- });
\ No newline at end of file
+});
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/models/service_config.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service_config.js?rev=1431782&r1=1431781&r2=1431782&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service_config.js Fri Jan 11
01:33:41 2013
@@ -243,6 +243,11 @@ App.ServiceConfigProperty = Ember.Object
break;
}
+ // In Add Host Wizard, if we did not select this slave component for any
host, then we don't process any further.
+ if (setOfHostNames.length === 0) {
+ return;
+ }
+
var allMountPoints = [];
for (var i = 0; i < setOfHostNames.length; i++) {
hostname = setOfHostNames[i];
Modified: incubator/ambari/trunk/ambari-web/app/router.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/router.js?rev=1431782&r1=1431781&r2=1431782&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/router.js (original)
+++ incubator/ambari/trunk/ambari-web/app/router.js Fri Jan 11 01:33:41 2013
@@ -252,9 +252,13 @@ App.Router = Em.Router.extend({
return 'installer';
}
var clusterStatusOnServer = App.clusterStatus.get('value');
- if (clusterStatusOnServer && clusterStatusOnServer.clusterState ===
'CLUSTER_STARTED_5') {
+ if (clusterStatusOnServer && (clusterStatusOnServer.clusterState ===
'CLUSTER_STARTED_5' || clusterStatusOnServer.clusterState ===
'ADD_HOSTS_COMPLETED_5' )) {
return 'main.index';
+ } else if (clusterStatusOnServer &&
clusterStatusOnServer.wizardControllerName ===
App.router.get('addHostController.name')) {
+ // if wizardControllerName == "addHostController", then it means someone
closed the browser or the browser was crashed when we were last in Add Hosts
wizard
+ return 'main.hostAdd';
} else {
+ // if wizardControllerName == "installerController", then it means
someone closed the browser or the browser was crashed when we were last in
Installer wizard
return 'installer';
}
},
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=1431782&r1=1431781&r2=1431782&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 Fri Jan 11
01:33:41 2013
@@ -46,6 +46,31 @@ module.exports = Em.Route.extend({
router.transitionTo('hosts.index');
}
});
+
+ var currentClusterStatus = App.clusterStatus.get('value');
+
+ if (currentClusterStatus) {
+ switch (currentClusterStatus.clusterState) {
+ case 'ADD_HOSTS_DEPLOY_PREP_2' :
+ addHostController.setCurrentStep('4');
+ App.db.data = currentClusterStatus.localdb;
+ break;
+ case 'ADD_HOSTS_INSTALLING_3' :
+ addHostController.setCurrentStep('5');
+ App.db.data = currentClusterStatus.localdb;
+ break;
+ case 'ADD_HOSTS_INSTALLED_4' :
+ addHostController.setCurrentStep('6');
+ App.db.data = currentClusterStatus.localdb;
+ break;
+ case 'ADD_HOSTS_COMPLETED_5' :
+ router.transitionTo('main.index');
+ break;
+ default:
+ break;
+ }
+ }
+
router.transitionTo('step' + addHostController.get('currentStep'));
});
@@ -175,6 +200,14 @@ module.exports = Em.Route.extend({
var wizardStep8Controller = router.get('wizardStep8Controller');
addHostController.installServices();
addHostController.setInfoForStep9();
+
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'ADD_HOSTS_INSTALLING_3',
+ wizardControllerName: App.router.get('addHostController.name'),
+ localdb: App.db.data
+ });
router.transitionTo('step5');
}
}),
@@ -202,6 +235,13 @@ module.exports = Em.Route.extend({
var isRetry = true;
addHostController.installServices(isRetry);
addHostController.setInfoForStep9();
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'ADD_HOSTS_INSTALLING_3',
+ wizardControllerName: App.router.get('addHostController.name'),
+ localdb: App.db.data
+ });
}
wizardStep9Controller.navigateStep();
}
@@ -213,6 +253,15 @@ module.exports = Em.Route.extend({
var addHostController = router.get('addHostController');
var wizardStep9Controller = router.get('wizardStep9Controller');
addHostController.saveInstalledHosts(wizardStep9Controller);
+
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'ADD_HOSTS_INSTALLED_4',
+ wizardControllerName: App.router.get('addHostController.name'),
+ localdb: App.db.data
+ });
+
router.transitionTo('step6');
}
}),
@@ -235,6 +284,16 @@ module.exports = Em.Route.extend({
App.router.get('updateController').updateAllWrapper();
addHostController.finish();
$(context.currentTarget).parents("#modal").find(".close").trigger('click');
+
+
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'ADD_HOSTS_COMPLETED_5',
+ wizardControllerName: App.router.get('addHostController.name'),
+ localdb: App.db.data
+ });
+
router.transitionTo('main.index');
} else {
console.log('cluster installation failure');
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=1431782&r1=1431781&r2=1431782&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/installer.js Fri Jan 11
01:33:41 2013
@@ -274,13 +274,13 @@ module.exports = Em.Route.extend({
// invoke API call to install selected services
installerController.installServices();
installerController.setInfoForStep9();
- // For recovery : set the cluster status
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
App.clusterStatus.set('value', {
clusterName: this.get('clusterName'),
clusterState: 'CLUSTER_INSTALLING_3',
+ wizardControllerName: App.router.get('installerController.name'),
localdb: App.db.data
});
-
router.transitionTo('step9');
}
}),
@@ -306,6 +306,13 @@ module.exports = Em.Route.extend({
var isRetry = true;
installerController.installServices(isRetry);
installerController.setInfoForStep9();
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
+ App.clusterStatus.set('value', {
+ clusterName: this.get('clusterName'),
+ clusterState: 'CLUSTER_INSTALLING_3',
+ wizardControllerName: App.router.get('installerController.name'),
+ localdb: App.db.data
+ });
}
wizardStep9Controller.navigateStep();
}
@@ -318,13 +325,12 @@ module.exports = Em.Route.extend({
var wizardStep9Controller = router.get('wizardStep9Controller');
installerController.saveInstalledHosts(wizardStep9Controller);
- // For recovery : set the cluster status
App.clusterStatus.set('value', {
clusterName: this.get('clusterName'),
clusterState: 'CLUSTER_INSTALLED_4',
+ wizardControllerName: App.router.get('installerController.name'),
localdb: App.db.data
});
-
router.transitionTo('step10');
}
}),
@@ -344,10 +350,11 @@ module.exports = Em.Route.extend({
var controller = router.get('installerController');
controller.finish();
- // For recovery : set the cluster status
+ // We need to do recovery based on whether we are in Add Host or
Installer wizard
App.clusterStatus.set('value', {
clusterName: this.get('clusterName'),
clusterState: 'CLUSTER_STARTED_5',
+ wizardControllerName: App.router.get('installerController.name'),
localdb: App.db.data
});