summaryrefslogtreecommitdiffstats
path: root/install/static/entity.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-12-02 17:16:34 -0600
committerAdam Young <ayoung@redhat.com>2010-12-03 12:57:43 -0500
commit867ac1f03d77d72b25037ddf7cacccf407ff531e (patch)
tree8f10115d1a6a0aa2b3e7099223bac2d48dfe12f8 /install/static/entity.js
parent929cd858052f337f5edd2749426e6bf458fa54f4 (diff)
downloadfreeipa-867ac1f03d77d72b25037ddf7cacccf407ff531e.tar.gz
freeipa-867ac1f03d77d72b25037ddf7cacccf407ff531e.tar.xz
freeipa-867ac1f03d77d72b25037ddf7cacccf407ff531e.zip
Fixed association links
The create_association_facets() has been modified such that it does not generate duplicate links. This is done by assigning the proper labels and hiding non-assignable associations. Each association will get a label based on the attribute used: - memberof: Membership in <entity name> - member.*: <entity name> Members - managedby: Managed by <entity name> The following associations will be hidden: - memberindirect - enrolledby The internal.py was modified to return localized labels. The test data has been updated.
Diffstat (limited to 'install/static/entity.js')
-rw-r--r--install/static/entity.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/install/static/entity.js b/install/static/entity.js
index 6e2b501b..548623e2 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -151,9 +151,7 @@ function ipa_entity(spec) {
return config;
};
- that.create_association_facet = function(other_entity, attribute_member) {
-
- var label = IPA.metadata[other_entity].label;
+ that.create_association_facet = function(attribute_member, other_entity, label) {
if (!attribute_member) {
attribute_member = ipa_get_member_attribute(
@@ -173,12 +171,30 @@ function ipa_entity(spec) {
var attribute_members = IPA.metadata[that.name].attribute_members;
for (var attribute_member in attribute_members) {
+
+ // skip non-assignable associations
+ if (attribute_member === 'memberindirect') continue;
+ if (attribute_member === 'enrolledby') continue;
+
var other_entities = attribute_members[attribute_member];
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;
+
+ if (attribute_member.match(/^memberof$/)) {
+ label = IPA.messages.association.membershipin+' '+other_entity_name;
+
+ } else if (attribute_member.match(/^member/)) {
+ label = other_entity_name+' '+IPA.messages.association.members;
+
+ } else if (attribute_member.match(/^managedby$/)) {
+ label = IPA.messages.association.managedby+' '+other_entity_name;
+ }
- var facet = that.create_association_facet(other_entity, attribute_member);
+ var facet = that.create_association_facet(attribute_member, other_entity, label);
if (that.get_facet(facet.name)) continue;
that.add_facet(facet);
}