ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-12707. Reintroduce "Regenerate Keytabs" button on Admin->Kerberos page. (jaimin)
Date Mon, 10 Aug 2015 23:29:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 3f4153f20 -> 5c712df70


AMBARI-12707. Reintroduce "Regenerate Keytabs" button on Admin->Kerberos page. (jaimin)


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

Branch: refs/heads/trunk
Commit: 5c712df70a8100f4fb3a71de8cf851f6d28df260
Parents: 3f4153f
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Mon Aug 10 16:27:35 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Mon Aug 10 16:28:57 2015 -0700

----------------------------------------------------------------------
 .../app/controllers/main/admin/kerberos.js      | 110 ++++++++-----------
 ambari-web/app/styles/application.less          |   4 +
 .../app/templates/main/admin/kerberos.hbs       |  42 ++++---
 3 files changed, 71 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5c712df7/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 765dd0b..6782e2c 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -441,37 +441,6 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   },
 
   /**
-   * @Override   <code>App.AddSecurityConfigs</code>
-   * Wrap kerberos properties to App.ServiceConfigProperty model class instances.
-   *
-   * @param {object} kerberosProperties
-   * @param {string} serviceName
-   * @param {string} filename
-   * @returns {App.ServiceConfigProperty[]}
-   */
-  expandKerberosStackDescriptorProps: function (kerberosProperties, serviceName, filename)
{
-    var configs = [];
-
-    for (var propertyName in kerberosProperties) {
-      var propertyObject = {
-        name: propertyName,
-        value: kerberosProperties[propertyName],
-        defaultValue: kerberosProperties[propertyName],
-        savedValue: kerberosProperties[propertyName],
-        serviceName: serviceName,
-        filename: filename,
-        displayName: serviceName == "Cluster" ? App.format.normalizeName(propertyName) :
propertyName,
-        isOverridable: false,
-        isEditable: true,
-        isSecureConfig: true
-      };
-      configs.push(App.ServiceConfigProperty.create(propertyObject));
-    }
-
-    return configs;
-  },
-
-  /**
    * Determines if some config value is changed
    * @type {boolean}
    */
@@ -486,17 +455,41 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
     return this.get('isSubmitDisabled') || !this.get('isPropertiesChanged');
   }.property('isSubmitDisabled', 'isPropertiesChanged'),
 
