AMBARI-3781: JS error on trying to login after launching Security Wizard. (jaimin)
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index 0ab9c43..b82e079 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -114,36 +114,36 @@
*/
setClusterStatus: function(newValue){
if(App.testMode) return false;
+ var val = {clusterName: this.get('clusterName')};
if (newValue) {
//setter
- if (newValue.clusterState) {
- this.set('clusterState', newValue.clusterState);
- }
if (newValue.clusterName) {
this.set('clusterName', newValue.clusterName);
+ val.clusterName = newValue.clusterName;
+ }
+
+ if (newValue.clusterState) {
+ this.set('clusterState', newValue.clusterState);
+ val.clusterState = newValue.clusterState;
}
if (newValue.wizardControllerName) {
this.set('wizardControllerName', newValue.wizardControllerName);
+ val.wizardControllerName = newValue.wizardControllerName;
}
if (newValue.localdb) {
this.set('localdb', newValue.localdb);
+ val.localdb = newValue.localdb;
}
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);
App.ajax.send({
name: 'cluster.state',
sender: this,
data: {
- key: keyValuePair,
- newVal: newValue
+ keyValuePair: keyValuePair
},
beforeSend: 'clusterStatusBeforeSend',
error: 'clusterStatusErrorCallBack'
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 0ec62f9..c1169c3 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -268,7 +268,7 @@
}
App.clusterStatus.updateFromServer();
var clusterStatusOnServer = App.clusterStatus.get('value');
- if (!localStorage.getObject('ambari').app.user.admin || clusterStatusOnServer && clusterStatusOnServer.clusterState === 'DEFAULT') {
+ if (!App.get('isAdmin') || clusterStatusOnServer && clusterStatusOnServer.clusterState === 'DEFAULT') {
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
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
index b7e9236..8a4d730 100644
--- a/ambari-web/app/routes/add_security.js
+++ b/ambari-web/app/routes/add_security.js
@@ -83,9 +83,7 @@
router.get('addSecurityController').setCurrentStep(1);
App.clusterStatus.setClusterStatus({
clusterName: router.get('content.cluster.name'),
- clusterState: 'DEFAULT',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data.AddSecurity
+ clusterState: 'DEFAULT'
});
router.transitionTo('adminSecurity.index');
},
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 4239052..42dd63a 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -747,9 +747,7 @@
router.get('mainAdminSecurityController').setDisableSecurityStatus(undefined);
App.clusterStatus.setClusterStatus({
clusterName: router.get('content.cluster.name'),
- clusterState: 'DEFAULT',
- wizardControllerName: router.get('mainAdminSecurityDisableController.name'),
- localdb: App.db.data.AddSecurity
+ clusterState: 'DEFAULT'
});
this.hide();
router.transitionTo('adminSecurity.index');
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 45da260..992b25c 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -581,8 +581,7 @@
'format': function (data, opt) {
return {
async: false,
- data: JSON.stringify(data.key),
- newValue: data.newVal
+ data: JSON.stringify(data.keyValuePair)
};
}
},