Re: [Freeipa-devel] [PATCH] 0229-automount-delete-key

2011-05-31 Thread Adam Young

On 05/28/2011 08:54 PM, Adam Young wrote:



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

JSL lint cleanup
From 7fba335cf391dab621102da43c3a1eae7cfdb74e Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Fri, 27 May 2011 21:37:05 -0400
Subject: [PATCH] automount delete key

---
 install/ui/automount.js |   31 ++-
 install/ui/dialog.js|   24 +++-
 install/ui/search.js|   23 ---
 install/ui/webui.js |3 +--
 4 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/install/ui/automount.js b/install/ui/automount.js
index e5fab0d8f1311b2153b358675f57deff91858a55..5b62bd912e85eb75a3570f1e2a06975d67180965 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -63,7 +63,8 @@ IPA.entity_factories.automountmap = function() {
 nested_entity : 'automountkey',
 label : IPA.metadata.objects.automountkey.label,
 name: 'keys',
-columns:['automountkey','automountinformation','description']
+get_values: IPA.get_option_values,
+columns:['automountkey','automountinformation']
 }).
 details_facet({
 sections:[
@@ -81,7 +82,7 @@ IPA.entity_factories.automountmap = function() {
  undo: false,
  label:'Map Type',
  options:[{value:'add',label:'Direct'},
-  {value:'add_indirect',label:'Indirect'}],
+  {value:'add_indirect',label:'Indirect'}]
 },
 'automountmapname','description',
 {name:'key',label:'Mount Point',conditional:true},
@@ -114,21 +115,35 @@ IPA.entity_factories.automountkey = function() {
 IPA.automountmap_adder_dialog = function(spec){
 var that = IPA.add_dialog(spec);
 
-
-
 that.super_setup = that.setup;
 that.setup = function(container) {
 that.super_setup(container);
 that.disable_conditional_fields();
-}
+};
 
 that.super_add = that.add;
 that.add = function(record, on_success, on_error) {
 that.super_add(record, on_success, on_error);
-}
+};
 return that;
 };
 
+
+IPA.get_option_values = function(){
+
+var values = [];
+$('input[name=select]:checked', this.table.tbody).each(function() {
+var value = {};
+$('span',$(this).parent().parent()).each(function(){
+var name = this.attributes['name'].value;
+
+value[name] = $(this).text();
+});
+values.push (value);
+});
+return values;
+};
+
 IPA.method_radio_widget = function(spec){
 var direct = true;
 
@@ -151,9 +166,7 @@ IPA.method_radio_widget = function(spec){
 that.dialog.disable_conditional_fields();
 }
 });
-
-
-}
+};
 
 return that;
 };
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 092263df08bab6a08e3cd943359b58e7fdde76ed..a6a2692714bc358715abe809aa13ae703b7f90c3 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -51,7 +51,7 @@ IPA.dialog = function(spec) {
that.conditional_fields[i] +
   ']',that.container).css('visibility','visible');
 }