+  /**
+   * Determines if the `Disbale Kerberos` and `Regenerate Keytabs` button are disabled
+   */
+  isKerberosButtonsDisabled: function () {
+    return !this.get('isSaveButtonDisabled');
+  }.property('isSaveButtonDisabled'),
+
 
   makeConfigsEditable: function () {
     this.set('isEditMode', true);
-    this.get('stepConfigs').forEach(function(_stepConfig){
+    this.get('stepConfigs').forEach(function (_stepConfig) {
       _stepConfig.get('configs').setEach('isEditable', true);
+        _stepConfig.get('configs').forEach(function (_config) {
+          _config.set('isEditable', _config.get('name') != 'realm');
+        });
     }, this);
   },
 
-  makeConfigsNonEditable: function () {
+  _updateConfigs: function () {
+    this.makeConfigsUneditable(true);
+  },
+
+  makeConfigsUneditable: function (configsUpdated) {
     this.set('isEditMode', false);
-    this.loadStep();
+    this.get('stepConfigs').forEach(function (_stepConfig) {
+      _stepConfig.get('configs').forEach(function (_config) {
+        if (configsUpdated === true) {  // configsUpdated should be checked for boolean true
+          _config.set('savedValue', _config.get('value'));
+          _config.set('defaultValue', _config.get('value'));
+        } else {
+          _config.set('value', _config.get('savedValue'));
+        }
+        _config.set('isEditable', false);
+      });
+    }, this);
   },
 
   /**
@@ -505,35 +498,26 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
   submit: function (context) {
     var callback;
     var self = this;
-    if (this.get('isPropertiesChanged')) {
-      var kerberosDescriptor = this.get('kerberosDescriptor');
-      var configs = [];
-      this.get('stepConfigs').forEach(function (_stepConfig) {
-        configs = configs.concat(_stepConfig.get('configs'));
-      });
-      this.updateKerberosDescriptor(kerberosDescriptor, configs);
-      callback = function () {
-        return App.ajax.send({
-          name: 'admin.kerberos.cluster.artifact.update',
-          sender: self,
+    var kerberosDescriptor = this.get('kerberosDescriptor');
+    var configs = [];
+    this.get('stepConfigs').forEach(function (_stepConfig) {
+      configs = configs.concat(_stepConfig.get('configs'));
+    });
+    callback = function () {
+      return App.ajax.send({
+        name: 'admin.kerberos.cluster.artifact.update',
+        sender: self,
+        data: {
+          artifactName: 'kerberos_descriptor',
           data: {
-            artifactName: 'kerberos_descriptor',
-            data: {
-              artifact_data: kerberosDescriptor
-            }
-          },
-          success: 'makeConfigsNonEditable'
-        });
-      };
-    } else {
-      callback = function() {
-        var dfd = $.Deferred();
-        self.makeConfigsNonEditable();
-        dfd.resolve();
-        return dfd.promise();
-      }
-    }
-    this.regenerateKeytabs(callback);
-  },
+            artifact_data: kerberosDescriptor
+          }
+        },
+        success: '_updateConfigs'
+      });
+    };
+    this.updateKerberosDescriptor(kerberosDescriptor, configs);
+    this.restartServicesAfterRegenerate(false, callback);
+  }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/5c712df7/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 37f8c21..d161d9f 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2020,6 +2020,10 @@ a:focus {
   }
 }
 
+.edit-link {
+  cursor: pointer;
+}
+
 #security-stages {
   tr {
     height: 50px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5c712df7/ambari-web/app/templates/main/admin/kerberos.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/kerberos.hbs b/ambari-web/app/templates/main/admin/kerberos.hbs
index fcbad72..c1e1237 100644
--- a/ambari-web/app/templates/main/admin/kerberos.hbs
+++ b/ambari-web/app/templates/main/admin/kerberos.hbs
@@ -18,34 +18,32 @@
 {{#if dataIsLoaded}}
   {{#if securityEnabled}}
     <div>
-    <p class="text-success">{{t admin.security.enabled}}
-      {{#isAccessible ADMIN}}
-        <a class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isSubmitDisabled"}}
{{action notifySecurityOffPopup target="controller"}}>{{t admin.kerberos.button.disable}}
</a>
-        <br/>
-        {{#unless isManualKerberos}}
-          {{#if isEditMode}}
-            <a class="pull-right" href="#" {{action makeConfigsNonEditable target="controller"}}>
-                <span class="icon-stack">
-                <i class="icon-pencil"></i>
-                <i class="icon-ban-circle icon-rotate-90 text-error"></i>
-                </span>
-            </a>
-          {{else}}
-            <a class="pull-right" href="#" {{action makeConfigsEditable target="controller"}}>
-              <i class="icon-edit"></i>
-            </a>
-          {{/if}}
-        {{/unless}}
-      {{/isAccessible}}
+      <p class="text-success">{{t admin.security.enabled}}
+        {{#isAccessible ADMIN}}
+          <button class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr
disabled="isKerberosButtonsDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t
admin.kerberos.button.disable}} </button>
+          {{#unless isManualKerberos}}
+            <button class="btn btn-success" {{bindAttr disabled="isKerberosButtonsDisabled"}}
{{action regenerateKeytabs target="controller"}}>
+              <i class="icon-repeat"></i> {{t admin.kerberos.button.regenerateKeytabs}}</button>
+            <br/>
+            {{#unless isEditMode}}
+              <a {{action makeConfigsEditable target="controller"}}
+                      class="pull-right edit-link">
+                {{t common.edit}}
+              </a>
+            {{/unless}}
+          {{/unless}}
+        {{/isAccessible}}
       </p>
     </div>
     <div id="serviceConfig">
       {{view App.ServicesConfigView}}
     </div>
     {{#if isEditMode}}
-      <div class="btn-area">
-        <button id="submit-kerberos-reconfigure-identities"
-                class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
+      <div class="btn-area pull-right">
+        <button id="cancel-kerberos-reconfigure-identities" {{action makeConfigsUneditable
target="controller"}}
+                class="btn">{{t common.cancel}}</button>
+        <button id="save-kerberos-reconfigure-identities"
+                class="btn btn-success" {{bindAttr disabled="isSaveButtonDisabled"}}
           {{action submit target="controller"}}>{{t common.save}}</button>
       </div>
     {{/if}}


Mime
View raw message