incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-3315: Security wizard: "Create Principals and Keytabs" step doesn't save state after page refresh. (jaimin)
Date Tue, 24 Sep 2013 00:33:02 GMT
Updated Branches:
  refs/heads/trunk c66df38e8 -> 3c344371f


AMBARI-3315: Security wizard: "Create Principals and Keytabs" step doesn't save state after
page refresh. (jaimin)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/3c344371
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/3c344371
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/3c344371

Branch: refs/heads/trunk
Commit: 3c344371f224e978cb5c075b7904dc5eee76db09
Parents: c66df38
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Mon Sep 23 17:32:48 2013 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Mon Sep 23 17:32:48 2013 -0700

----------------------------------------------------------------------
 .../app/controllers/main/admin/security.js      |  1 +
 .../main/admin/security/add/step2.js            |  3 +-
 .../main/admin/security/add/step3.js            |  3 +-
 .../main/admin/security/add/step4.js            |  2 -
 .../controllers/main/admin/security/disable.js  |  1 -
 ambari-web/app/routes/main.js                   |  1 +
 ambari-web/app/utils/ajax.js                    | 59 +++++++++-----------
 ambari-web/app/utils/db.js                      | 14 +++++
 8 files changed, 43 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/controllers/main/admin/security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security.js b/ambari-web/app/controllers/main/admin/security.js
index 3c662f7..e5f2e6d 100644
--- a/ambari-web/app/controllers/main/admin/security.js
+++ b/ambari-web/app/controllers/main/admin/security.js
@@ -379,6 +379,7 @@ App.MainAdminSecurityController = Em.Controller.extend({
       name: 'user_group',
       value: configs['user_group'] ? configs['user_group'] : 'hadoop'
     });
+    App.db.setSecureUserInfo(serviceUsers);
   },
 
   showSecurityErrorPopup: function () {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/controllers/main/admin/security/add/step2.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step2.js b/ambari-web/app/controllers/main/admin/security/add/step2.js
index 3753011..db7ce6a 100644
--- a/ambari-web/app/controllers/main/admin/security/add/step2.js
+++ b/ambari-web/app/controllers/main/admin/security/add/step2.js
@@ -142,8 +142,7 @@ App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({
         securityUsers.pushObject({id: 'puppet var', name: 'hive_user', value: 'hive'});
         securityUsers.pushObject({id: 'puppet var', name: 'smokeuser', value: 'ambari-qa'});
       } else {
-        App.router.get('mainAdminSecurityController').setSecurityStatus();
-        securityUsers = App.router.get('mainAdminSecurityController').get('serviceUsers');
+        securityUsers = App.db.getSecureUserInfo();
       }
     }
     this.set('securityUsers', securityUsers);

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/controllers/main/admin/security/add/step3.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step3.js b/ambari-web/app/controllers/main/admin/security/add/step3.js
index 50678cc..53e7029 100644
--- a/ambari-web/app/controllers/main/admin/security/add/step3.js
+++ b/ambari-web/app/controllers/main/admin/security/add/step3.js
@@ -232,8 +232,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
       securityUsers.pushObject({id: 'puppet var', name: 'nagios_user', value: 'nagios'});
       securityUsers.pushObject({id: 'puppet var', name: 'user_group', value: 'hadoop'});
     } else {
-      App.router.get('mainAdminSecurityController').setSecurityStatus();
-      securityUsers = App.router.get('mainAdminSecurityController').get('serviceUsers');
+      securityUsers = App.db.getSecureUserInfo();
     }
     return securityUsers;
   },

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/controllers/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step4.js b/ambari-web/app/controllers/main/admin/security/add/step4.js
index 75b2087..55bde93 100644
--- a/ambari-web/app/controllers/main/admin/security/add/step4.js
+++ b/ambari-web/app/controllers/main/admin/security/add/step4.js
@@ -68,7 +68,6 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
     return installedServices.contains('WEBHCAT');
   },
 
-  serviceUsersBinding: 'App.router.mainAdminSecurityController.serviceUsers',
   hasHostPopup: true,
   services: [],
   serviceTimestamp: null,
@@ -540,7 +539,6 @@ App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
       name: 'admin.security.apply_configurations',
       sender: this,
       data: data,
