AMBARI-18561. Capacity Scheduler View: Calculating absolute capacity for node 
labels and showing in sunburst chart (Akhil PB via pallavkul)


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

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 72893f8435f97c5aa213a323b4674a0291918179
Parents: 43d4857
Author: pallavkul <pallav....@gmail.com>
Authored: Wed Nov 2 10:49:34 2016 +0530
Committer: pallavkul <pallav....@gmail.com>
Committed: Wed Nov 2 10:49:34 2016 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/app.js            | 22 +++++++++++
 .../ui/app/components/labelCapacityBar.js       |  7 +++-
 .../resources/ui/app/components/queueMapping.js |  1 +
 .../ui/app/components/sunburstChart.js          | 27 ++++++--------
 .../resources/ui/app/controllers/advanced.js    | 15 ++++++++
 .../resources/ui/app/controllers/capsched.js    | 39 ++++++++++++++++++--
 .../resources/ui/app/controllers/editqueue.js   |  3 ++
 .../resources/ui/app/controllers/queuesconf.js  | 25 +++++++++++++
 .../resources/ui/app/controllers/scheduler.js   | 15 ++++++++
 .../src/main/resources/ui/app/models/queue.js   |  3 +-
 .../src/main/resources/ui/app/router.js         | 38 ++++++-------------
 .../resources/ui/app/styles/application.less    |  7 +++-
 .../ui/app/templates/capsched/advanced.hbs      |  7 ++--
 .../templates/capsched/partials/preemption.hbs  |  2 +
 .../templates/components/editLabelCapacity.hbs  |  4 +-
 .../app/templates/components/queueMapping.hbs   | 12 ++++++
 16 files changed, 172 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
index 4349538..fa1e05a 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/app.js
@@ -31,4 +31,26 @@ Ember.Application.initializer({
   }
 });
 
