[Freeipa-devel] [PATCH] Improvements to enrollments in the webUI.

2011-01-04 Thread Pavel Zuna
The patch is a bit bigger and more complex, so I expect this to be the first 
shot at it.


There are some places where we need to handle localization better and be more 
generic when it comes to non-standard relationships like 'enrolledby' etc., but 
that can be done later. (I put a few TODOs in the code.)


Anyway, here's the changelog for this patch:

- Enrollement links in the action panel are now sorted by relationships.
- You can only enroll members.
  (The webUI made the impression you can enroll parents as well, but it was
   broken.)
- When enrolling new members, you can choose not to display already enrolled
  ones. (On by default.)
- Couple cosmetic changes.

IT DEPENDS ON MY PATCH NUMBER 54 (Improve filtering of enrollments search 
results.)


Pavel
From 830c2c5f2780b461f62509ae044c82da76607dc3 Mon Sep 17 00:00:00 2001
From: Pavel Zuna pz...@redhat.com
Date: Tue, 4 Jan 2011 15:21:18 -0500
Subject: [PATCH 2/2] Improvements to enrollments in the webUI.

TAKE 1

- Enrollement links in the action panel are now sorted by relationships.
- You can only enroll members.
  (The webUI made the impression you can enroll parents as well, but it was
   broken.)
- When enrolling new members, you can choose not to display already enrolled
  ones. (On by default.)
- Couple cosmetic changes.
---
 install/static/associate.js |   72 +++
 install/static/entity.js|   45 --
 install/static/group.js |9 +-
 install/static/ipa.css  |   10 +-
 install/static/widget.js|   21 
 5 files changed, 124 insertions(+), 33 deletions(-)

diff --git a/install/static/associate.js b/install/static/associate.js
index 66db171..6517cca 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -140,6 +140,7 @@ function ipa_association_adder_dialog(spec) {
 that.entity_name = spec.entity_name;
 that.pkey = spec.pkey;
 that.other_entity = spec.other_entity;
+that.attribute_member = spec.attribute_member;
 
 that.init = function() {
 if (!that.columns.length) {
@@ -152,6 +153,9 @@ function ipa_association_adder_dialog(spec) {
 });
 }
 
+/* FIXME: event not firing? */
+$('input[name=hidememb]', that.container).click(that.search);
+
 that.adder_dialog_init();
 };
 
@@ -166,7 +170,31 @@ function ipa_association_adder_dialog(spec) {
 }
 }
 
-ipa_cmd('find', [that.get_filter()], {'all': true}, on_success, null, that.other_entity);
+var hide_checkbox = $('input[name=hidememb]', that.container);
+
+var options = {'all': true};
+if (hide_checkbox.attr('checked')) {
+var relationships = IPA.metadata[that.other_entity].relationships;
+
+/* TODO: better generic handling of different relationships! */
+var other_attribute_member = '';
+if (that.attribute_member == 'member')
+other_attribute_member = 'memberof';
+else if (that.attribute_member == 'memberuser')
+other_attribute_member = 'memberof';
+else if (that.attribute_member == 'memberhost')
+other_attribute_member = 'memberof';
+else if (that.attribute_member == 'memberof')
+other_attribute_member = 'member';
+
+var relationship = relationships[other_attribute_member];
+if (relationship) {
+var param_name = relationship[2] + that.entity_name;
+options[param_name] = that.pkey;
+}
+}
+
+ipa_cmd('find', [that.get_filter()], options, on_success, null, that.other_entity);
 };
 
 that.association_adder_dialog_init = that.init;
@@ -234,6 +262,7 @@ function ipa_association_table_widget(spec) {
 var that = ipa_table_widget(spec);
 
 that.other_entity = spec.other_entity;
+that.attribute_member = spec.attribute_member;
 
 that.associator = spec.associator || bulk_associator;
 that.add_method = spec.add_method || 'add_member';
@@ -398,7 +427,8 @@ function ipa_association_table_widget(spec) {
 'title': title,
 'entity_name': that.entity_name,
 'pkey': pkey,
-'other_entity': that.other_entity
+'other_entity': that.other_entity,
+'attribute_member': that.attribute_member,
 });
 };
 