-      deferred: true,
       success: 'applyConfigurationToClusterSuccessCallback',
       error: 'applyConfigurationToClusterErrorCallback'
     });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/controllers/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/disable.js b/ambari-web/app/controllers/main/admin/security/disable.js
index 7e0322a..00006fd 100644
--- a/ambari-web/app/controllers/main/admin/security/disable.js
+++ b/ambari-web/app/controllers/main/admin/security/disable.js
@@ -338,7 +338,6 @@ App.MainAdminSecurityDisableController = Em.Controller.extend({
       name: 'admin.security.apply_configurations',
       sender: this,
       data: data,
-      deferred: true,
       success: 'applyConfigurationToClusterSuccessCallback',
       error: 'applyConfigurationToClusterErrorCallback'
     });

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 4183114..557055e 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -745,6 +745,7 @@ module.exports = Em.Route.extend({
             App.db.setWizardCurrentStep('AddSecurity', currentClusterStatus.localdb.currentStep);
             App.db.setIsNameNodeHa(currentClusterStatus.localdb.haStatus);
             App.db.setDisableSecurityStatus(currentClusterStatus.localdb.disableSecurityStatus);
+            App.db.setSecureUserInfo(currentClusterStatus.localdb.secureUserInfo);
           }
         }
         if (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus()
=== 'RUNNING')) {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 4ee675c..890f134 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -97,9 +97,10 @@ var urls = {
       }
     }
   },
