ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [2/2] ambari git commit: AMBARI-9292 Kerberos: UI cleanup #1. (ababiichuk)
Date Fri, 23 Jan 2015 10:41:59 GMT
AMBARI-9292 Kerberos: UI cleanup #1.  (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 91adc8dbf115de34641e0465be0379d8c0db11c1
Parents: 7a75ff6
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Fri Jan 23 12:00:41 2015 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Fri Jan 23 12:42:01 2015 +0200

----------------------------------------------------------------------
 .../main/admin/kerberos/step4_controller.js     | 27 +++++++---------
 ambari-web/app/messages.js                      | 11 ++++---
 .../app/mixins/wizard/addSecurityConfigs.js     |  5 +--
 ambari-web/app/router.js                        |  4 ---
 ambari-web/app/utils/ajax/ajax.js               | 34 ++++++++++++++------
 ambari-web/app/views/common/controls_view.js    |  6 +++-
 .../common/modal_popups/invalid_KDC_popup.js    |  2 +-
 .../admin/kerberos/step4_controller_test.js     |  2 +-
 .../mixins/wizard/addSeccurityConfigs_test.js   |  8 ++---
 9 files changed, 56 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
index ac83f02..be91b6a 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -47,39 +47,36 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
    */
   createServiceConfig: function(configs) {
     // Identity configs related to user principal
-    var userConfigs = configs.filterProperty('identityType','user');
-    var nonUserConfig = configs.rejectProperty('identityType','user');
-    var categoryForUserConfigs = [
+    var clusterConfigs = configs.filterProperty('serviceName','Cluster');
+    var nonClusterConfigs = configs.rejectProperty('serviceName','Cluster');
+    var categoryForClusterConfigs = [
+      App.ServiceConfigCategory.create({ name: 'Global', displayName: 'Global'}),
       App.ServiceConfigCategory.create({ name: 'Ambari Principals', displayName: 'Ambari
Principals'})
     ];
-    var categoryForNonUserConfigs =  [
-      App.ServiceConfigCategory.create({ name: 'Global', displayName: 'Global'})
-    ].concat(this.createCategoryForServices());
+    var categoryForNonClusterConfigs = this.createCategoryForServices();
     return [
       App.ServiceConfig.create({
       displayName: 'General',
       name: 'GENERAL',
       serviceName: 'KERBEROS_GENERAL',
-      configCategories: categoryForUserConfigs,
-      configs: userConfigs,
-      showConfig: true,
-      selected: true
+      configCategories: categoryForClusterConfigs,
+      configs: clusterConfigs,
+      showConfig: true
     }),
       App.ServiceConfig.create({
         displayName: 'Advanced',
         name: 'ADVANCED',
         serviceName: 'KERBEROS_ADVANCED',
-        configCategories: categoryForNonUserConfigs,
-        configs: nonUserConfig,
-        showConfig: true,
-        selected: false
+        configCategories: categoryForNonClusterConfigs,
+        configs: nonClusterConfigs,
+        showConfig: true
       })
     ];
   },
 
   createCategoryForServices: function() {
     return App.Service.find().mapProperty('serviceName').map(function(item) {
-      return App.ServiceConfigCategory.create({ name: item, displayName: App.Service.find().findProperty('serviceName',item).get('displayName')});
+      return App.ServiceConfigCategory.create({ name: item, displayName: App.Service.find().findProperty('serviceName',item).get('displayName'),
collapsedByDefault: true});
     })
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 0e41150..36caca3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -323,7 +323,7 @@ Em.I18n.translations = {
   'popup.clusterCheck.Security.alert': 'You must meet the following requirements before you
can enable security.',
 
   'popup.invalid.KDC.header': 'Admin session expiration error',
-  'popup.invalid.KDC.msg': 'Missing or invalid KDC administrator credentials. Please enter
admin principal and password',
+  'popup.invalid.KDC.msg': ' Please enter admin principal and password.',
   'popup.invalid.KDC.admin.principal': 'Admin principal',
   'popup.invalid.KDC.admin.password': 'Admin password',
 
@@ -981,7 +981,7 @@ Em.I18n.translations = {
     'Do you really want to exit Kerberos Security Wizard?',
   'admin.kerberos.wizard.step1.header': 'Get Started',
   'admin.kerberos.wizard.step2.header': 'Configure Kerberos',
-  'admin.kerberos.wizard.step3.header': 'Install and Test Kerberos',
+  'admin.kerberos.wizard.step3.header': 'Install and Test Kerberos Client',
   'admin.kerberos.wizard.step4.header': 'Configure Identities',
   'admin.kerberos.wizard.step5.header': 'Stop Services',
   'admin.kerberos.wizard.step6.header': 'Kerberize Cluster',
@@ -997,8 +997,8 @@ Em.I18n.translations = {
   'admin.kerberos.wizard.step1.option.ad.condition.2': 'Java Cryptography Extension (JCE)
is installed on ambari server host.',
   'admin.kerberos.wizard.step1.prerequisites.label': 'Following prerequisites needs to be
checked to progress ahead in the wizard.',
   'admin.kerberos.wizard.step2.info.body': 'Please configure kerberos related properties.',
-  'admin.kerberos.wizard.step3.task0.title': 'Install Kerberos',
-  'admin.kerberos.wizard.step3.task1.title': 'Test Kerberos',
+  'admin.kerberos.wizard.step3.task0.title': 'Install Kerberos Client',
+  'admin.kerberos.wizard.step3.task1.title': 'Test Kerberos Client',
   'admin.kerberos.wizard.step3.notice.inProgress': 'Please wait while kerberos is being installed
and tested.',
   'admin.kerberos.wizard.step3.notice.completed': 'Kerberos service has been installed and
tested successfully.',
   'admin.kerberos.wizard.progressPage.notice.inProgress': 'Please wait while cluster is being
kerberized',
@@ -1007,7 +1007,7 @@ Em.I18n.translations = {
   'admin.kerberos.wizard.step5.notice.inProgress': 'Please wait while services are being
stopped.',
   'admin.kerberos.wizard.step5.notice.completed': 'Services have been successfully stopped.',
   'admin.kerberos.wizard.step6.notice.inProgress': 'Please wait while cluster is being kerberized.',
-  'admin.kerberos.wizard.step6.notice.completed': 'Cluster has been successfully kerberized.',
+  'admin.kerberos.wizard.step6.notice.completed': 'Kerberos has successfully be enabled on
the cluster.',
   'admin.kerberos.wizard.step7.notice.inProgress': 'Please wait while services are being
started and tested.',
   'admin.kerberos.wizard.step7.notice.completed': 'Services have been successfully tested
with kerberos environment.',
   'admin.kerberos.wizard.step7.task0.title' : 'Start and Test Services',
@@ -1652,6 +1652,7 @@ Em.I18n.translations = {
   'services.service.config.database.connection.failed': 'Connection Failed',
   'services.service.config.connection.exitPopup.msg': 'Test connection is in progress. It\'s
recommended to wait until it wil be complete. Are you sure you want to exit Enable Kerberos
Wizard?',
   'services.service.config.database.btn.idle': 'Test Connection',
+  'services.service.config.kdc.btn.idle': 'Test KDC Connection',
   'services.service.config.database.btn.connecting': 'Connecting...',
   'services.service.config.database.msg.jdbcSetup': 'Be sure you have run:<br/>' +
     '<b>ambari-server setup --jdbc-db={0} --jdbc-driver=/path/to/{1}/driver.jar</b>
' +

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index 87fa2b6..b31e36d 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -494,7 +494,8 @@ App.AddSecurityConfigs = Em.Mixin.create({
       }
       configObject.defaultValue = configObject.value = itemValue;
       configObject.filename = prop.configuration ? prop.configuration.split('/')[0] : 'cluster-env';
-      configObject.name = configObject.displayName = prop.configuration ? prop.configuration.split('/')[1]
: name + '_' + item;
+      configObject.name = prop.configuration ? prop.configuration.split('/')[1] : name +
'_' + item;
+      configObject.displayName = App.format.normalizeName(configObject.name);
       result.push(configObject);
     });
     return result;
@@ -518,7 +519,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
         defaultValue: kerberosProperties[propertyName],
         serviceName: serviceName,
         filename: filename,
-        displayName: propertyName,
+        displayName: App.format.normalizeName(propertyName),
         isOverridable: false,
         isEditable: propertyName != 'realm',
         isSecureConfig: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 5bef5b7..8bc23b9 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -79,7 +79,6 @@ App.Router = Em.Router.extend({
     this.get('installerController').clear();
     this.get('addHostController').clear();
     this.get('addServiceController').clear();
-    this.get('stackUpgradeController').clear();
     this.get('backgroundOperationsController').clear();
     for (var i = 1; i < 11; i++) {
       this.set('wizardStep' + i + 'Controller.hasSubmitted', false);
@@ -352,9 +351,6 @@ App.Router = Em.Router.extend({
           } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('addServiceController.name')) {
             // if wizardControllerName == "addHostController", then it means someone closed
the browser or the browser was crashed when we were last in Add Hosts wizard
             route = 'main.serviceAdd';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('stackUpgradeController.name')) {
-            // if wizardControllerName == "stackUpgradeController", then it means someone
closed the browser or the browser was crashed when we were last in Stack Upgrade wizard
-            route = 'main.stackUpgrade';
           } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('reassignMasterController.name')) {
             // if wizardControllerName == "reassignMasterController", then it means someone
closed the browser or the browser was crashed when we were last in Reassign Master wizard
             route = 'main.reassign';

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 1f343dc..4c868fd 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2244,9 +2244,14 @@ var formatRequest = function (data) {
   return opt;
 };
 
+/**
+ * Error messages for KDC administrator credentials error
+ * is used for checking if error message is caused by bad KDC credentials
+ * @type {{missingKDC: string, invalidKDC: string}}
+ */
 var specialMsg = {
-  "missingKDC": "java.lang.IllegalArgumentException: Missing KDC administrator credentials.",
-  "invalidKDC": "java.lang.IllegalArgumentException: Invalid KDC administrator credentials."
+  "missingKDC": "Missing KDC administrator credentials.",
+  "invalidKDC": "Invalid KDC administrator credentials."
 };
 /**
  * Wrapper for all ajax requests
@@ -2308,8 +2313,9 @@ var ajax = Em.Object.extend({
       }
     };
     opt.error = function (request, ajaxOptions, error) {
-      if (this.isKDCError(request)) {
-        this.defaultErrorKDCHandler(opt);
+      var KDCErrorMsg = this.getKDCErrorMgs(request);
+      if (!Em.isNone(KDCErrorMsg)) {
+        this.defaultErrorKDCHandler(opt, KDCErrorMsg);
       } else if (config.error) {
         config.sender[config.error](request, ajaxOptions, error, opt, params);
       } else {
@@ -2367,23 +2373,31 @@ var ajax = Em.Object.extend({
 
   /**
    * defines if it's admin session expiration error
+   * and if so returns short error message
    * @param jqXHR
-   * @returns {boolean}
+   * @returns {string|null}
    */
-  isKDCError: function(jqXHR) {
+  getKDCErrorMgs: function(jqXHR) {
     try {
       var message = $.parseJSON(jqXHR.responseText).message;
     } catch (err) {}
-    return jqXHR.status === 400 && message && (message.contains(specialMsg.missingKDC)
|| message.contains(specialMsg.invalidKDC))
+    if (jqXHR.status === 400 && message) {
+      return message.contains(specialMsg.missingKDC) ? specialMsg.missingKDC
+        : message.contains(specialMsg.invalidKDC) ? specialMsg.invalidKDC : null;
+    } else {
+      return null;
+    }
+
   },
 
   /**
    * default handler for admin session expiration error
-   * @param opt
+   * @param {object} opt
+   * @param {string} msg
    * @returns {*}
    */
-  defaultErrorKDCHandler: function(opt) {
-    return App.showInvalidKDCPopup(opt);
+  defaultErrorKDCHandler: function(opt, msg) {
+    return App.showInvalidKDCPopup(opt, msg);
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 7a85ad4..d3fd638 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -815,7 +815,11 @@ App.SlaveComponentChangeGroupNameView = Ember.View.extend(App.ServiceConfigCalcu
 App.CheckDBConnectionView = Ember.View.extend({
   templateName: require('templates/common/form/check_db_connection'),
   /** @property {string} btnCaption - text for button **/
-  btnCaption: Em.I18n.t('services.service.config.database.btn.idle'),
+  btnCaption: function() {
+    return this.get('parentView.service.serviceName') === 'KERBEROS'
+      ? Em.I18n.t('services.service.config.kdc.btn.idle')
+      : Em.I18n.t('services.service.config.database.btn.idle')
+  }.property('parentView.service.serviceName'),
   /** @property {string} responseCaption - text for status link **/
   responseCaption: null,
   /** @property {boolean} isConnecting - is request to server activated **/

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js b/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
index b5f09f3..1ecef78 100644
--- a/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
+++ b/ambari-web/app/views/common/modal_popups/invalid_KDC_popup.js
@@ -30,7 +30,7 @@ App.showInvalidKDCPopup = function (ajaxOpt, message) {
     principal: "",
     password: "",
     bodyClass: Em.View.extend({
-      warningMsg: message || Em.I18n.t('popup.invalid.KDC.msg'),
+      warningMsg: message + Em.I18n.t('popup.invalid.KDC.msg'),
       templateName: require('templates/common/modal_popups/invalid_KDC_popup')
     }),
     onPrimary: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
index 12aec8b..1948ee8 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js
@@ -23,7 +23,7 @@ describe('App.KerberosWizardStep4Controller', function() {
   describe('#isSubmitDisabled', function() {
     var controller = App.KerberosWizardStep4Controller.create({});
     var configs = Em.A([
-      App.ServiceConfigProperty.create({ name: 'prop1', value: 'someVal1', identityType:
'user', category: 'Ambari Principals'})
+      App.ServiceConfigProperty.create({ name: 'prop1', value: 'someVal1', identityType:
'user', category: 'Ambari Principals', serviceName: 'Cluster'})
     ]);
     controller.set('stepConfigs', controller.createServiceConfig(configs));
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/91adc8db/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js b/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
index dcdd1d8..25ecc17 100644
--- a/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
+++ b/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
@@ -487,8 +487,8 @@ describe('App.AddSecurityConfigs', function () {
           {
             property: 'spnego_principal',
             e: [
-              { key: 'displayName', value: 'spnego_principal' },
-              { key: 'filename', value: 'cluster-env' },
+              { key: 'displayName', value: 'Spnego Principal' },
+              { key: 'filename', value: 'cluster-env' }
             ]
           }
         ]
@@ -499,8 +499,8 @@ describe('App.AddSecurityConfigs', function () {
           {
             property: 'spnego_keytab',
             e: [
-              { key: 'displayName', value: 'spnego_keytab' },
-              { key: 'filename', value: 'cluster-env' },
+              { key: 'displayName', value: 'Spnego Keytab' },
+              { key: 'filename', value: 'cluster-env' }
             ]
           }
         ]


Mime
View raw message