Author: srimanth
Date: Tue Apr 9 22:58:22 2013
New Revision: 1466282
URL: http://svn.apache.org/r1466282
Log:
AMBARI-1857. Capacity Scheduler: field order for Add/Edit popup. (srimanth)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
incubator/ambari/trunk/ambari-web/app/utils/config.js
incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1466282&r1=1466281&r2=1466282&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Apr 9 22:58:22 2013
@@ -12,6 +12,8 @@ Trunk (unreleased changes):
NEW FEATURES
+ AMBARI-1857. Capacity Scheduler: field order for Add/Edit popup. (srimanth)
+
AMBARI-1855. Capacity Scheduler: when adding a new queue, populate
fields. (srimanth)
Modified: incubator/ambari/trunk/ambari-web/app/data/custom_configs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/custom_configs.js?rev=1466282&r1=1466281&r2=1466282&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/custom_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/custom_configs.js Tue Apr 9
22:58:22 2013
@@ -32,7 +32,8 @@ module.exports =
"category": "CapacityScheduler",
"unit": "%",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 1
},
{
"id": "site property",
@@ -55,7 +56,8 @@ module.exports =
"unit": "%",
"valueRange": [0, 100],
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 2
},
{
"id": "site property",
@@ -78,7 +80,8 @@ module.exports =
"unit": "%",
"valueRange": [1, 100],
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 9
},
{
"id": "site property",
@@ -95,7 +98,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 8
},
{
"id": "site property",
@@ -110,7 +114,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 7
},
{
"id": "site property",
@@ -124,7 +129,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'mapred-queue-acls.xml'
+ "filename": 'mapred-queue-acls.xml',
+ "index": 13
},
{
"id": "site property",
@@ -138,7 +144,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'mapred-queue-acls.xml'
+ "filename": 'mapred-queue-acls.xml',
+ "index": 14
},
{
"id": "site property",
@@ -154,7 +161,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 10
},
{
"id": "site property",
@@ -170,7 +178,8 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 11
},
{
"id": "site property",
@@ -187,6 +196,7 @@ module.exports =
"serviceName": "MAPREDUCE",
"category": "CapacityScheduler",
"isQueue": true,
- "filename": 'capacity-scheduler.xml'
+ "filename": 'capacity-scheduler.xml',
+ "index": 12
}
]
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/utils/config.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/config.js?rev=1466282&r1=1466281&r2=1466282&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Tue Apr 9 22:58:22
2013
@@ -552,7 +552,7 @@ App.config = Em.Object.create({
var dpv = desiredConfigs[property];
var apv = actualConfigs[property];
if (dpv !== apv && globalPropertyToServicesMap[property] !=
null) {
- effected =
globalPropertyToServicesMap[property].indexOf(serviceName) > -1;
+ effected =
globalPropertyToServicesMap[property].indexOf(service) > -1;
this.differentGlobalTagsCache.push(service+"/"+desiredTag+"/"+actualTag);
}
}
Modified:
incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js?rev=1466282&r1=1466281&r2=1466282&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/views/common/configs/services_config.js
Tue Apr 9 22:58:22 2013
@@ -602,6 +602,7 @@ App.ServiceConfigCapacityScheduler = App
config.set('displayType', customConfig.displayType);
config.set('valueRange', customConfig.valueRange);
config.set('isVisible', customConfig.isVisible);
+ config.set('index', customConfig.index);
}
queue.push(config);
}
@@ -872,9 +873,22 @@ App.ServiceConfigCapacityScheduler = App
}
this.hide();
},
+ /**
+ * Queue properties order:
+ * 1. Queue Name
+ * 2. Capacity
+ * 3. Max Capacity
+ * 4. Users
+ * 5. Groups
+ * 6. Admin Users
+ * 7. Admin Groups
+ * 8. Support Priority
+ * ...
+ */
content: function(){
var content = (queueName) ? self.get('queues').findProperty('name',
queueName) : self.get('emptyQueue');
var configs = [];
+ var tableContent = self.get('tableContent');
// copy of queue configs
content.configs.forEach(function (config, index) {
if (config.name == 'mapred.capacity-scheduler.queue.' + content.name
+ '.capacity') {
@@ -884,13 +898,13 @@ App.ServiceConfigCapacityScheduler = App
var isError = false;
var capacities = [];
var capacitySum = 0;
- if(self.get('tableContent')){
- capacities =
self.get('tableContent').mapProperty('capacity');
+ if(tableContent){
+ capacities = tableContent.mapProperty('capacity');
for (var i = 0, l = capacities.length; i < l; i++) {
capacitySum += parseInt(capacities[i]);
}
if (content.name != '<queue-name>') {
- capacitySum = capacitySum -
parseInt(self.get('tableContent').findProperty('name', content.name).capacity);
+ capacitySum = capacitySum -
parseInt(tableContent.findProperty('name', content.name).capacity);
}
}
if (value == '') {
@@ -932,7 +946,9 @@ App.ServiceConfigCapacityScheduler = App
name: content.name,
configs: configs
};
- return this.insertExtraConfigs(content);
+ content = this.insertExtraConfigs(content);
+ content.configs = this.sortQueueProperties(content.configs);
+ return content;
}.property(),
footerClass: Ember.View.extend({
classNames: ['modal-footer', 'host-checks-update'],
@@ -1023,7 +1039,8 @@ App.ServiceConfigCapacityScheduler = App
}
}.observes('value'),
isRequired: true,
- isVisible: true
+ isVisible: true,
+ index: 0
});
newField.validate();
content.configs.unshift(newField);
@@ -1035,7 +1052,8 @@ App.ServiceConfigCapacityScheduler = App
isRequired: true,
isVisible: true,
type: 'USERS',
- "displayType": "UNIXList"
+ displayType: "UNIXList",
+ index: 3
});
newField.validate();
content.configs.push(newField);
@@ -1047,7 +1065,8 @@ App.ServiceConfigCapacityScheduler = App
isRequired: true,
isVisible: true,
type: 'USERS',
- "displayType": "UNIXList"
+ displayType: "UNIXList",
+ index: 5
});
newField.validate();
content.configs.push(newField);
@@ -1059,7 +1078,8 @@ App.ServiceConfigCapacityScheduler = App
isRequired: true,
isVisible: true,
"displayType": "UNIXList",
- type: 'GROUPS'
+ type: 'GROUPS',
+ index: 4
});
newField.validate();
content.configs.push(newField);
@@ -1071,11 +1091,24 @@ App.ServiceConfigCapacityScheduler = App
isRequired: true,
isVisible: true,
"displayType": "UNIXList",
- type: 'GROUPS'
+ type: 'GROUPS',
+ index: 6
});
newField.validate();
content.configs.push(newField);
return content;
+ },
+ sortQueueProperties: function(configs){
+ var sortedConfigs = [];
+ var skippedConfigs = [];
+ configs.forEach(function(_config){
+ if(isFinite(_config.index)){
+ sortedConfigs[_config.index] = _config;
+ } else {
+ skippedConfigs.push(_config);
+ }
+ });
+ return sortedConfigs.concat(skippedConfigs);
}
})
}