+var EventBus = Ember.Object.extend(Ember.Evented, {
+  publish: function() {
+    return this.trigger.apply(this, arguments);
+  },
+  subscribe: function() {
+    return this.on.apply(this, arguments);
+  },
+  unsubscribe: function() {
+    return this.off.apply(this, arguments);
+  }
+});
+
+Ember.Application.initializer({
+  name: 'eventBus',
+  initialize: function(container, application) {
+    container.register('eventBus:main', EventBus);
+    container.injection('route', 'eventBus', 'eventBus:main');
+    container.injection('controller', 'eventBus', 'eventBus:main');
+    container.injection('component', 'eventBus', 'eventBus:main');
+  }
+});
+
 module.exports = Em.Application.create();

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/labelCapacityBar.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/labelCapacityBar.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/labelCapacityBar.js
index 032b2ec..741fe36 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/labelCapacityBar.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/labelCapacityBar.js
@@ -24,6 +24,7 @@ App.LabelCapacityBarComponent = Ember.Component.extend({
   labels: null,
   queues: null,
   warnInvalidTotalLabelCapacity: false,
+  precision: 2,
 
   extractLabels: function() {
     var qLabels = this.get('queueLabels'),
@@ -40,9 +41,11 @@ App.LabelCapacityBarComponent = Ember.Component.extend({
     var labels = this.get('labels'),
     totalCapacity = 0;
     labels.forEach(function(label){
-      totalCapacity += label.get('capacity');
+      if (typeof label.get('capacity') === 'number') {
+        totalCapacity += label.get('capacity');
+      }
     });
-    return totalCapacity;
+    return parseFloat(totalCapacity.toFixed(this.get('precision')));
   }.property('labels.length', 'labels.@each.capacity'),
 
   widthPattern: 'width: %@%',

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/queueMapping.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/queueMapping.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/queueMapping.js
index 1d07351..b4ebbf0 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/queueMapping.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/queueMapping.js
@@ -35,6 +35,7 @@
    selectedLeafQueueNameForGroups: null,
    isQueueMappingsDirty: false,
    scheduler: null,
+   isOperator: false,
 
    actions: {
      showMappingOptions: function(){

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/sunburstChart.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/sunburstChart.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/sunburstChart.js
index d5b19ae..a014aeb 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/sunburstChart.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/sunburstChart.js
@@ -51,7 +51,7 @@ function _getSunburstChartDataForLabel(queue, json, 
allQueues, labelName) {
       "name": queue.get('name'),
       "path": queue.get('path'),
       "capacity": qLabel?qLabel.get('capacity') : 0,
-      "absoluteCapacity": 0,
+      "absoluteCapacity": qLabel? qLabel.get('absolute_capacity') : 0,
       "size": qLabel? qLabel.get('capacity') : 0,
       "isLabel": true
     };
@@ -222,15 +222,10 @@ App.SunburstChartComponent = Ember.Component.extend({
   },
 
   showQueueInfo: function(node) {
-    var precentage = node.isLabel? node.capacity : node.absoluteCapacity;
-    var percentageString = precentage + "%";
+    var percentageString = node.absoluteCapacity + "%";
     d3.select("#capacityPercentage").text(percentageString);
     d3.select("#queuePath").text(node.path);
-    if (node.isLabel) {
-      d3.select("#type_text").text("Capacity:");
-    } else {
-      d3.select("#type_text").text("Abs Cap:");
-    }
+    d3.select("#type_text").text("Abs Cap:");
     d3.select("#explanation").style("visibility", "");
     d3.select("#queue_info").style("visibility", "");
   },
@@ -271,13 +266,15 @@ App.SunburstChartComponent = Ember.Component.extend({
         .style("fill", "#3276b1")
         .style("opacity", 1);
       var node = this.$("path[id='"+queue.get('path')+"']").data('node');
-      this.showQueueInfo({
-        name: node.name,
-        path: node.path,
-        capacity: node.capacity,
-        absoluteCapacity: node.absoluteCapacity,
-        isLabel: node.isLabel
-      });
+      if (node) {
+        this.showQueueInfo({
+          name: node.name,
+          path: node.path,
+          capacity: node.capacity,
+          absoluteCapacity: node.absoluteCapacity,
+          isLabel: node.isLabel
+        });
+      }
     }
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/advanced.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/advanced.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/advanced.js
index af15fa5..1d17b69 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/advanced.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/advanced.js
@@ -58,6 +58,21 @@ App.CapschedAdvancedController = Ember.Controller.extend({
     }
   },
 
+  initEvents: function() {
+    this.get('eventBus').subscribe('beforeSavingConfigs', function() {
+      this.set("tempRefreshNeed", this.get('isRefreshOrRestartNeeded') || 
false);
+    }.bind(this));
+
+    this.get('eventBus').subscribe('afterConfigsSaved', function(refresh) {
+      this.set('isRefreshOrRestartNeeded', refresh !== undefined? 
refresh:this.get('tempRefreshNeed'));
+    }.bind(this));
+  }.on('init'),
+
+  teardownEvents: function() {
+    this.get('eventBus').unsubscribe('beforeSavingConfigs');
+    this.get('eventBus').unsubscribe('afterConfigsSaved');
+  }.on('willDestroy'),
+
   isOperator: cmp.alias('controllers.capsched.isOperator'),
   scheduler: cmp.alias('controllers.capsched.content'),
   queues: cmp.alias('controllers.capsched.queues'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/capsched.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/capsched.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/capsched.js
index 631edbb..d77a16d 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/capsched.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/capsched.js
@@ -22,6 +22,7 @@ App.CapschedController = Ember.Controller.extend({
   queues: null,
   precision: 2,
   selectedQueue: null,
+  allQueueLabels: null,
   allNodeLabels: Ember.computed.alias('store.nodeLabels.content'),
 
   actions: {
@@ -52,7 +53,7 @@ App.CapschedController = Ember.Controller.extend({
     allQueues.forEach(function(queue) {
       var absCap = this.getAbsoluteCapacityForQueue(queue);
       queue.set('absolute_capacity', absCap);
-    }.bind(this));
+    }, this);
   }.observes('queues', 'queues.[]', 'queues.@each.capacity').on('init'),
 
   getAbsoluteCapacityForQueue: function(queue) {
@@ -63,8 +64,40 @@ App.CapschedController = Ember.Controller.extend({
       queue = allQueues.findBy('id', queue.get('parentPath').toLowerCase()) || 
null;
     }
     var effectCapPercent = effectCapRatio * 100,
-    absoluteCap = 
parseFloat(parseFloat(effectCapPercent).toFixed(this.get('precision')));;
-    return absoluteCap;
+    absoluteCap = parseFloat(effectCapPercent).toFixed(this.get('precision'));
+    return parseFloat(absoluteCap);
+  },
+
+  labelsWatcher: function() {
+    var allQueues = this.get('queues') || [];
+    allQueues.forEach(function(queue) {
+      var qLabels = queue.get('labels');
+      if (!Ember.isEmpty(qLabels)) {
+        qLabels.forEach(function(label) {
+          var absCap = this.getAbsoluteCapacityForLabel(label, queue);
+          label.set('absolute_capacity', absCap);
+        }, this);
+      }
+    }, this);
+  }.observes('queues.@each.labels', 'queues.@each.labels.[]', 
'allQueueLabels.@each.capacity').on('init'),
+
+  getAbsoluteCapacityForLabel: function(label, queue) {
+    var allQueues = this.get('queues'),
+    allQueueLabels = this.get('allQueueLabels') || [],
+    labelName = label.get('name'),
+    effectCapRatio = 1;
+    while (queue !== null) {
+      if (queue.get('labels').findBy('name', labelName)) {
+        var qlabel = queue.get('labels').findBy('id', [queue.get('id'), 
labelName].join('.'));
+        effectCapRatio *= qlabel.get('capacity') / 100;
+        queue = allQueues.findBy('id', queue.get('parentPath').toLowerCase()) 
|| null;
+      } else {
+        return 0;
+      }
+    }
+    var effectCapPercent = effectCapRatio * 100,
+    absoluteCap = parseFloat(effectCapPercent).toFixed(this.get('precision'));
+    return parseFloat(absoluteCap);
   },
 
   alertMessage: null,

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/editqueue.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/editqueue.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/editqueue.js
index 9d84704..9c730fc 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/editqueue.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/editqueue.js
@@ -124,6 +124,9 @@ App.CapschedQueuesconfEditqueueController = 
Ember.Controller.extend({
     } else if (qAlreadyExists && qName !== originalQName) {
       this.set('isInvalidQName', true);
       this.set('invalidQNameMessage', 'Queue already exists');
+    } else if (qName.indexOf(' ') > -1) {
+      this.set('isInvalidQName', true);
+      this.set('invalidQNameMessage', 'Queue name contains white spaces');
     } else {
       this.set('isInvalidQName', false);
       this.set('invalidQNameMessage', '');

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queuesconf.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queuesconf.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queuesconf.js
index e7fba41..996a315 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queuesconf.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queuesconf.js
@@ -162,6 +162,28 @@ App.CapschedQueuesconfController = 
Ember.Controller.extend({
     }
   },
 
+  initEvents: function() {
+    this.get('eventBus').subscribe('beforeSavingConfigs', function() {
+      this.set("tempRefreshNeed", this.get('isRefreshOrRestartNeeded') || 
false);
+      this.set("tempMustRestart", this.get('isQueuesMustNeedRestart') || 
false);
+    }.bind(this));
+
+    this.get('eventBus').subscribe('afterConfigsSaved', function(refresh) {
+      if (refresh !== undefined) {
+        this.set('isRefreshOrRestartNeeded', refresh);
+        this.set('isQueuesMustNeedRestart', refresh);
+      } else {
+        this.set('isRefreshOrRestartNeeded', this.get('tempRefreshNeed'));
+        this.set('isQueuesMustNeedRestart', this.get('tempMustRestart'));
+      }
+    }.bind(this));
+  }.on('init'),
+
+  teardownEvents: function() {
+    this.get('eventBus').unsubscribe('beforeSavingConfigs');
+    this.get('eventBus').unsubscribe('afterConfigsSaved');
+  }.on('willDestroy'),
+
   isAnyQueueDirty: function() {
     return this.get('queues').isAny('isAnyDirty', true);
   }.property('queues.@each.isAnyDirty'),
@@ -234,6 +256,9 @@ App.CapschedQueuesconfController = Ember.Controller.extend({
     } else if (qAlreadyExists) {
       this.set('isInvalidQueueName', true);
       this.set('invalidQueueNameMessage', 'Queue already exists');
+    } else if (queueName.indexOf(' ') > -1) {
+      this.set('isInvalidQueueName', true);
+      this.set('invalidQueueNameMessage', 'Queue name contains white spaces');
     } else {
       this.set('isInvalidQueueName', false);
       this.set('invalidQueueNameMessage', '');

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/scheduler.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/scheduler.js
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/scheduler.js
index aa139b1..5494631 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/scheduler.js
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/scheduler.js
@@ -61,6 +61,21 @@ App.CapschedSchedulerController = Ember.Controller.extend({
     }
   },
 
+  initEvents: function() {
+    this.get('eventBus').subscribe('beforeSavingConfigs', function() {
+      this.set("tempRefreshNeed", this.get('isRefreshOrRestartNeeded') || 
false);
+    }.bind(this));
+
+    this.get('eventBus').subscribe('afterConfigsSaved', function(refresh) {
+      this.set('isRefreshOrRestartNeeded', refresh !== undefined? 
refresh:this.get('tempRefreshNeed'));
+    }.bind(this));
+  }.on('init'),
+
+  teardownEvents: function() {
+    this.get('eventBus').unsubscribe('beforeSavingConfigs');
+    this.get('eventBus').unsubscribe('afterConfigsSaved');
+  }.on('willDestroy'),
+
   isOperator: cmp.alias('controllers.capsched.isOperator'),
 
   saveMode: '',

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/models/queue.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/models/queue.js 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/models/queue.js
index e2d67bd..df0c684 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/models/queue.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/models/queue.js
@@ -43,7 +43,8 @@ App.Label = DS.Model.extend({
     this.set('maximum_capacity', maxCap);
   },
   isDirtyLabelCapacity: false,
-  isDirtyLabelMaxCapacity: false
+  isDirtyLabelMaxCapacity: false,
+  absolute_capacity: 0
 });
 
 App.Scheduler = DS.Model.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/router.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/router.js 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/router.js
index d838958..15139a6 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/router.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/router.js
@@ -204,17 +204,11 @@ App.CapschedRoute = Ember.Route.extend({
   actions: {
     saveCapSchedConfigs: function(saveMode, forceRefresh) {
       var store = this.get('store'),
-        that = this,
-        capschedCtrl = this.controllerFor("capsched"),
-        schedulerCtrl = this.controllerFor("capsched.scheduler"),
-        queuesconfCtrl = this.controllerFor("capsched.queuesconf"),
-        advancedCtrl = this.controllerFor("capsched.advanced"),
-        restartOrRefreshMap = {
-          schedulerTab: schedulerCtrl.get('isRefreshOrRestartNeeded') || false,
-          queuesTabRefresh: queuesconfCtrl.get('isRefreshOrRestartNeeded') || 
false,
-          queuesTabRestart: queuesconfCtrl.get('isQueuesMustNeedRestart') || 
false,
-          advancedTab: advancedCtrl.get('isRefreshOrRestartNeeded') || false
-        };
+      capschedCtrl = this.controllerFor("capsched"),
+      eventBus = this.get('eventBus'),
+      that = this;
+
+      eventBus.publish('beforeSavingConfigs');
 
       if (forceRefresh) {
         return this.forceRefreshOrRestartCapSched(saveMode);
@@ -240,19 +234,13 @@ App.CapschedRoute = Ember.Route.extend({
         Em.run.bind(that,'saveConfigsSuccess'),
         Em.run.bind(that,'saveConfigsError', 'save')
       ).then(function () {
-        schedulerCtrl.set('isRefreshOrRestartNeeded', 
restartOrRefreshMap.schedulerTab);
-        queuesconfCtrl.set('isRefreshOrRestartNeeded', 
restartOrRefreshMap.queuesTabRefresh);
-        queuesconfCtrl.set('isQueuesMustNeedRestart', 
restartOrRefreshMap.queuesTabRestart);
-        advancedCtrl.set('isRefreshOrRestartNeeded', 
restartOrRefreshMap.advancedTab);
+        eventBus.publish('afterConfigsSaved');
         if (opt) {
           return store.relaunchCapSched(opt);
         }
       }).then(function(){
         if (opt) {
-          schedulerCtrl.set('isRefreshOrRestartNeeded', false);
-          queuesconfCtrl.set('isRefreshOrRestartNeeded', false);
-          queuesconfCtrl.set('isQueuesMustNeedRestart', false);
-          advancedCtrl.set('isRefreshOrRestartNeeded', false);
+          eventBus.publish('afterConfigsSaved', false);
         }
         return store.getRmSchedulerConfigInfo();
       }).catch(
@@ -334,6 +322,8 @@ App.CapschedRoute = Ember.Route.extend({
         return store.find('queue');
       }).then(function(queues) {
         controller.set('queues', queues);
+        var allQLabels = store.all('label');
+        controller.set('allQueueLabels', allQLabels);
         loadingController.set('model', {
           message: 'loading rm info'
         });
@@ -373,10 +363,7 @@ App.CapschedRoute = Ember.Route.extend({
     var opt = '',
       that = this,
       store = this.get('store'),
-      capschedCtrl = this.controllerFor("capsched"),
-      schedulerCtrl = this.controllerFor("capsched.scheduler"),
-      queuesconfCtrl = this.controllerFor("capsched.queuesconf"),
-      advancedCtrl = this.controllerFor("capsched.advanced");
+      capschedCtrl = this.controllerFor("capsched");
 
     if (saveMode == 'restart') {
       opt = 'saveAndRestart';
@@ -386,10 +373,7 @@ App.CapschedRoute = Ember.Route.extend({
 
     capschedCtrl.startSpinner(saveMode);
     store.relaunchCapSched(opt).then(function() {
-      schedulerCtrl.set('isRefreshOrRestartNeeded', false);
-      advancedCtrl.set('isRefreshOrRestartNeeded', false);
-      queuesconfCtrl.set('isRefreshOrRestartNeeded', false);
-      queuesconfCtrl.set('isQueuesMustNeedRestart', false);
+      that.get('eventBus').publish('afterConfigsSaved', false);
     }).catch(
       Em.run.bind(that, 'saveConfigsError', opt)
     ).finally(function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/styles/application.less
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/styles/application.less
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/styles/application.less
index 1ab1740..e24bf4e 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/styles/application.less
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/styles/application.less
@@ -1214,9 +1214,9 @@
     margin-bottom: 10px;
   }
   .label-capacity-input {
-    width: 77px;
+    width: 80px;
     input {
-      width: 50px !important;
+      width: 54px !important;
     }
     .input-group-addon {
       float: left;
@@ -1227,6 +1227,9 @@
   }
   .node-label-item {
     margin-bottom: 10px;
+    .col-md-4.col-sm-4 {
+      padding-right: 0px;
+    }
   }
   .access-disabled {
     color: #ccc;

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/advanced.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/advanced.hbs
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/advanced.hbs
index 9973708..b8ed9ad 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/advanced.hbs
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/advanced.hbs
@@ -18,17 +18,17 @@
 
 <div class="capshed-advanced-container">
   {{!-- QUEUE MAPPING --}}
-  {{#if isOperator}}
     <div class="hidden-sm hidden-xs">
       {{queue-mapping mappings=scheduler.queue_mappings
         mappingsOverrideEnable=scheduler.queue_mappings_override_enable
         queues=queues
         isQueueMappingsDirty=isQueueMappingsDirty
         scheduler=scheduler
-        rollbackProp="rollbackProp"}}
+        rollbackProp="rollbackProp"
+        isOperator=isOperator}}
     </div>
-  {{/if}}
 </div>
+{{#if isOperator}}
 <div class="row">
   <div class="btn btn-group-sm col-sm-offset-2">
     {{#if isQueueMappignsNeedSaveOrRefresh}}
@@ -41,6 +41,7 @@
     <button type="button" class="btn btn-default" name="viewCapSchedXml" 
{{action "viewCapSchedConfigXml"}}>View XML</button>
   </div>
 </div>
+{{/if}}
 
 {{confirm-discard-changes isDialogOpen=isConfirmDialogOpen 
action="rollbackQueueMappingProps"}}
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/preemption.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/preemption.hbs
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/preemption.hbs
index 6d398f6..8d2a1d0 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/preemption.hbs
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/preemption.hbs
@@ -48,6 +48,7 @@
                 {{/if}}
               </div>
             </div>
+            {{#if isOperator}}
             <div class="row">
               <div class="col-sm-4 col-md-4">
                 <div class="checkbox">
@@ -71,6 +72,7 @@
                 </div>
               {{/if}}
             </div>
+            {{/if}}
           {{else}}
             <div class="text-warning">
               <span>Preemption is not supported for your current stack version 
{{currentStack}}</span>

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/editLabelCapacity.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/editLabelCapacity.hbs
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/editLabelCapacity.hbs
index 8fe627e..5e1ae16 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/editLabelCapacity.hbs
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/editLabelCapacity.hbs
@@ -31,7 +31,7 @@
     </div>
     <div class="col-md-4 col-sm-4">
       <div class="form-group input-group label-capacity-input">
-        {{capacity-input class='input-sm' value=label.capacity maxVal=100 
disabled=isAccessDisabled}}
+        {{decimal-capacity-input class='input-sm' value=label.capacity 
maxVal=100 disabled=isAccessDisabled}}
         <span class="input-group-addon">%</span>
       </div>
       <div class="form-group label-capacity-slider">
@@ -47,7 +47,7 @@
     </div>
     <div class="col-md-4 col-sm-4">
       <div {{bind-attr class=":form-group :input-group :label-capacity-input 
isInvalidLabelMaxCapacity:has-error"}}>
-        {{max-capacity-input class='input-sm' value=label.maximum_capacity 
maxVal=100 disabled=isAccessDisabled}}
+        {{decimal-maxcapacity-input class='input-sm' 
value=label.maximum_capacity maxVal=100 disabled=isAccessDisabled}}
         <span class="input-group-addon">%</span>
       </div>
       <div class="form-group label-capacity-slider">

http://git-wip-us.apache.org/repos/asf/ambari/blob/72893f84/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueMapping.hbs
----------------------------------------------------------------------
diff --git 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueMapping.hbs
 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueMapping.hbs
index f143911..7e21b4a 100644
--- 
a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueMapping.hbs
+++ 
b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueMapping.hbs
@@ -31,6 +31,7 @@
         <div class="row">
           <label>User to Queue Mappings (Precedence is from top to 
botttom)</label>
         </div>
+        {{#if isOperator}}
         <div class="row">
           <ul id="qMappingList" class="list-group">
             {{#each qm in queueMappings}}
@@ -176,6 +177,17 @@
             {{/if}}
           </div>
         </div>
+        {{else}}
+        <div class="row">
+          <ul id="qMappingList" class="list-group">
+            {{#each qm in queueMappings}}
+              <li class="list-group-item">{{queueMappingParser qm}}</li>
+            {{else}}
+              <span>No queue mappings defined</span>
+            {{/each}}
+          </ul>
+        </div>
+        {{/if}}
       </div>
     </div>
   </div>

Reply via email to