|
@@ -21,47 +21,24 @@ var App = require('app');
|
|
|
App.ServiceConfig = Ember.Object.extend({
|
|
|
serviceName: '',
|
|
|
configCategories: [],
|
|
|
- configCategoriesMap: function() {
|
|
|
- var categoriesMap = {};
|
|
|
- this.get('configCategories').forEach(function(c) {
|
|
|
- if (!categoriesMap[c.get('name')]) categoriesMap[c.get('name')] = c;
|
|
|
- });
|
|
|
- return categoriesMap;
|
|
|
- }.property('configCategories.[]'),
|
|
|
- configs: [],
|
|
|
+ configs: null,
|
|
|
restartRequired: false,
|
|
|
restartRequiredMessage: '',
|
|
|
restartRequiredHostsAndComponents: {},
|
|
|
configGroups: [],
|
|
|
dependentServiceNames: [],
|
|
|
initConfigsLength: 0, // configs length after initialization in order to watch changes
|
|
|
-
|
|
|
- errorCount: Em.computed.alias('configsWithErrors.length'),
|
|
|
-
|
|
|
- visibleProperties: function() {
|
|
|
- return this.get('configs').filter(function(c) {
|
|
|
- return c.get('isVisible') && !c.get('hiddenBySection');
|
|
|
- });
|
|
|
- }.property('configs.@each.isVisible', 'configs.@each.hiddenBySection'),
|
|
|
-
|
|
|
- configsWithErrors: function() {
|
|
|
- return this.get('visibleProperties').filter(function(c) {
|
|
|
- return !c.get('isValid') || !c.get('isValidOverride');
|
|
|
+ errorCount: function () {
|
|
|
+ var overrideErrors = 0,
|
|
|
+ masterErrors = 0,
|
|
|
+ slaveErrors = 0,
|
|
|
+ configs = this.get('configs'),
|
|
|
+ configCategories = this.get('configCategories'),
|
|
|
+ enhancedConfigsErrors = 0;
|
|
|
+ configCategories.forEach(function (_category) {
|
|
|
+ slaveErrors += _category.get('slaveErrorCount');
|
|
|
+ _category.set('nonSlaveErrorCount', 0);
|
|
|
});
|
|
|
- }.property('visibleProperties.@each.isValid', 'visibleProperties.@each.isValidOverride'),
|
|
|
-
|
|
|
- observeErrors: function() {
|
|
|
- this.get('configCategories').setEach('errorCount', 0);
|
|
|
- this.get('configsWithErrors').forEach(function(c) {
|
|
|
- if (this.get('configCategoriesMap')[c.get('category')]) {
|
|
|
- this.get('configCategoriesMap')[c.get('category')].incrementProperty('errorCount');
|
|
|
- }
|
|
|
- }, this);
|
|
|
- }.observes('configsWithErrors'),
|
|
|
-
|
|
|
- observeForeignKeys: function() {
|
|
|
- //TODO refactor or move this login to other place
|
|
|
- var configs = this.get('configs');
|
|
|
configs.forEach(function (item) {
|
|
|
if (item.get('isVisible')) {
|
|
|
var options = item.get('options');
|
|
@@ -78,7 +55,29 @@ App.ServiceConfig = Ember.Object.extend({
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- }.observes('configs.@each.isVisible'),
|
|
|
+ configs.forEach(function (item) {
|
|
|
+ var category = configCategories.findProperty('name', item.get('category'));
|
|
|
+ if (category && !item.get('isValid') && item.get('isVisible') && !item.get('widgetType')) {
|
|
|
+ category.incrementProperty('nonSlaveErrorCount');
|
|
|
+ masterErrors++;
|
|
|
+ }
|
|
|
+ if (!item.get('isValid') && item.get('widgetType') && item.get('isVisible') && !item.get('hiddenBySection')) {
|
|
|
+ enhancedConfigsErrors++;
|
|
|
+ }
|
|
|
+ if (item.get('overrides')) {
|
|
|
+ item.get('overrides').forEach(function (e) {
|
|
|
+ if (e.error) {
|
|
|
+ if (category && !Em.get(e, 'parentSCP.widget')) {
|
|
|
+ category.incrementProperty('nonSlaveErrorCount');
|
|
|
+ }
|
|
|
+ overrideErrors++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return masterErrors + slaveErrors + overrideErrors + enhancedConfigsErrors;
|
|
|
+ }.property('configs.@each.isValid', 'configs.@each.isVisible', 'configCategories.@each.slaveErrorCount', 'configs.@each.overrideErrorTrigger'),
|
|
|
+
|
|
|
/**
|
|
|
* checks if for example for kdc_type, the value isn't just the pretty version of the saved value, for example mit-kdc
|
|
|
* and Existing MIT KDC are the same value, but they are interpreted as being changed. This function fixes that
|
|
@@ -119,6 +118,24 @@ App.ServiceConfig = Ember.Object.extend({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+App.SlaveConfigs = Ember.Object.extend({
|
|
|
+ componentName: null,
|
|
|
+ displayName: null,
|
|
|
+ hosts: null,
|
|
|
+ groups: null
|
|
|
+});
|
|
|
+
|
|
|
+App.Group = Ember.Object.extend({
|
|
|
+ name: null,
|
|
|
+ hostNames: null,
|
|
|
+ properties: null,
|
|
|
+ errorCount: function () {
|
|
|
+ if (this.get('properties')) {
|
|
|
+ return this.get('properties').filterProperty('isValid', false).filterProperty('isVisible', true).get('length');
|
|
|
+ }
|
|
|
+ }.property('properties.@each.isValid', 'properties.@each.isVisible')
|
|
|
+});
|
|
|
+
|
|
|
App.ConfigSiteTag = Ember.Object.extend({
|
|
|
site: DS.attr('string'),
|
|
|
tag: DS.attr('string'),
|