summaryrefslogtreecommitdiffstats
path: root/install/ui/entity.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-02-11 18:04:04 -0600
committerAdam Young <ayoung@redhat.com>2011-02-15 17:45:46 -0500
commiteb8f091c9bfce3f6d4004bbf214e169aa3f8fe29 (patch)
tree0ee90b8bc6f57a83e6502f29a51e8b3cfd8d5180 /install/ui/entity.js
parent1e9f923c495710bb9e9c47b6893e32c7829d3c45 (diff)
downloadfreeipa-eb8f091c9bfce3f6d4004bbf214e169aa3f8fe29.tar.gz
freeipa-eb8f091c9bfce3f6d4004bbf214e169aa3f8fe29.tar.xz
freeipa-eb8f091c9bfce3f6d4004bbf214e169aa3f8fe29.zip
Fixed association facets.
The association config has been removed because it incorrectly assumes there is only one association between two entities. Now each association is defined separately using association facets. The service.py has been modified to specify the correct relationships. The API.txt has been updated. https://fedorahosted.org/freeipa/ticket/960
Diffstat (limited to 'install/ui/entity.js')
-rw-r--r--install/ui/entity.js93
1 files changed, 10 insertions, 83 deletions
diff --git a/install/ui/entity.js b/install/ui/entity.js
index fdc45d827..18839c940 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -122,9 +122,6 @@ IPA.entity = function (spec) {
that.autogenerate_associations = false;
- that.associations = [];
- that.associations_by_name = {};
-
that.get_dialog = function(name) {
return that.dialogs_by_name[name];
};
@@ -166,74 +163,25 @@ IPA.entity = function (spec) {
return that;
};
- that.get_associations = function() {
- return that.associations;
- };
-
- that.get_association = function(name) {
- return that.associations_by_name[name];
- };
-
- that.add_association = function(config) {
- that.associations.push(config);
- that.associations_by_name[config.name] = config;
- };
-
- that.create_association = function(spec) {
- var config = IPA.association_config(spec);
- that.add_association(config);
- return config;
- };
-
- that.association = function(spec) {
- var config = IPA.association_config(spec);
- that.add_association(config);
- return that;
- };
-
-
that.create_association_facet = function(attribute_member, other_entity, label, facet_group) {
- if (!attribute_member) {
- attribute_member = IPA.get_member_attribute(
- that.entity_name, other_entity);
- }
-
- var association_name= attribute_member+'_'+other_entity;
+ var association_name = attribute_member+'_'+other_entity;
//TODO remove from the facets and facets_by_name collections
var facet = that.get_facet(association_name);
- if (facet){
+ if (facet) {
facet.facet_group = facet_group;
facet.attribute_member = attribute_member;
return;
}
- var config = that.get_association(other_entity);
- if (!config){
- config = that.get_association(association_name);
- }
-
- var spec ={
- 'name': association_name,
- 'label': label,
- 'other_entity': other_entity,
- 'facet_group': facet_group,
- 'attribute_member': attribute_member
- };
-
- if (config){
- for (var key in config){
- /*name is special, as iut has already been munged
- into the association name */
- if (key === "name"){
- continue;
- }
- spec[key] = config[key] ;
- }
- }
-
- facet = IPA.association_facet(spec);
+ facet = IPA.association_facet({
+ name: association_name,
+ label: label,
+ attribute_member: attribute_member,
+ other_entity: other_entity,
+ facet_group: facet_group
+ });
that.add_facet(facet);
};
@@ -252,9 +200,7 @@ IPA.entity = function (spec) {
for (var j = 0; j < other_entities.length; j++) {
var other_entity = other_entities[j];
- var other_entity_name = IPA.metadata[other_entity].label;
-
- var label = other_entity_name;
+ var label = IPA.metadata[other_entity].label;
var relationships = IPA.metadata[that.name].relationships;
@@ -381,25 +327,6 @@ IPA.entity_set_details_definition = function (entity_name, sections) {
}
};
-
-IPA.entity_set_association_definition = function (entity_name, data) {
-
- var entity = IPA.fetch_entity(entity_name);
-
- entity.autogenerate_associations = true;
-
- for (var other_entity in data) {
- var config = data[other_entity];
- entity.create_association({
- 'name': other_entity,
- 'associator': config.associator,
- 'add_method': config.add_method,
- 'remove_method': config.remove_method
- });
- }
-};
-
-
IPA.entity_set_facet_definition = function (entity_name, list) {
var entity = IPA.fetch_entity(entity_name);