You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2015/11/04 17:25:48 UTC

ambari git commit: AMBARI-13710. Kerb Wizard: UI cleanup (akovalenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 7546f2023 -> 4b0b1041c


AMBARI-13710. Kerb Wizard: UI cleanup (akovalenko)


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

Branch: refs/heads/trunk
Commit: 4b0b1041cb45474cf5825e0fe50d7e13ca09806e
Parents: 7546f20
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Nov 4 18:15:44 2015 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Nov 4 18:15:44 2015 +0200

----------------------------------------------------------------------
 .../main/admin/kerberos/step4_controller.js     |  1 +
 .../data/HDP2/kerberos_descriptor_properties.js | 35 ++++++++++++++++++++
 ambari-web/app/messages.js                      |  1 +
 .../app/mixins/wizard/addSecurityConfigs.js     | 12 +++++--
 .../configs/objects/service_config_property.js  | 16 ++++++++-
 ambari-web/app/styles/common.less               |  3 ++
 ambari-web/app/utils/config.js                  |  6 +++-
 ambari-web/app/views/common/controls_view.js    |  2 +-
 8 files changed, 70 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/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 5ad08c6..d868fbb 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step4_controller.js
@@ -153,6 +153,7 @@ App.KerberosWizardStep4Controller = App.WizardStep7Controller.extend(App.AddSecu
         }
       }, this);
     }
