ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-13710. Kerb Wizard: UI cleanup (akovalenko)
Date Wed, 04 Nov 2015 16:26:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 c0e091159 -> adbc56184


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/adbc5618
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/adbc5618
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/adbc5618

Branch: refs/heads/branch-2.1
Commit: adbc561846cffb25c9c9b364049977d2f0718286
Parents: c0e0911
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Wed Nov 4 17:29:34 2015 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Wed Nov 4 17:29:34 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     | 11 ++++--
 .../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(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/adbc5618/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 3aaf453..8c38b41 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/adbc5618/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/adbc5618/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 07c0c88..373a4f1 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -281,6 +281,7 @@ Em.I18n.translations = {
   'common.timestamp': 'Timestamp',
   'common.timezone': 'Timezone',
   'common.loading.eclipses': 'Loading...',
+  'common.optional': 'Optional',
 
   'common.running': 'Running',
   'common.stopped': 'Stopped',

http://git-wip-us.apache.org/repos/asf/ambari/blob/adbc5618/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 15eca6b..8ae1fb7 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -29,6 +29,8 @@ App.AddSecurityConfigs = Em.Mixin.create({
 
   secureProperties: require('data/HDP2/secure_properties').configProperties,
 
+  kerberosDescriptorProperties: require('data/HDP2/kerberos_descriptor_properties'),
+
   secureMapping: require('data/HDP2/secure_mapping'),
 
   serviceUsersBinding: 'App.router.mainAdminSecurityController.serviceUsers',
@@ -477,6 +479,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
@@ -488,7 +491,9 @@ App.AddSecurityConfigs = Em.Mixin.create({
       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;
@@ -525,6 +530,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],
@@ -536,7 +542,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));
     }
@@ -555,7 +563,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/adbc5618/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 6f7c1b9..e6d3bd2 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/adbc5618/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/adbc5618/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 6e34789..5ef2065 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -565,7 +565,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/adbc5618/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 2a4666d..6ba6f36 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -161,7 +161,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')) {


Mime
View raw message