You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/05/02 00:08:55 UTC
svn commit: r1478215 [3/3] - in /incubator/ambari/trunk/ambari-web/app:
assets/img/ controllers/main/service/info/ data/ models/ utils/
views/common/configs/
Modified: incubator/ambari/trunk/ambari-web/app/models/service_config.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service_config.js?rev=1478215&r1=1478214&r2=1478215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service_config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service_config.js Wed May 1 22:08:55 2013
@@ -162,6 +162,7 @@ App.ServiceConfigProperty = Ember.Object
overrideErrorTrigger: 0, //Trigger for overrridable property error
isRestartRequired: false,
restartRequiredMessage: 'Restart required',
+ index: null, //sequence number in category
/**
* On Overridable property error message, change overrideErrorTrigger value to recount number of errors service have
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=1478215&r1=1478214&r2=1478215&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/config.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/config.js Wed May 1 22:08:55 2013
@@ -130,7 +130,7 @@ App.config = Em.Object.create({
return _tag.tagName === serviceConfigProperties.tag && _tag.siteName === serviceConfigProperties.type;
});
- properties = (properties.length) ? properties = properties.objectAt(0).properties : {};
+ properties = (properties.length) ? properties.objectAt(0).properties : {};
for (var index in properties) {
var configsPropertyDef = preDefinedConfigs.findProperty('name', index) || null;
var serviceConfigObj = {
@@ -152,6 +152,7 @@ App.config = Em.Object.create({
serviceConfigObj.description = (configsPropertyDef.description !== undefined) ? configsPropertyDef.description : undefined;
serviceConfigObj.isOverridable = configsPropertyDef.isOverridable === undefined ? true : configsPropertyDef.isOverridable;
serviceConfigObj.serviceName = configsPropertyDef ? configsPropertyDef.serviceName : null;
+ serviceConfigObj.index = configsPropertyDef.index;
}
// MAPREDUCE contains core-site properties but doesn't show them
if(serviceConfigObj.serviceName === 'MAPREDUCE' && serviceConfigObj.filename === 'core-site.xml'){
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=1478215&r1=1478214&r2=1478215&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 Wed May 1 22:08:55 2013
@@ -115,10 +115,36 @@ App.ServiceConfigsByCategoryView = Ember
return searchString.toLowerCase().indexOf(filter) > -1;
});
+ filteredResult = this.sortByIndex(filteredResult);
return filteredResult;
}.property('categoryConfigs','parentView.filter', 'parentView.columns.@each.selected'),
/**
+ * sort configs in current category by index
+ * @param configs
+ * @return {*}
+ */
+ sortByIndex: function(configs){
+ var sortedConfigs = [];
+ var unSorted = [];
+ if (!configs.someProperty('index')) {
+ return configs;
+ }
+ configs.forEach(function (config) {
+ var index = config.get('index');
+ if ((index !== null) && isFinite(index)) {
+ sortedConfigs[index] ? sortedConfigs.splice(index, 0 ,config) : sortedConfigs[index] = config;
+ } else {
+ unSorted.push(config);
+ }
+ });
+ // remove undefined elements from array
+ sortedConfigs = sortedConfigs.filter(function(config){
+ if(config !== undefined) return true;
+ });
+ return sortedConfigs.concat(unSorted);
+ },
+ /**
* Onclick handler for Config Group Header. Used to show/hide block
*/
onToggleBlock: function () {
@@ -926,7 +952,7 @@ App.ServiceConfigCapacityScheduler = App
configs: configs
};
content = this.insertExtraConfigs(content);
- content.configs = this.sortQueueProperties(content.configs);
+ content.configs = self.sortByIndex(content.configs);
return content;
}.property(),
footerClass: Ember.View.extend({
@@ -1109,23 +1135,6 @@ App.ServiceConfigCapacityScheduler = App
return content;
},
/**
- * sort properties of queue by index
- * @param configs
- * @return {Array}
- */
- 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);
- },
- /**
* Validate by follow rules:
* Users can be blank. If this is blank, Groups must not be blank.
* Groups can be blank. If this is blank, Users must not be blank.