@@ -513,6 +543,8 @@ function ipa_association_facet(spec) {
 var that = ipa_facet(spec);
 
 that.other_entity = spec.other_entity;
+that.facet_group = spec.facet_group;
+that.attribute_member = spec.attribute_member;
 
 that.associator = spec.associator || bulk_associator;
 that.add_method = spec.add_method || 'add_member';
@@ -636,9 +668,20 @@ function ipa_association_facet(spec) {
 
 that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
 
-//TODO I18N
-var header_message = 

Re: [Freeipa-devel] [PATCH] Improvements to enrollments in the webUI.

2011-01-04 Thread Adam Young

On 01/04/2011 10:34 AM, Pavel Zuna wrote:
The patch is a bit bigger and more complex, so I expect this to be the 
first shot at it.


There are some places where we need to handle localization better and 
be more generic when it comes to non-standard relationships like 
'enrolledby' etc., but that can be done later. (I put a few TODOs in 
the code.)


Anyway, here's the changelog for this patch:

- Enrollement links in the action panel are now sorted by relationships.
- You can only enroll members.
  (The webUI made the impression you can enroll parents as well, but 
it was

   broken.)
- When enrolling new members, you can choose not to display already 
enrolled

  ones. (On by default.)
- Couple cosmetic changes.

IT DEPENDS ON MY PATCH NUMBER 54 (Improve filtering of enrollments 
search results.)



Pavel


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Nack,

Make sure you fiter out the object itselt, so you can't enroll, for 
example, a group in itself.
For verbage, Use Members for ojects enrolled in this object, and 
Member of:  inplace of parent.


Other than that, it looks good.

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] Improvements to enrollments in the webUI.

2011-01-04 Thread Adam Young

On 01/04/2011 12:45 PM, Adam Young wrote:

On 01/04/2011 10:34 AM, Pavel Zuna wrote:
The patch is a bit bigger and more complex, so I expect this to be 
the first shot at it.


There are some places where we need to handle localization better and 
be more generic when it comes to non-standard relationships like 
'enrolledby' etc., but that can be done later. (I put a few TODOs in 
the code.)


Anyway, here's the changelog for this patch:

- Enrollement links in the action panel are now sorted by relationships.
- You can only enroll members.
  (The webUI made the impression you can enroll parents as well, but 
it was

   broken.)
- When enrolling new members, you can choose not to display already 
enrolled

  ones. (On by default.)
- Couple cosmetic changes.

IT DEPENDS ON MY PATCH NUMBER 54 (Improve filtering of enrollments 
search results.)



Pavel


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Nack,

Make sure you fiter out the object itselt, so you can't enroll, for 
example, a group in itself.
For verbage, Use Members for ojects enrolled in this object, and 
Member of:  inplace of parent.


Other than that, it looks good.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

pushed to master
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] Improvements to enrollments in the webUI.

2011-01-04 Thread Adam Young

On 01/04/2011 12:45 PM, Adam Young wrote:

On 01/04/2011 10:34 AM, Pavel Zuna wrote:
The patch is a bit bigger and more complex, so I expect this to be 
the first shot at it.


There are some places where we need to handle localization better and 
be more generic when it comes to non-standard relationships like 
'enrolledby' etc., but that can be done later. (I put a few TODOs in 
the code.)


Anyway, here's the changelog for this patch:

- Enrollement links in the action panel are now sorted by relationships.
- You can only enroll members.
  (The webUI made the impression you can enroll parents as well, but 
it was

   broken.)
- When enrolling new members, you can choose not to display already 
enrolled

  ones. (On by default.)
- Couple cosmetic changes.

IT DEPENDS ON MY PATCH NUMBER 54 (Improve filtering of enrollments 
search results.)



Pavel


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Nack,

Make sure you fiter out the object itselt, so you can't enroll, for 
example, a group in itself.

For verbage, Use Members fo


Actually, we can do those as follow on work.  I think this should be 
pushed, as it is a significant improvement over what we have now.



r ojects enrolled in this object, and Member of:  inplace of parent.

Other than that, it looks good.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel