Repository: ambari Updated Branches: refs/heads/trunk 83c9237b8 -> 9fb75ef6e
AMBARI-15877. Capacity Scheduler View: New UI - queues save integration. (Akhil PB via dipayanb) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9fb75ef6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9fb75ef6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9fb75ef6 Branch: refs/heads/trunk Commit: 9fb75ef6eb09638c8ed5031fde4eac5315f0ff7a Parents: 83c9237 Author: Dipayan Bhowmick <[email protected]> Authored: Fri May 20 15:10:31 2016 +0530 Committer: Dipayan Bhowmick <[email protected]> Committed: Fri May 20 15:10:31 2016 +0530 ---------------------------------------------------------------------- .../resources/ui/app/controllers/queuesconf.js | 15 ++++++++++--- .../capsched/partials/editQueueCapacity.hbs | 9 +++++++- .../capsched/partials/queueCapacity.hbs | 23 +++++++++++++------- .../capsched/partials/queueResources.hbs | 2 +- .../app/templates/components/queueSummary.hbs | 2 +- .../resources/ui/app/views/editQueueCapacity.js | 6 ++++- 6 files changed, 42 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/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 0f4d038..89d0e89 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 @@ -71,9 +71,9 @@ App.CapschedQueuesconfController = Ember.Controller.extend({ this.set('newQueue', newQueue); } - store.saveAndUpdateQueue(newQueue).then(function() { - Em.run.bind(this, 'set', 'newQueue', null); - }).catch(Em.run.bind(this, 'saveQueuesConfigError', 'createQueue')); + store.saveAndUpdateQueue(newQueue) + .then(Em.run.bind(this, 'saveAndUpdateQueueSuccess', newQueue)) + .catch(Em.run.bind(this, 'saveQueuesConfigError', 'createQueue')); }, saveQueuesConfig: function() { var store = this.get('store'), @@ -137,5 +137,14 @@ App.CapschedQueuesconfController = Ember.Controller.extend({ var response = (error && error.responseJSON)? error.responseJSON : {}; response.simpleMessage = operation.capitalize() + ' failed!'; this.set('alertMessage', response); + }, + saveAndUpdateQueueSuccess: function(newQ) { + var parentPath = newQ.get('parentPath'), + parentQ = this.store.getById('queue', parentPath.toLowerCase()), + pQueues = parentQ.get('queues') ? parentQ.get('queues').split(",") : []; + pQueues.addObject(newQ.get('name')); + pQueues.sort(); + parentQ.set('queues', pQueues.join(",")); + this.set('newQueue', null); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/editQueueCapacity.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/editQueueCapacity.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/editQueueCapacity.hbs index 753fa9b..55910ee 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/editQueueCapacity.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/editQueueCapacity.hbs @@ -35,7 +35,7 @@ {{/if}} </div> <div class="col-md-5 col-sm-5"> - <div class="form-group input-group capacity-input-percent"> + <div {{bind-attr class=":form-group :input-group :capacity-input-percent view.isInvalidQueueMaximumCapacity:has-error"}}> {{max-capacity-input class='input-sm' value=this.maximum_capacity queue=this maxVal=100}} <span class="input-group-addon">%</span> </div> @@ -47,5 +47,12 @@ <a {{action 'rollbackProp' 'maximum_capacity' this}} href="#" class="btn btn-default btn-warning"><i class="fa fa-undo"></i></a> </div> {{/if}} + {{#if view.isInvalidQueueMaximumCapacity}} + <div class="row"> + <div class="col-md-12 col-sm-12"> + <span class="text-danger">Maximum capacity must be greater than or equal to capacity</span> + </div> + </div> + {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueCapacity.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueCapacity.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueCapacity.hbs index 8e278f0..ee9616b 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueCapacity.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueCapacity.hbs @@ -34,13 +34,13 @@ <div class="col-md-5 col-sm-5"> {{tooltip-label label='Capacity' - message= 'The minimum guaranteed capacity as a percentage of total capacity that is allocated to the queue.' + message='The minimum guaranteed capacity as a percentage of total capacity that is allocated to the queue.' }} </div> <div class="col-md-5 col-sm-5"> {{tooltip-label label='Max Capacity' - message= 'The cap (maximum capacity) as a percentage of total capacity that this queue can utilize.' + message='The cap (maximum capacity) as a percentage of total capacity that this queue can utilize.' }} </div> </div> @@ -54,19 +54,26 @@ <div class="col-sm-5 col-md-5"> <div class="progress total-capacity-progress"> <div role="progressbar" {{bind-attr class=":progress-bar warnInvalidCapacity:progress-bar-danger:progress-bar-success" style="totalCapacityBarWidth"}}> - Used:{{childrenQueuesTotalCapacity}}% + {{childrenQueuesTotalCapacity}}% </div> </div> </div> - </div> + </div> + {{#if warnInvalidCapacity}} + <div class="row"> + <div class="col-sm-6 col-md-6"> + <span class="text-danger">Total capacity must be equal to 100%</span> + </div> + </div> + {{/if}} {{else}} <div class="row"> <div class="col-md-6 col-md-6"> - <label>Capacity: </label> + <label>Configured Capacity: </label> <span>{{content.capacity}}%</span> </div> <div class="col-md-5 col-md-5"> - <label>Maximum Capacity: </label> + <label>Configured Maximum Capacity: </label> <span>{{content.maximum_capacity}}%</span> </div> </div> @@ -80,11 +87,11 @@ {{else}} <div class="row"> <div class="col-md-6 col-md-6"> - <label>Capacity: </label> + <label>Configured Capacity: </label> <span>{{content.capacity}}%</span> </div> <div class="col-md-5 col-sm-5"> - <label>Maximum Capacity: </label> + <label>Configured Maximum Capacity: </label> <span>{{content.maximum_capacity}}%</span> </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueResources.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueResources.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueResources.hbs index f25180f..bb82025 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueResources.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/capsched/partials/queueResources.hbs @@ -20,7 +20,7 @@ <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title"> - Resources <a id="collapseResourcesPanelBtn" href="#collapsibleQueueResourcesPanel" data-toggle="collapse" {{bind-attr class=":pull-right view.isResourcesPanelCollapsed:collapsed"}}><i {{bind-attr class=":fa view.isResourcesPanelCollapsed:fa-plus:fa-minus"}}></i></a> + Other Configs (User Limit factor, Max AM Resource etc) <a id="collapseResourcesPanelBtn" href="#collapsibleQueueResourcesPanel" data-toggle="collapse" {{bind-attr class=":pull-right view.isResourcesPanelCollapsed:collapsed"}}><i {{bind-attr class=":fa view.isResourcesPanelCollapsed:fa-plus:fa-minus"}}></i></a> </div> </div> <div id="collapsibleQueueResourcesPanel" {{bind-attr class=":panel-collapse :collapse view.isResourcesPanelCollapsed::in"}}> http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueSummary.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueSummary.hbs b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueSummary.hbs index b5c3c04..7ba9e62 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueSummary.hbs +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/templates/components/queueSummary.hbs @@ -46,7 +46,7 @@ </div> <div class="row"> <div class="col-sm-6"> - <label>Overall Cluster Capacity</label> + <label>Absolute Capacity</label> </div> <div class="col-sm-4"> <span>{{effectiveCapacity}}%</span> http://git-wip-us.apache.org/repos/asf/ambari/blob/9fb75ef6/contrib/views/capacity-scheduler/src/main/resources/ui/app/views/editQueueCapacity.js ---------------------------------------------------------------------- diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/views/editQueueCapacity.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/views/editQueueCapacity.js index 2628553..5c3793f 100644 --- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/views/editQueueCapacity.js +++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/views/editQueueCapacity.js @@ -25,5 +25,9 @@ App.CapschedPartialsEditQueueCapacityView = Ember.View.extend({ isQueueMaximumCapacityDirty: function() { return this.get('controller.content').changedAttributes().hasOwnProperty('maximum_capacity'); - }.property('controller.content.maximum_capacity') + }.property('controller.content.maximum_capacity'), + + isInvalidQueueMaximumCapacity: function() { + return this.get('controller.content.maximum_capacity') < this.get('controller.content.capacity'); + }.property('controller.content.capacity', 'controller.content.maximum_capacity') });
