|
@@ -19,80 +19,94 @@
|
|
var App = require('app');
|
|
var App = require('app');
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Represents a configuration-group on the cluster.
|
|
|
|
|
|
+ * Represents a configuration-group on the cluster.
|
|
* A configuration-group is a collection of hosts
|
|
* A configuration-group is a collection of hosts
|
|
* on which a collection of configurations are applied.
|
|
* on which a collection of configurations are applied.
|
|
- *
|
|
|
|
- * Configuration group hierarchy is at 2 levels. For
|
|
|
|
|
|
+ *
|
|
|
|
+ * Configuration group hierarchy is at 2 levels. For
|
|
* each service there is a 'Default' configuration group
|
|
* each service there is a 'Default' configuration group
|
|
* containing all hosts not belonging to any group of that
|
|
* containing all hosts not belonging to any group of that
|
|
- * service.
|
|
|
|
- *
|
|
|
|
|
|
+ * service.
|
|
|
|
+ *
|
|
* A default configuration group has child configuration
|
|
* A default configuration group has child configuration
|
|
* groups which contain configuration overrides (deltas)
|
|
* groups which contain configuration overrides (deltas)
|
|
- * for a bunch of hosts. This allows different configurations
|
|
|
|
|
|
+ * for a bunch of hosts. This allows different configurations
|
|
* for different hosts in a heterogeneous cluster environment.
|
|
* for different hosts in a heterogeneous cluster environment.
|
|
*/
|
|
*/
|
|
App.ConfigGroup = Ember.Object.extend({
|
|
App.ConfigGroup = Ember.Object.extend({
|
|
- id: DS.attr('number'),
|
|
|
|
- name: DS.attr('string'),
|
|
|
|
- description: DS.attr('string'),
|
|
|
|
- isDefault: DS.attr('boolean'),
|
|
|
|
-
|
|
|
|
|
|
+ id: null,
|
|
|
|
+ name: null,
|
|
|
|
+ description: null,
|
|
|
|
+ isDefault: null,
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Parent configuration group for this group.
|
|
* Parent configuration group for this group.
|
|
* When {@link #isDefault} is true, this value is <code>null</code>
|
|
* When {@link #isDefault} is true, this value is <code>null</code>
|
|
* When {@link #isDefault} is false, this represents the configuration
|
|
* When {@link #isDefault} is false, this represents the configuration
|
|
* deltas that are applied on the default.
|
|
* deltas that are applied on the default.
|
|
*/
|
|
*/
|
|
- parentConfigGroup: DS.belongsTo('App.ConfigGroup'),
|
|
|
|
-
|
|
|
|
|
|
+ parentConfigGroup: null,
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Children configuration groups for this group.
|
|
* Children configuration groups for this group.
|
|
* When {@link #isDefault} is false, this value is <code>null</code>
|
|
* When {@link #isDefault} is false, this value is <code>null</code>
|
|
* When {@link #isDefault} is true, this represents the various
|
|
* When {@link #isDefault} is true, this represents the various
|
|
* configuration groups that override the default.
|
|
* configuration groups that override the default.
|
|
*/
|
|
*/
|
|
- childConfigGroups: DS.hasMany('App.ConfigGroup'),
|
|
|
|
-
|
|
|
|
|
|
+ childConfigGroups: [],
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Service for which this configuration-group
|
|
|
|
|
|
+ * Service for which this configuration-group
|
|
* is applicable.
|
|
* is applicable.
|
|
*/
|
|
*/
|
|
- service: DS.belongsTo('App.Service'),
|
|
|
|
-
|
|
|
|
|
|
+ service: null,
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Hosts on which this configuration-group
|
|
|
|
- * is to be applied. For a service, a host can
|
|
|
|
|
|
+ * Hosts on which this configuration-group
|
|
|
|
+ * is to be applied. For a service, a host can
|
|
* belong to only one non-default configuration-group.
|
|
* belong to only one non-default configuration-group.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* When {#isDefault} is false, this contains hosts
|
|
* When {#isDefault} is false, this contains hosts
|
|
* for which the overrides will apply.
|
|
* for which the overrides will apply.
|
|
- *
|
|
|
|
- * When {#isDefault} is true, this value is empty, as
|
|
|
|
|
|
+ *
|
|
|
|
+ * When {#isDefault} is true, this value is empty, as
|
|
* it dynamically reflects hosts not belonging to other
|
|
* it dynamically reflects hosts not belonging to other
|
|
* non-default groups.
|
|
* non-default groups.
|
|
- *
|
|
|
|
|
|
+ *
|
|
*/
|
|
*/
|
|
- hosts: DS.hasMany('App.Host'),
|
|
|
|
-
|
|
|
|
|
|
+ hosts: [],
|
|
|
|
+
|
|
|
|
+ displayName: function () {
|
|
|
|
+ return this.get('name') + ' (' + this.get('hosts.length') + ')';
|
|
|
|
+ }.property('name', 'hosts.length'),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Provides hosts which are available for inclusion in
|
|
|
|
- * non-default configuration groups.
|
|
|
|
|
|
+ * Provides hosts which are available for inclusion in
|
|
|
|
+ * non-default configuration groups.
|
|
*/
|
|
*/
|
|
- availableHosts: function() {
|
|
|
|
-
|
|
|
|
|
|
+ availableHosts: function () {
|
|
|
|
+
|
|
}.property('isDefault', 'parentConfigGroup', 'childConfigGroups'),
|
|
}.property('isDefault', 'parentConfigGroup', 'childConfigGroups'),
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Collection of (site, tag) pairs representing properties.
|
|
* Collection of (site, tag) pairs representing properties.
|
|
- *
|
|
|
|
- * When {#isDefault} is true, this represents the
|
|
|
|
|
|
+ *
|
|
|
|
+ * When {#isDefault} is true, this represents the
|
|
* default cluster configurations for that service.
|
|
* default cluster configurations for that service.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* When {#isDefault} is false, this represents the
|
|
* When {#isDefault} is false, this represents the
|
|
* configuration overrides on top of the cluster default for the
|
|
* configuration overrides on top of the cluster default for the
|
|
* hosts identified by 'hosts'.
|
|
* hosts identified by 'hosts'.
|
|
*/
|
|
*/
|
|
- configSiteTags: DS.hasMany('App.ConfigSiteTag')
|
|
|
|
|
|
+ configSiteTags: [],
|
|
|
|
+
|
|
|
|
+ properties: [],
|
|
|
|
+
|
|
|
|
+ propertiesList: function () {
|
|
|
|
+ var result = '';
|
|
|
|
+ this.get('properties').forEach(function (item) {
|
|
|
|
+ result += item.name + " : " + item.value + '\n';
|
|
|
|
+ }, this);
|
|
|
|
+ return result;
|
|
|
|
+ }.property('properties.length')
|
|
});
|
|
});
|