You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/07/08 20:40:35 UTC
git commit: AMBARI-6411. Add Host Wizard does not work if page
refresh is issued on Review page. (jaimin)
Repository: ambari
Updated Branches:
refs/heads/branch-1.6.1 aa698147f -> aefb55237
AMBARI-6411. Add Host Wizard does not work if page refresh is issued on Review page. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aefb5523
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aefb5523
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aefb5523
Branch: refs/heads/branch-1.6.1
Commit: aefb55237af71ccbc80bad22b790a8edadcfed85
Parents: aa69814
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Jul 8 11:38:42 2014 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Jul 8 11:38:42 2014 -0700
----------------------------------------------------------------------
.../main/host/addHost/step4_controller.js | 2 --
.../app/controllers/main/host/add_controller.js | 34 ++++++++++++++++----
ambari-web/app/routes/add_host_routes.js | 15 ++-------
.../app/templates/main/host/addHost/step4.hbs | 2 +-
ambari-web/app/utils/db.js | 5 +++
5 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/aefb5523/ambari-web/app/controllers/main/host/addHost/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/addHost/step4_controller.js b/ambari-web/app/controllers/main/host/addHost/step4_controller.js
index afa4628..9744458 100644
--- a/ambari-web/app/controllers/main/host/addHost/step4_controller.js
+++ b/ambari-web/app/controllers/main/host/addHost/step4_controller.js
@@ -21,8 +21,6 @@ var App = require('app');
App.AddHostStep4Controller= Em.Controller.extend({
name:"addHostStep4Controller",
-
- serviceConfigGroups: null,
isConfigGroupLoaded: false,
loadConfigGroups: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aefb5523/ambari-web/app/controllers/main/host/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/add_controller.js b/ambari-web/app/controllers/main/host/add_controller.js
index 058cfe2..2e3ca74 100644
--- a/ambari-web/app/controllers/main/host/add_controller.js
+++ b/ambari-web/app/controllers/main/host/add_controller.js
@@ -190,7 +190,7 @@ App.AddHostController = App.WizardController.extend({
* Apply config groups from step4 Configurations
*/
applyConfigGroup: function () {
- var serviceConfigGroups = this.get('content.serviceConfigGroups');
+ var serviceConfigGroups = this.get('content.configGroups');
serviceConfigGroups.forEach(function (group) {
if (group.configGroups.someProperty('ConfigGroup.group_name', group.selectedConfigGroup)) {
var configGroup = group.configGroups.findProperty('ConfigGroup.group_name', group.selectedConfigGroup);
@@ -217,26 +217,25 @@ App.AddHostController = App.WizardController.extend({
*/
getServiceConfigGroups: function () {
var serviceConfigGroups = this.getDBProperty('serviceConfigGroups');
- this.set('content.serviceConfigGroups', serviceConfigGroups);
+ this.set('content.configGroups', serviceConfigGroups);
},
/**
* Save information about selected config groups
*/
saveServiceConfigGroups: function () {
- this.setDBProperty('serviceConfigGroups', this.get('content.serviceConfigGroups'));
- this.set('content.serviceConfigGroups', this.get('content.serviceConfigGroups'));
+ this.setDBProperty('serviceConfigGroups', this.get('content.configGroups'));
},
/**
- * Set content.serviceConfigGroups for step4
+ * Set content.configGroups for step4
*/
loadServiceConfigGroups: function () {
var selectedServices = [];
this.loadServiceConfigGroupsBySlaves(selectedServices);
this.loadServiceConfigGroupsByClients(selectedServices);
this.sortServiceConfigGroups(selectedServices);
- this.set('content.serviceConfigGroups', selectedServices);
+ this.set('content.configGroups', selectedServices);
},
/**
* sort config groups by name
@@ -366,13 +365,34 @@ App.AddHostController = App.WizardController.extend({
this.set('content.cluster', this.getCluster());
},
+ clearStorageData: function () {
+ this._super();
+ App.db.cleanAddHost();
+ },
+
+ /**
+ * save the local db data stored on the server as value to the key api/v1/persist/CLUSTER_CURRENT_STATUS
+ */
+ saveClusterState: function () {
+ App.clusterStatus.setClusterStatus({
+ clusterName: App.router.getClusterName(),
+ clusterState: 'DEFAULT'
+ });
+ },
+
+ clearData: function () {
+ // Clear Add Host namespace in Browser Local storage and save it to server persist data
+ this.clearStorageData();
+ this.saveClusterState();
+ },
+
/**
* Clear all temporary data
*/
finish: function () {
this.setCurrentStep('1');
this.clearAllSteps();
- this.clearStorageData();
+ this.clearData();
App.router.get('updateController').updateAll();
App.updater.immediateRun('updateHost');
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/aefb5523/ambari-web/app/routes/add_host_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js
index ebc7a48..c4b0428 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -22,13 +22,9 @@ module.exports = App.WizardRoute.extend({
route: '/host/add',
clearData: function (router) {
+ var addHostController = router.get('addHostController');
App.router.get('updateController').set('isWorking', true);
- App.clusterStatus.setClusterStatus({
- clusterName: App.router.get('content.cluster.name'),
- clusterState: 'DEFAULT',
- wizardControllerName: App.router.get('addHostController.name'),
- localdb: App.db.data
- });
+ addHostController.finish();
router.transitionTo('hosts.index');
},
@@ -62,8 +58,6 @@ module.exports = App.WizardRoute.extend({
body: Em.I18n.t('hosts.add.exit.body'),
onPrimary: function () {
this.hide();
- addHostController.finish();
- App.router.get('updateController').set('isWorking', true);
self.clearData(router);
location.reload();
}
@@ -349,12 +343,7 @@ module.exports = App.WizardRoute.extend({
console.log('Request for hosts, with immutable parameters')
});
router.get('updateController').updateAll();
- 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
- addHostController.saveClusterState('DEFAULT');
-
location.reload();
}
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/aefb5523/ambari-web/app/templates/main/host/addHost/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/addHost/step4.hbs b/ambari-web/app/templates/main/host/addHost/step4.hbs
index c87549dc..0c39b48 100644
--- a/ambari-web/app/templates/main/host/addHost/step4.hbs
+++ b/ambari-web/app/templates/main/host/addHost/step4.hbs
@@ -29,7 +29,7 @@
</tr>
</thead>
<tbody>
- {{#each service in controller.content.serviceConfigGroups}}
+ {{#each service in controller.content.configGroups}}
<tr>
<td>{{service.displayName}}</td>
<td>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aefb5523/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index d994393..4193960 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -81,6 +81,11 @@ App.db.cleanTmp = function() {
localStorage.setObject('ambari', App.db.data);
};
+App.db.cleanAddHost = function() {
+ App.db.data.AddHost = {};
+ localStorage.setObject('ambari', App.db.data);
+};
+
App.db.updateStorage = function() {
App.db.data = localStorage.getObject('ambari');
if (App.db.data && App.db.data.app && App.db.data.app.tables && App.db.data.app.configs) {