Browse Source

AMBARI-1896. Disable editing Capacity Scheduler on host configs. (srimanth)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1467085 13f79535-47bb-0310-9956-ffa450edef68
Srimanth 12 years ago
parent
commit
485ca56d27

+ 2 - 0
CHANGES.txt

@@ -692,6 +692,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1896. Disable editing Capacity Scheduler on host configs. (srimanth)
+
  AMBARI-1894. Refactor configs of Capacity Scheduler category. (srimanth)
 
  AMBARI-1893. Parsing new alerts format fails. (srimanth)

+ 3 - 1
ambari-web/app/templates/common/configs/capacity_scheduler.hbs

@@ -26,7 +26,9 @@
         <div class="row-fluid header">
             <div class="span1">{{t services.mapReduce.config.queue.header}}</div>
             <div class="offset9 span2">
-                <div class="btn pull-right" {{action queuePopup target="view"}}>{{t services.mapReduce.config.addQueue}}</div>
+                {{#if view.canEdit}}
+                    <div class="btn pull-right" {{action queuePopup target="view"}}>{{t services.mapReduce.config.addQueue}}</div>
+                {{/if}}
             </div>
         </div>
         <div>

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

@@ -47,7 +47,7 @@
 <div class="accordion">
   {{#each category in selectedService.configCategories}}
     {{#if category.isCustomView}}
-      {{view category.customView categoryBinding="category" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs"}}
+      {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
     {{else}}
     {{#view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs"}}
 

+ 1 - 1
ambari-web/app/templates/main/host/configs_service.hbs

@@ -22,7 +22,7 @@
       {{view App.FilterComboboxView filterBinding="controller.filter" columnsBinding="controller.filterColumns" }}
     </div>
     <div class="clearfix"></div>
-    {{view App.ServiceConfigView canEditBinding="false" filterBinding="controller.filter" columnsBinding="controller.filterColumns"}}
+    {{view App.ServiceConfigView canEditBinding="view.isConfigsEditable" filterBinding="controller.filter" columnsBinding="controller.filterColumns"}}
   {{else}}
     <div class="spinner"></div>
   {{/if}}

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

@@ -524,11 +524,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
     return this.get('categoryConfigs').filterProperty('isQueue', undefined) || [];
   }.property('categoryConfigs.@each'),
   didInsertElement: function(){
-    var isCollapsed = (this.get('category.name').indexOf('Advanced') != -1);
-    this.set('category.isCollapsed', isCollapsed);
-    if(isCollapsed){
-      this.$('.accordion-body').hide();
-    }
+    this._super();
     this.createEmptyQueue(this.get('customConfigs').filterProperty('isQueue'));
   },
   //list of fields which will be populated by default in a new queue
@@ -831,7 +827,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
         if(queueName){
           this.set('header', Em.I18n.t('services.mapReduce.config.editQueue'));
           this.set('secondary', Em.I18n.t('common.save'));
-          if(self.get('queues').length > 1){
+          if(self.get('queues').length > 1 && self.get('canEdit')){
             this.set('delete', Em.I18n.t('common.delete'));
           }
         }
@@ -841,6 +837,9 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
       primary: Em.I18n.t('common.cancel'),
       delete: null,
       isError: function(){
+        if(!self.get('canEdit')){
+          return true;
+        }
         var content = this.get('content');
         var configs = content.configs.filter(function(config){
           if((config.name == 'mapred.queue.' + content.name + '.acl-submit-job' ||
@@ -1041,6 +1040,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
           }.observes('value'),
           isRequired: true,
           isVisible: true,
+          isEditable: self.get('canEdit'),
           index: 0
         });
         newField.validate();
@@ -1055,6 +1055,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
           isVisible: true,
           type: 'USERS',
           displayType: "UNIXList",
+          isEditable: self.get('canEdit'),
           index: 3
         });
 
@@ -1067,6 +1068,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
           isVisible: true,
           "displayType": "UNIXList",
           type: 'GROUPS',
+          isEditable: self.get('canEdit'),
           index: 4
         });
 
@@ -1079,6 +1081,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
           isVisible: true,
           type: 'USERS',
           displayType: "UNIXList",
+          isEditable: self.get('canEdit'),
           index: 5
         });
 
@@ -1091,6 +1094,7 @@ App.ServiceConfigCapacityScheduler = App.ServiceConfigsByCategoryView.extend({
           isVisible: true,
           "displayType": "UNIXList",
           type: 'GROUPS',
+          isEditable: self.get('canEdit'),
           index: 6
         });
 

+ 1 - 0
ambari-web/app/views/main/host/configs_service.js

@@ -23,6 +23,7 @@ App.MainHostServiceConfigsView = Em.View.extend({
     var controller = this.get('controller');
     controller.loadStep();
   },
+  isConfigsEditable: false,
   content: function () {
     return App.router.get('mainHostDetailsController.content');
   }.property('App.router.mainHostDetailsController.content')