Browse Source

Ambari web UI should highlight secure config knobs recognized by it on service config page. (jaimin)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1489615 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 years ago
parent
commit
fee893fe36

+ 19 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -35,6 +35,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   configs: function() {
     return  App.config.get('preDefinedConfigProperties');
   }.property('App.config.preDefinedConfigProperties'),
+
+  secureConfigs: require('data/secure_mapping'),
+
   
   /**
    * During page load time, we get the host overrides from the server.
@@ -448,6 +451,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       this.get('stepConfigs').pushObject(serviceConfig);
     }
     this.set('selectedService', this.get('stepConfigs').objectAt(0));
+    this.checkForSecureConfig( this.get('selectedService'));
     this.set('dataIsLoaded', true);
   },
   /**
@@ -498,7 +502,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     var restartHosts = Ember.A([]);
     if(restartData != null && restartData.hostAndHostComponents != null && !jQuery.isEmptyObject(restartData.hostAndHostComponents)){
       serviceConfig.set('restartRequired', true);
-      for(var host in restartData.hostAndHostComponents){
+      for(var host in restartData.hostAndHostComponents) {
         hostsCount++;
         var componentsArray = Ember.A([]);
         for(var component in restartData.hostAndHostComponents[host]){
@@ -513,6 +517,20 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     }
   },
 
+  /**
+   * check whether the config property is a security related knob
+   * @param serviceConfig
+   */
+  checkForSecureConfig: function(serviceConfig) {
+    serviceConfig.get('configs').forEach(function(_config){
+     this.get('secureConfigs').forEach(function(_secureConfig){
+       if(_config.get('name')=== _secureConfig.name) {
+         _config.set('isSecureConfig',true);
+       }
+     },this)
+    },this)
+  },
+
   /**
    * Load child components to service config object
    * @param configs

+ 0 - 13
ambari-web/app/data/secure_properties.js

@@ -313,19 +313,6 @@ module.exports =
     },
 
     //OOZIE
-    {
-      "id": "puppet var",
-      "name": "oozie_server_name",
-      "displayName": "Oozie server host",
-      "value": "",
-      "defaultValue": "",
-      "description": "Oozie server host",
-      "displayType": "masterHosts",
-      "isVisible": false,
-      "isOverridable": false,
-      "serviceName": "OOZIE",
-      "category": "Oozie Server"
-    },
     {
       "id": "puppet var",
       "name": "oozie_primary_name",

+ 1 - 0
ambari-web/app/models/service_config.js

@@ -145,6 +145,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
   isReconfigurable: true, // by default a config property is reconfigurable
   isEditable: true, // by default a config property is editable
   isVisible: true,
+  isSecureConfig: false,
   errorMessage: '',
   serviceConfig: null, // points to the parent App.ServiceConfig object
   filename: '',

+ 3 - 0
ambari-web/app/styles/application.less

@@ -519,6 +519,9 @@ h1 {
       .control-label-span{
         width: auto !important;
       }
+      .icon-lock {
+        color: #008000;
+      }
       .action{
         margin-left: 7px;
         margin-right: 3px;

+ 6 - 1
ambari-web/app/templates/common/configs/service_config.hbs

@@ -45,7 +45,7 @@
 	</div>
 	{{/if}}
 {{/if}}
-          
+
 <div class="accordion">
   {{#each category in selectedService.configCategories}}
     {{#if category.isCustomView}}
@@ -74,6 +74,11 @@
 		                            {{/if}}
 		                          {{/if}}
                               {{displayName}}
+                              {{#if App.supports.secureCluster}}
+                                {{#if isSecureConfig}}
+                                  <a href="#"><i class="icon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i></a>
+                                {{/if}}
+                              {{/if}}
                             </label>
                           </span>
                           <div class="controls">

+ 1 - 0
ambari-web/app/utils/config.js

@@ -175,6 +175,7 @@ App.config = Em.Object.create({
           serviceConfigObj.isOverridable = configsPropertyDef.isOverridable === undefined ? true : configsPropertyDef.isOverridable;
           serviceConfigObj.serviceName = configsPropertyDef ? configsPropertyDef.serviceName : null;
           serviceConfigObj.index = configsPropertyDef.index;
+          serviceConfigObj.isSecureConfig = configsPropertyDef.isSecureConfig === undefined ? false : configsPropertyDef.isSecureConfig;
           serviceConfigObj.belongsToService = configsPropertyDef.belongsToService;
         }
         // MAPREDUCE contains core-site properties but doesn't show them

+ 6 - 0
ambari-web/app/views/common/configs/services_config.js

@@ -40,6 +40,7 @@ App.ServiceConfigView = Em.View.extend({
   didInsertElement: function () {
     this.$('.service-body').hide();
     $(".restart-required-property").tooltip({html:true});
+    $(".icon-lock").tooltip({placement:'right'});
   }
 });
 
@@ -237,6 +238,11 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
           serviceConfigObj.id = 'site property';
           serviceConfigObj.serviceName = serviceName;
           var serviceConfigProperty = App.ServiceConfigProperty.create(serviceConfigObj);
+          self.get('controller.secureConfigs').filterProperty('filename',self.get('category.siteFileName')).forEach(function(_secureConfig){
+            if(_secureConfig.name === serviceConfigProperty.get('name')) {
+              serviceConfigProperty.set('isSecureConfig',true);
+            }
+          },this);
           self.get('serviceConfigs').pushObject(serviceConfigProperty);
           this.hide();
         }