-}
+};
 
 that.disable_conditional_fields = function(){
 for (var i =0; i  that.conditional_fields.length; i+=1) {
@@ -59,9 +59,7 @@ IPA.dialog = function(spec) {
   that.conditional_fields[i] +
   ']',that.container).css('visibility','hidden');
 }
-}
-
-
+};
 
 that.__defineGetter__(entity_name, function(){
 return that._entity_name;
@@ -620,8 +618,24 @@ IPA.deleter_dialog =  function (spec) {
 ul.appendTo(div);
 
 for (var i=0; ithat.values.length; i++) {
+var value = that.values[i];
+if (value instanceof Object){
+var first = true;
+var str_value = ;
+for (var key in value){
+if (value.hasOwnProperty(key)){
+str_value += (key + ':' +value[key]);
+if (first){
+str_value += ',';
+}
+first = false;
+}
+}
+value = str_value;
+}
+
 $('li/',{
-'text': that.values[i]
+'text': value
 }).appendTo(ul);
 }
 };
diff --git a/install/ui/search.js b/install/ui/search.js
index 5786886ac8459e5b0e34bb881cc20707dcab19eb..ba27cc9ddf818c11003fe8f9a1c89c4c84d7a448 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -37,6 +37,12 @@ IPA.search_facet = function(spec) {
 that.search_all = spec.search_all || false;
 
 
+function get_values (){
+

Re: [Freeipa-devel] [PATCH] 0229-automount-delete-key

2011-05-31 Thread Adam Young
I thought I had posted my work for indirect maps as a different patch, 
but it appears not.  This patch merged in delete key and indirect maps.



On 05/31/2011 10:00 AM, Adam Young wrote:

On 05/31/2011 09:57 AM, Adam Young wrote:

On 05/28/2011 08:54 PM, Adam Young wrote:



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

JSL lint cleanup


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

rebased on top of recent changes


___
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

Re: [Freeipa-devel] [PATCH] 0229-automount-delete-key

2011-05-31 Thread Adam Young

On 05/31/2011 10:00 AM, Adam Young wrote:

On 05/31/2011 09:57 AM, Adam Young wrote:

On 05/28/2011 08:54 PM, Adam Young wrote:



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

JSL lint cleanup


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

rebased on top of recent changes


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


From 8d142f02c0e42a58b49e335943e8f2375811062c Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Fri, 27 May 2011 11:32:17 -0400
Subject: [PATCH] automount delete key indirect automount maps

---
 install/ui/add.js   |4 +-
 install/ui/automount.js |   77 +--
 install/ui/dialog.js|   41 -
 install/ui/search.js|   23 --
 install/ui/webui.js |3 +-
 install/ui/widget.js|2 +-
 6 files changed, 138 insertions(+), 12 deletions(-)

diff --git a/install/ui/add.js b/install/ui/add.js
index 73a423f00744394241638acceeb0dfa315af40cf..33df62abcaef6e5ec30e397b10d73ea5d8b478ff 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -32,7 +32,7 @@ IPA.add_dialog = function (spec) {
 that.name = spec.name;
 that.title = spec.title;
 that._entity_name = spec.entity_name;
-
+that.method = spec.method || 'add';
 that.init = function() {
 
 that.add_button(IPA.messages.buttons.add, function() {
@@ -102,7 +102,7 @@ IPA.add_dialog = function (spec) {
 
 var command = IPA.command({
 entity: that.entity_name,
-method: 'add',
+method: that.method,
 on_success: on_success,
 on_error: on_error
 });
diff --git a/install/ui/automount.js b/install/ui/automount.js
index f865fe73f315c224b53bbe2d74ff2f0109e4d6f2..5b62bd912e85eb75a3570f1e2a06975d67180965 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -63,19 +63,30 @@ IPA.entity_factories.automountmap = function() {
 nested_entity : 'automountkey',
 label : IPA.metadata.objects.automountkey.label,
 name: 'keys',
-columns:['description']
+get_values: IPA.get_option_values,
+columns:['automountkey','automountinformation']
 }).
 details_facet({
 sections:[
 {
 name:'identity',
 label: IPA.messages.details.identity,
-fields:['automountmapname','description']
+fields:['automountmapname','description','mount','parentmap']
 }
 ]
 }).
 adder_dialog({
-fields:['automountmapname','description']
+factory: IPA.automountmap_adder_dialog,
+fields:[{factory:IPA.method_radio_widget,
+ name: 'method',
+ undo: false,
+ label:'Map Type',
+ options:[{value:'add',label:'Direct'},
+  {value:'add_indirect',label:'Indirect'}]
+},
+'automountmapname','description',
+{name:'key',label:'Mount Point',conditional:true},
+{name:'parentmap', label:'Parent Map',conditional:true}]
 }).
 build();
 };
@@ -99,3 +110,63 @@ IPA.entity_factories.automountkey = function() {
 }).
 build();
 };
+
+
+IPA.automountmap_adder_dialog = function(spec){
+var that = IPA.add_dialog(spec);
+
+that.super_setup = that.setup;
+that.setup = function(container) {
+that.super_setup(container);
+that.disable_conditional_fields();
+};
+
+that.super_add = that.add;
+that.add = function(record, on_success, on_error) {
+that.super_add(record, on_success, on_error);
+};
+return that;
+};
+
+
+IPA.get_option_values = function(){
+
+var values = [];
+$('input[name=select]:checked', this.table.tbody).each(function() {
+var value = {};
+$('span',$(this).parent().parent()).each(function(){
+var name = this.attributes['name'].value;
+
+value[name] = $(this).text();
+});
+values.push (value);
+});
+return values;
+};
+
+IPA.method_radio_widget = function(spec){
+var direct = true;
+
+var that = IPA.radio_widget(spec);
+
+that.setup = function(container) {
+
+$('input[name='+that.name+']', that.container).
+filter([value=+ that.dialog.method+]).
+attr('checked', true);
+
+var input = $('input[name='+that.name+']', that.container);
+
+input.change(function() {
+that.dialog.method = 

Re: [Freeipa-devel] [PATCH] 0229-automount-delete-key

2011-05-31 Thread Endi Sukma Dewata

On 5/31/2011 11:59 AM, Adam Young wrote:




Some issues:

1. The labels for mount and parentmap fields in automount map are
   missing.

2. The mount and parentmap fields in automount map adder dialog shows
   undo button. This can be fixed by adding undo: false parameter.

3. The Delete button remains disabled after selecting some automount
   keys to be deleted.

4. Clicking 'Back to List' when viewing a map brings you back to list
   of locations. Is this still intentional? Perhaps the label should be
   changed to 'Back to Locations' or simply hidden.

5. The conditional fields in IPA.dialog are a little bit limited
   because there is only one set of conditional fields which has to be
   enabled/disabled together. It might be better to replace the
   'conditional' boolean paramter into 'field_group' then replace the
   enable/disable methods to accept a field group. This could be done
   later.

6. The add() in IPA.automountmap_adder_dialog is probably unnecessary
   because it's only calling the superclass's add() method.

7. The following assignment in automount.js line 158:

 var input = $('input[name='+that.name+']', that.container);

   could be moved to the beginning of the method to avoid reexecuting
   the same jQuery selector.

8. In dialog.js line 626 and search.js line 253, the hasOwnProperty()
   invocations are probably redundant because the key is obtained from
   the object itself, so that method will always return true.

9. The if (first) statement in dialog.js line 628 will only append a
   comma after the first key-value pair and nothing after that. This
   statement probably should have been if (!first) and moved to the
   beginning of the loop.

10. The 3rd level tab for automount key was removed. At this point does
it makes sense to remove the 3rd level tabs completely?

11. The option values for automount map adder dialog could be
simplified to direct and indirect.

--
Endi S. Dewata

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


[Freeipa-devel] [PATCH] 169 Added pagination for associations.

2011-05-31 Thread Endi Sukma Dewata

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011

--
Endi S. Dewata
From fb05d4c5f5bfbf082da8a104aa93bdbe08368577 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Fri, 27 May 2011 16:30:41 -0500
Subject: [PATCH] Added pagination for associations.

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011
---
 install/ui/associate.js |  152 ++-
 install/ui/ipa.css  |   19 +-
 install/ui/sudo.js  |9 +++-
 install/ui/widget.js|  131 -
 4 files changed, 212 insertions(+), 99 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 5eb84260eee57ef556db13cf4e04eeb9c430f52a..cae242339d77cf8561aefaaf1af2ba52e9a26398 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -468,19 +468,20 @@ IPA.association_table_widget = function (spec) {
 
 that.get_records = function(on_success, on_error) {
 
-if (!that.values.length) return;
-
-var batch = IPA.batch_command({
-'name': that.entity_name+'_'+that.name,
-'on_success': on_success,
-'on_error': on_error
-});
 var length = that.values.length;
-if (length  100){
+if (!length) return;
+
+if (length  100) {
 length = 100;
 }
 
-for (var i=0; i length; i++) {
+var batch = IPA.batch_command({
+'name': that.entity_name+'_'+that.name,
+'on_success': on_success,
+'on_error': on_error
+});
+
+for (var i=0; ilength; i++) {
 var value = that.values[i];
 
 var command = IPA.command({
@@ -706,6 +707,8 @@ IPA.association_facet = function (spec) {
 that.columns = $.ordered_map();
 that.adder_columns = $.ordered_map();
 
+that.page_length = 20;
+
 that.get_column = function(name) {
 return that.columns.get(name);
 };
@@ -765,7 +768,8 @@ IPA.association_facet = function (spec) {
 name: pkey_name,
 label: label,
 entity_name: that.entity_name,
-other_entity: that.other_entity
+other_entity: that.other_entity,
+page_length: that.page_length
 });
 
 var columns = that.columns.values;
@@ -810,6 +814,10 @@ IPA.association_facet = function (spec) {
 column.entity_name = that.other_entity;
 }
 
+that.table.refresh = function() {
+that.refresh_table();
+};
+
 that.table.init();
 };
 
@@ -978,66 +986,100 @@ IPA.association_facet = function (spec) {
 dialog.open(that.container);
 };
 
+that.refresh_table = function() {
+
+that.table.empty();
+
+that.table.current_page_input.val(that.table.current_page);
+that.table.total_pages_span.text(that.table.total_pages);
+
+var pkeys = that.record[that.name];
+if (!pkeys || !pkeys.length) {
+that.table.summary.text('No entries.');
+return;
+}
+
+pkeys.sort();
+var total = pkeys.length;
+
+var start = (that.table.current_page - 1) * that.table.page_length + 1;
+var end = that.table.current_page * that.table.page_length;
+end = end  total ? total : end;
+
+var summary = 'Showing '+start+' to '+end+' of '+total+' entries.';
+that.table.summary.text(summary);
+
+var list = pkeys.slice(start-1, end);
+
+var columns = that.table.columns.values;
+if (columns.length == 1) { // show pkey only
+var name = columns[0].name;
+for (var i=0; ilist.length; i++) {
+var entry = {};
+entry[name] = list[i];
+that.table.add_record(entry);
+}
+
+} else { // get and show additional fields
+that.get_records(
+list,
+function(data, text_status, xhr) {
+var results = data.result.results;
+for (var i=0; iresults.length; i++) {
+var record = results[i].result;
+that.table.add_record(record);
+}
+}
+);
+}
+};
+
 that.get_records = function(pkeys, on_success, on_error) {
 
-if (!pkeys.length) return;
+var length = pkeys.length;
+if (!length) return;
 
-
-var options = {
-'all': true,
-'rights': true
-};
-
-var pkey = $.bbq.getState(that.entity_name+'-pkey');
-var args 

Re: [Freeipa-devel] [PATCH] 169 Added pagination for associations.

2011-05-31 Thread Endi Sukma Dewata

On 5/31/2011 2:18 PM, Endi Sukma Dewata wrote:

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011


Attached is a new patch based on Adam's feedback.

Fixed performance issue by not requesting rights and all attributes for 
associations. Postpone table.empty() invocation until the data for the 
new page becomes available.


--
Endi S. Dewata
From b190564a70e720738ca42d7d4fee647d28b02b6b Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Fri, 27 May 2011 16:30:41 -0500
Subject: [PATCH] Added pagination for associations.

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011
---
 install/ui/associate.js |  163 +-
 install/ui/ipa.css  |   19 +-
 install/ui/sudo.js  |9 ++-
 install/ui/widget.js|  131 ++
 4 files changed, 218 insertions(+), 104 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 5eb84260eee57ef556db13cf4e04eeb9c430f52a..4f2d323a9943197e0cbb95fbee29e6d62b4c050c 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -468,19 +468,20 @@ IPA.association_table_widget = function (spec) {
 
 that.get_records = function(on_success, on_error) {
 
-if (!that.values.length) return;
-
-var batch = IPA.batch_command({
-'name': that.entity_name+'_'+that.name,
-'on_success': on_success,
-'on_error': on_error
-});
 var length = that.values.length;
-if (length  100){
+if (!length) return;
+
+if (length  100) {
 length = 100;
 }
 
-for (var i=0; i length; i++) {
+var batch = IPA.batch_command({
+'name': that.entity_name+'_'+that.name,
+'on_success': on_success,
+'on_error': on_error
+});
+
+for (var i=0; ilength; i++) {
 var value = that.values[i];
 
 var command = IPA.command({
@@ -706,6 +707,8 @@ IPA.association_facet = function (spec) {
 that.columns = $.ordered_map();
 that.adder_columns = $.ordered_map();
 
+that.page_length = 20;
+
 that.get_column = function(name) {
 return that.columns.get(name);
 };
@@ -765,7 +768,8 @@ IPA.association_facet = function (spec) {
 name: pkey_name,
 label: label,
 entity_name: that.entity_name,
-other_entity: that.other_entity
+other_entity: that.other_entity,
+page_length: that.page_length
 });
 
 var columns = that.columns.values;
@@ -810,6 +814,10 @@ IPA.association_facet = function (spec) {
 column.entity_name = that.other_entity;
 }
 
+that.table.refresh = function() {
+that.refresh_table();
+};
+
 that.table.init();
 };
 
@@ -978,66 +986,102 @@ IPA.association_facet = function (spec) {
 dialog.open(that.container);
 };
 
-that.get_records = function(pkeys, on_success, on_error) {
+that.refresh_table = function() {
 
-if (!pkeys.length) return;
+that.table.current_page_input.val(that.table.current_page);
+that.table.total_pages_span.text(that.table.total_pages);
 
+var pkeys = that.record[that.name];
+if (!pkeys || !pkeys.length) {
+that.table.summary.text('No entries.');
+return;
+}
 
-var options = {
-'all': true,
-'rights': true
-};
+pkeys.sort();
+var total = pkeys.length;
 
-var pkey = $.bbq.getState(that.entity_name+'-pkey');
-var args =[];
-/* TODO: make a general solution to generate this value */
-var relationship_filter = 'in_' + that.entity_name;
-options[relationship_filter] = pkey;
+var start = (that.table.current_page - 1) * that.table.page_length + 1;
+var end = that.table.current_page * that.table.page_length;
+end = end  total ? total : end;
 
-var command = IPA.command({
-entity: that.other_entity,
-method: 'find',
-args: args,
-options: options,
-on_success: on_success,
-on_error: on_error
-});
+var summary = 'Showing '+start+' to '+end+' of '+total+' entries.';
+that.table.summary.text(summary);
 
-command.execute();
-
-
-};
-
-that.refresh = function() {
-
-function on_success(data, text_status, xhr) {
+var list = pkeys.slice(start-1, end);
 
+var columns = that.table.columns.values;
+if 

Re: [Freeipa-devel] [PATCH] 169 Added pagination for associations.

2011-05-31 Thread Endi Sukma Dewata

On 5/31/2011 3:38 PM, Endi Sukma Dewata wrote:

On 5/31/2011 2:18 PM, Endi Sukma Dewata wrote:

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011


Attached is a new patch based on Adam's feedback.

Fixed performance issue by not requesting rights and all attributes for
associations. Postpone table.empty() invocation until the data for the
new page becomes available.


Attached is a new patch. Due to a separate issue (the show command 
returns incomplete set of attributes) the 'all' option is required for 
now. This option can be removed later when the issue is addressed.


--
Endi S. Dewata
From 84dbe55df16426717086f8647f51c19522068b37 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Fri, 27 May 2011 16:30:41 -0500
Subject: [PATCH] Added pagination for associations.

The association facet has been modified to support pagination. The
UI will show 20 members per page. There are buttons to go to a
previous or next page. There is also an input text to jump directly
to a certain page.

Ticket #1011
---
 install/ui/associate.js |  164 ++-
 install/ui/ipa.css  |   19 +-
 install/ui/sudo.js  |9 ++-
 install/ui/widget.js|  131 ++
 4 files changed, 219 insertions(+), 104 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 5eb84260eee57ef556db13cf4e04eeb9c430f52a..ad2da521687d5e684882aa85eab9b94226d4f7ce 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -468,19 +468,20 @@ IPA.association_table_widget = function (spec) {
 
 that.get_records = function(on_success, on_error) {
 
-if (!that.values.length) return;
-
-var batch = IPA.batch_command({
-'name': that.entity_name+'_'+that.name,
-'on_success': on_success,
-'on_error': on_error
-});
 var length = that.values.length;
-if (length  100){
+if (!length) return;
+
+if (length  100) {
 length = 100;
 }
 
-for (var i=0; i length; i++) {
+var batch = IPA.batch_command({
+'name': that.entity_name+'_'+that.name,
+'on_success': on_success,
+'on_error': on_error
+});
+
+for (var i=0; ilength; i++) {
 var value = that.values[i];
 
 var command = IPA.command({
@@ -706,6 +707,8 @@ IPA.association_facet = function (spec) {
 that.columns = $.ordered_map();
 that.adder_columns = $.ordered_map();
 
+that.page_length = 20;
+
 that.get_column = function(name) {
 return that.columns.get(name);
 };
@@ -765,7 +768,8 @@ IPA.association_facet = function (spec) {
 name: pkey_name,
 label: label,
 entity_name: that.entity_name,
-other_entity: that.other_entity
+other_entity: that.other_entity,
+page_length: that.page_length
 });
 
 var columns = that.columns.values;
@@ -810,6 +814,10 @@ IPA.association_facet = function (spec) {
 column.entity_name = that.other_entity;
 }
 
+that.table.refresh = function() {
+that.refresh_table();
+};
+
 that.table.init();
 };
 
@@ -978,66 +986,103 @@ IPA.association_facet = function (spec) {
 dialog.open(that.container);
 };
 
-that.get_records = function(pkeys, on_success, on_error) {
+that.refresh_table = function() {
 
-if (!pkeys.length) return;
+that.table.current_page_input.val(that.table.current_page);
+that.table.total_pages_span.text(that.table.total_pages);
 
+var pkeys = that.record[that.name];
+if (!pkeys || !pkeys.length) {
+that.table.summary.text('No entries.');
+return;
+}
 
-var options = {
-'all': true,
-'rights': true
-};
+pkeys.sort();
+var total = pkeys.length;
 
-var pkey = $.bbq.getState(that.entity_name+'-pkey');
-var args =[];
-/* TODO: make a general solution to generate this value */
-var relationship_filter = 'in_' + that.entity_name;
-options[relationship_filter] = pkey;
+var start = (that.table.current_page - 1) * that.table.page_length + 1;
+var end = that.table.current_page * that.table.page_length;
+end = end  total ? total : end;
 
-var command = IPA.command({
-entity: that.other_entity,
-method: 'find',
-args: args,
-options: options,
-on_success: on_success,
-on_error: on_error
-});
+var summary = 'Showing '+start+' to '+end+' of '+total+' entries.';
+that.table.summary.text(summary);
 

[Freeipa-devel] [PATCH] 0230-redirect-on-show-erro

2011-05-31 Thread Adam Young

https://fedorahosted.org/freeipa/ticket/1227
From e0b5c62a22a10629f06484bb2339e927f2e57e6e Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Tue, 31 May 2011 17:48:20 -0400
Subject: [PATCH] redirect on show error.

---
 install/ui/details.js |   17 ++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/install/ui/details.js b/install/ui/details.js
index fbf2ff52d45e4ffce1069f6029e7836aedfcf5c0..d9c948e978e86b78b890f34c65cac793c58ef264 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -641,9 +641,20 @@ IPA.details_facet = function(spec) {
 };
 
 command.on_error = function(xhr, text_status, error_thrown) {
-var details = $('.details', that.container).empty();
-details.append('pError: '+error_thrown.name+'/p');
-details.append('p'+error_thrown.message+'/p');
+if (that.entity.redirect_facet) {
+var current_entity = that.entity;
+while (current_entity.containing_entity){
+current_entity = current_entity.containing_entity;
+}
+IPA.nav.show_page(
+current_entity.name,
+that.entity.redirect_facet);
+return;
+}else{
+var details = $('.details', that.container).empty();
+details.append('pError: '+error_thrown.name+'/p');
+details.append('p'+error_thrown.message+'/p');
+}
 };
 
 command.execute();
-- 
1.7.5.1

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

Re: [Freeipa-devel] [PATCH] 24 Add sudorule and hbacrule to memberof AND indirectmemberof attributes

2011-05-31 Thread JR Aquino
On May 20, 2011, at 8:32 AM, Rob Crittenden wrote:

 JR Aquino wrote:
 On May 10, 2011, at 8:14 PM, Adam Young wrote:
 
 On 05/10/2011 11:07 PM, Adam Young wrote:
 On 05/10/2011 04:38 PM, JR Aquino wrote:
 On Apr 22, 2011, at 12:53 PM, Rob Crittenden wrote:
 
 
 JR Aquino wrote:
 
 On Apr 12, 2011, at 9:45 AM, JR Aquino wrote:
 
 
 Add HBAC Rule and Sudo Rule to users as indirect member attributes to 
 simplify the auditing of users for their indirect membership to their 
 authorization rights.
 
 An Administrator should have the ability to quickly identify the 
 rights a user will have in the system.
 
 For example. With the patch added, my user show looks like this:
 
 # ipa user-show tester --all
  dn: uid=builder,cn=users,cn=accounts,dc=example,dc=com
  User login: tester
  First name: Tester
  Last name: Engineering
  Full name: Tester Engineering
  Display name: Tester Engineering
  Initials: TE
  Home directory: /home/tester
  GECOS field: Tester Engineering
  Login shell: /bin/sh
  Kerberos principal:
 tes...@example.com
 
  UID: 1829800388
  GID: 1829800388
  Account disabled: False
  Member of groups: ipausers, auto-dev-deploy-tools, build-integration
  ipauniqueid: 72fa22c6-6085-11e0-9629-0023aefe4ec0
  krbpwdpolicyreference: 
 cn=global_policy,cn=EXAMPLE.COM,cn=kerberos,dc=example,dc=com
  memberofindirect_HBAC rule: development
  memberofindirect_Sudo Rule: AUTO-dev-deploy-tools_DEPLOY, 
 AUTO-dev-deploy-tools_ZENOSS, build-integration
  mepmanagedentry: cn=tester,cn=groups,cn=accounts,dc=example,dc=com
  objectclass: top, person, organizationalperson, inetorgperson, 
 inetuser, posixaccount
 
 freeipa-jraquino-0024-Add-sudorule-and-hbacrule-to-indirectmemberof-attrib.patch___
 Freeipa-devel mailing list
 
 Freeipa-devel@redhat.com
 https://www.redhat.com/mailman/listinfo/freeipa-devel
 OPPS, forgot to have PATCH in the subject.
 
 
 I think you need this as well, right?
 
 -'memberof': ['group', 'netgroup', 'role'],
 +'memberof': ['group', 'netgroup', 'role', 'sudorule', 
 'hbacrule'],
 
 Some scope change.
 
 Added memberof and memberofindirect
 
 Added to user.py host.py group.py hostgroup.py
 
 When using the --all flag it is now very clear to the administrator what 
 authorization rules these objects are directly or indirectly a memberof.
 
 xmlrpc tests check out
 
 Please review
 
 
 
 ___
 Freeipa-devel mailing list
 
 Freeipa-devel@redhat.com
 https://www.redhat.com/mailman/listinfo/freeipa-devel
 
 
 The reason that this shows up in the UI is that it is generating 
 additional memberof attributes.  It has nothing to do with the 
 memberofindirect:
 
 You are also going to want need modify the sudo rule and HBAC rule to use 
 the serial associator on some facets.  It looks like group at least has 
 things backwards.  The group.js file I think needs a rule like this:
 
 
  association_facet({
 name: 'memberof_sudorule',
 associator: IPA.serial_associator
 }).
 
 THis is because the API is for adding multiple groups to the sudo rule, but 
 the default behaviour is for adding multipleother entity  tothis entity.
 
 The above comment is regarding ticket: 
 https://fedorahosted.org/freeipa/ticket/1218 which is dependent on this 
 patch and ticket 1170
 
 As for Patch 24 and ticket 1170, are there any other questions or does this 
 look ready to go?
 
 Nack, this adds some additional API that isn't in API.txt.
 
 It would be nice to add test cases for this as well, perhaps in the sudo and 
 hbac tests (create a rule, add a user to it, make sure when showing the user 
 you can see the rule).


New patch attached to address API and Tests.
(Please note Ticket# 1263 incase there are problems testing)

Please review and ack



binZSYqz8RswD.bin
Description: freeipa-jraquino-0024-Add-sudorule-and-hbacrule-to-memberof-indirectmemberof-attrib.patch
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

[Freeipa-devel] [PATCH] 170 Fixed pagination problem.

2011-05-31 Thread Endi Sukma Dewata

The association table needs to be emptied if there is no entries.

Pushed under one-liner rule.

--
Endi S. Dewata
From 647c7f55ea5a9803dad8c088ccaa0a8c716acdc8 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Tue, 31 May 2011 16:55:56 -0500
Subject: [PATCH] Fixed pagination problem.

The association table needs to be emptied if there is no entries.
---
 install/ui/associate.js |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index ad2da521687d5e684882aa85eab9b94226d4f7ce..73a19021ab4bcc9511735402797dbf27f3c0827f 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -993,6 +993,7 @@ IPA.association_facet = function (spec) {
 
 var pkeys = that.record[that.name];
 if (!pkeys || !pkeys.length) {
+that.table.empty();
 that.table.summary.text('No entries.');
 return;
 }
-- 
1.7.4

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

Re: [Freeipa-devel] [PATCH] 0230-redirect-on-show-erro

2011-05-31 Thread Endi Sukma Dewata

On 5/31/2011 4:50 PM, Adam Young wrote:

https://fedorahosted.org/freeipa/ticket/1227


ACK and pushed to master.

This patch fixes the details page, but for some entities the default 
facet is association instead of details. It can be fixed in another patch.


--
Endi S. Dewata

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