Browse Source

AMBARI-9292 Kerberos: UI cleanup #1. (ababiichuk)

aBabiichuk 10 years ago
parent
commit
91adc8dbf1

+ 12 - 15
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});
     })
   },
 

+ 6 - 5
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> ' +

+ 3 - 2
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

+ 0 - 4
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';

+ 24 - 10
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);
   }
 
 });

+ 5 - 1
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 **/

+ 1 - 1
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 () {

+ 1 - 1
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));
     

+ 4 - 4
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' }
             ]
           }
         ]