+    configProperties = App.config.sortConfigs(configProperties);
     this.get('stepConfigs').pushObjects(this.createServiceConfig(configProperties));
     this.set('selectedService', this.get('stepConfigs')[0]);
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/ambari-web/app/data/HDP2/kerberos_descriptor_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/kerberos_descriptor_properties.js b/ambari-web/app/data/HDP2/kerberos_descriptor_properties.js
new file mode 100644
index 0000000..1f8dc12
--- /dev/null
+++ b/ambari-web/app/data/HDP2/kerberos_descriptor_properties.js
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var properties = [
+  {
+    "name": "keytab_dir",
+    "index": 0
+  },
+  {
+    "name": "realm",
+    "index": 1
+  },
+  {
+    "name": "additional_realms",
+    "index": 2,
+    "placeholderText": "(" + Em.I18n.t("common.optional") + ")"
+  }
+];
+
+module.exports = properties;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 78c439b..377ed7d 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -282,6 +282,7 @@ Em.I18n.translations = {
   'common.timestamp': 'Timestamp',
   'common.timezone': 'Timezone',
   'common.loading.eclipses': 'Loading...',
+  'common.optional': 'Optional',
   'common.running': 'Running',
   'common.stopped': 'Stopped',
   'common.timeout.warning.popup.header': 'Automatic Logout',

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/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 3d2b11a..917b2be 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -27,6 +27,8 @@ App.AddSecurityConfigs = Em.Mixin.create({
 
   kerberosDescriptor: {},
 
+  kerberosDescriptorProperties: require('data/HDP2/kerberos_descriptor_properties'),
+
   /**
    * security configs, which values should be modified after APPLY CONFIGURATIONS stage
    */
@@ -157,6 +159,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
       var configObject = {};
       var prop = identity[item];
       var itemValue = prop[{keytab: 'file', principal: 'value'}[item]];
+      var predefinedProperty;
       // skip inherited property without `configuration` and `keytab` or `file` values
       if (!prop.configuration && !itemValue) return;
       // inherited property with value should not observe value from reference
@@ -167,8 +170,9 @@ App.AddSecurityConfigs = Em.Mixin.create({
       configObject.defaultValue = configObject.savedValue = configObject.value = itemValue;
       configObject.filename = prop.configuration ? prop.configuration.split('/')[0] : 'cluster-env';
       configObject.name = prop.configuration ? prop.configuration.split('/')[1] : name + '_' + item;
-      
+      predefinedProperty = self.get('kerberosDescriptorProperties').findProperty('name', configObject.name);
       configObject.displayName = self._getDisplayNameForConfig(configObject.name, configObject.filename);
+      configObject.index = predefinedProperty && !Em.isNone(predefinedProperty.index) ? predefinedProperty.index : Infinity;
       result.push(configObject);
     });
     return result;
@@ -205,6 +209,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
     var configs = [];
 
     for (var propertyName in kerberosProperties) {
+      var predefinedProperty = this.get('kerberosDescriptorProperties').findProperty('name', propertyName);
       var propertyObject = {
         name: propertyName,
         value: kerberosProperties[propertyName],
@@ -216,7 +221,9 @@ App.AddSecurityConfigs = Em.Mixin.create({
         isOverridable: false,
         isEditable: propertyName != 'realm',
         isRequired: propertyName != 'additional_realms',
-        isSecureConfig: true
+        isSecureConfig: true,
+        placeholderText: predefinedProperty && !Em.isNone(predefinedProperty.index) ? predefinedProperty.placeholderText : '',
+        index: predefinedProperty && !Em.isNone(predefinedProperty.index) ? predefinedProperty.index : Infinity
       };
       configs.push(App.ServiceConfigProperty.create(propertyObject));
     }
@@ -235,7 +242,6 @@ App.AddSecurityConfigs = Em.Mixin.create({
   processConfigReferences: function (kerberosDescriptor, configs) {
     var identities = kerberosDescriptor.identities;
     identities = identities.concat(kerberosDescriptor.services.map(function (service) {
-      var _identities = service.identities || [];
       if (service.components && !!service.components.length) {
         identities = identities.concat(service.components.mapProperty('identities').reduce(function (p, c) {
           return p.concat(c);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index 1124d54..57e1f3c 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -92,6 +92,20 @@ App.ServiceConfigProperty = Em.Object.extend({
    */
   rightSideLabel: false,
 
+  /**
+   * Text to be shown as placeholder
+   * By default savedValue is shown as placeholder
+   * @type {String}
+   */
+  placeholderText: '',
+
+  /**
+   * Placeholder used for configs with input type text
+   */
+  placeholder: function () {
+    return this.get('placeholderText') || this.get('savedValue');
+  }.property('savedValue', 'placeholderText'),
+
   retypedPassword: '',
   description: '',
   displayType: 'string', // string, digits, number, directories, custom
@@ -102,7 +116,7 @@ App.ServiceConfigProperty = Em.Object.extend({
   isEditable: true, // by default a config property is editable
   isNotEditable: Ember.computed.not('isEditable'),
   hideFinalIcon: function () {
-    return (!this.get('isFinal'))&& this.get('isNotEditable');
+    return (!this.get('isFinal')) && this.get('isNotEditable');
   }.property('isFinal', 'isNotEditable'),
   isVisible: true,
   isMock: false, // mock config created created only to displaying

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/ambari-web/app/styles/common.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less
index 7bdfbdb..a561bd4 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -368,6 +368,9 @@
       box-shadow: 0;
       outline: 0 none;
     }
+    &.btn-large {
+      padding-top: 6px;
+    }
   }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 61ad75f..62424a3 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -558,7 +558,11 @@ App.config = Em.Object.create({
    */
   sortConfigs: function(configs) {
     return configs.sort(function(a, b) {
-      return Em.get(a, 'index') == Em.get(b, 'index') ? Em.get(a, 'name') > Em.get(b, 'name') : Em.get(a, 'index') > Em.get(b, 'index');
+      if (Em.get(a, 'index') > Em.get(b, 'index')) return 1;
+      if (Em.get(a, 'index') < Em.get(b, 'index')) return -1;
+      if (Em.get(a, 'name') > Em.get(b, 'index')) return 1;
+      if (Em.get(a, 'name') < Em.get(b, 'index')) return -1;
+      return 0;
     });
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4b0b1041/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 f8b1f41..d58ac9f 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -162,7 +162,7 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
 
   valueBinding: 'serviceConfig.value',
   classNameBindings: 'textFieldClassName',
-  placeholderBinding: 'serviceConfig.savedValue',
+  placeholderBinding: 'serviceConfig.placeholder',
 
   onValueUpdate: function () {
     if ($(this.get('element')).is(':focus')) {