+
   'reassign.maintenance_mode': {
     'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
-    'mock':'',
+    'mock': '',
     'type': 'PUT',
     'format': function () {
       return {
@@ -134,9 +135,10 @@ var urls = {
   },
   'reassign.remove_component': {
     'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
-    'mock':'',
+    'mock': '',
     'type': 'DELETE'
   },
+
   'config.advanced': {
     'real': '{stack2VersionUrl}/stackServices/{serviceName}/configurations?fields=*',
     'mock': '/data/wizard/stack/hdp/version{stackVersion}/{serviceName}.json',
@@ -465,7 +467,7 @@ var urls = {
   },
   'host.service_config_hosts_overrides': {
     'real': '/clusters/{clusterName}/configurations?{urlParams}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         async: false,
@@ -475,7 +477,7 @@ var urls = {
   },
   'admin.service_config': {
     'real': '/clusters/{clusterName}/configurations/?type={siteName}&tag={tagName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         timeout: 10000,
@@ -485,10 +487,9 @@ var urls = {
   },
   'admin.security_status': {
     'real': '/clusters/{clusterName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
-        async: false,
         timeout: 10000
       };
     }
@@ -505,7 +506,7 @@ var urls = {
   'cluster.state': {
     'type': 'POST',
     'real': '/persist/',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         async: false,
@@ -529,7 +530,7 @@ var urls = {
     'format': function (data, opt) {
       return {
         type: 'PUT',
-        data:  JSON.stringify({
+        data: JSON.stringify({
           "RequestInfo": {
             "context": "Stop all services"
           },
@@ -548,7 +549,7 @@ var urls = {
     'format': function (data, opt) {
       return {
         type: 'PUT',
-        data:  JSON.stringify({
+        data: JSON.stringify({
           "RequestInfo": {
             "context": "Start all services"
           },
@@ -740,7 +741,7 @@ var urls = {
   },
   'admin.security.cluster_configs': {
     'real': '/clusters/{clusterName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         timeout: 10000
@@ -754,7 +755,7 @@ var urls = {
   },
   'admin.security.all_configurations': {
     'real': '/clusters/{clusterName}/configurations?{urlParams}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         timeout: 10000
@@ -763,18 +764,18 @@ var urls = {
   },
   'admin.security.apply_configurations': {
     'real': '/clusters/{clusterName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
         timeout: 10000,
-        data:data.configData
+        data: data.configData
       };
     }
   },
   'admin.security.apply_configuration': {
     'real': '/clusters/{clusterName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
@@ -786,7 +787,7 @@ var urls = {
   },
   'admin.security.add.cluster_configs': {
     'real': '/clusters/{clusterName}' + '?fields=Clusters/desired_configs',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         timeout: 10000
@@ -795,7 +796,7 @@ var urls = {
   },
   'admin.stack_upgrade.run_upgrade': {
     'real': '/clusters/{clusterName}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
@@ -806,7 +807,7 @@ var urls = {
   },
   'admin.stack_upgrade.stop_services': {
     'real': '/clusters/{clusterName}/services?ServiceInfo/state=STARTED',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
@@ -821,7 +822,7 @@ var urls = {
   },
   'wizard.install_services.add_host_controller.is_retry': {
     'real': '/clusters/{cluster}/host_components',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
@@ -832,7 +833,7 @@ var urls = {
   },
   'wizard.install_services.add_host_controller.not_is_retry': {
     'real': '/clusters/{cluster}/host_components',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'PUT',
@@ -901,7 +902,7 @@ var urls = {
   },
   'wizard.step8.delete_cluster': {
     'real': '/clusters/{name}',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         type: 'DELETE',
@@ -911,7 +912,7 @@ var urls = {
   },
   'wizard.step8.existing_cluster_names': {
     'real': '/clusters',
-    'mock':'',
+    'mock': '',
     'format': function (data, opt) {
       return {
         async: false
@@ -1055,7 +1056,7 @@ var formatRequest = function (data) {
     statusCode: require('data/statusCodes')
   };
   if (App.testMode) {
-    opt.url = formatUrl(this.mock?this.mock:'', data);
+    opt.url = formatUrl(this.mock ? this.mock : '', data);
     opt.type = 'GET';
   }
   else {
@@ -1087,7 +1088,6 @@ App.ajax = {
    *  beforeSend - method-name for ajax beforeSend response callback
    *  success - method-name for ajax success response callback
    *  error - method-name for ajax error response callback
-   *  deferred - A flag that will call jquery.when for asynchronous call. This should be
used instead of setting async to false
    *  callback - callback from <code>App.updater.run</code> library
    */
   send: function (config) {
@@ -1130,7 +1130,7 @@ App.ajax = {
       if (config.error) {
         config.sender[config.error](request, ajaxOptions, error, opt);
       } else {
-       this.defaultErrorHandler(request,opt.url,opt.type);
+        this.defaultErrorHandler(request, opt.url, opt.type);
       }
     };
     opt.complete = function () {
@@ -1141,16 +1141,7 @@ App.ajax = {
     if ($.mocho) {
       opt.url = 'http://' + $.hostName + opt.url;
     }
-    if (config.deferred === true) {
-      var successCallback = opt.success;
-      var errorCallback = opt.error;
-      delete opt['success'];
-      delete opt['error'];
-      delete opt['async'];
-      $.when($.ajax(opt)).then(successCallback,errorCallback);
-    } else {
       return $.ajax(opt);
-    }
   },
 
   // A single instance of App.ModalPopup view
@@ -1162,7 +1153,7 @@ App.ajax = {
    * @method {String} Http method
    * @showStatus {number} HTTP response code which should be shown. Default is 500.
    */
-  defaultErrorHandler: function(jqXHR,url,method,showStatus) {
+  defaultErrorHandler: function (jqXHR, url, method, showStatus) {
     method = method || 'GET';
     var self = this;
     var api = " received on " + method + " method for API: " + url;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3c344371/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index b89276b..67c5b61 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -341,6 +341,15 @@ App.db.setSecureConfigProperties  = function (secureConfigs) {
   localStorage.setObject('ambari', App.db.data);
 };
 
+App.db.setSecureUserInfo  = function (userInfo) {
+  App.db.data = localStorage.getObject('ambari');
+  if (!App.db.data.AddSecurity) {
+    App.db.data.AddSecurity = {};
+  }
+  App.db.data.AddSecurity.secureUserInfo = userInfo;
+  localStorage.setObject('ambari', App.db.data);
+};
+
 App.db.setIsNameNodeHa = function (haStatus) {
   App.db.data = localStorage.getObject('ambari');
   if (!App.db.data.AddSecurity) {
@@ -606,6 +615,11 @@ App.db.getSecureConfigProperties = function () {
   return App.db.data.AddSecurity.secureConfigProperties;
 };
 
+App.db.getSecureUserInfo  = function () {
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.AddSecurity.secureUserInfo;
+};
+
 App.db.getIsNameNodeHa = function (haStatus) {
   App.db.data = localStorage.getObject('ambari');
   return App.db.data.AddSecurity.haStatus;


Mime
View raw message