Not a 100% solution, but keeps the groups-user facet from exploding.

https://fedorahosted.org/freeipa/ticket/1011
From 9b59bebceb79fd1f8101a4e08ed853c65784da9d Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Tue, 1 Mar 2011 21:21:19 -0500
Subject: [PATCH] Use modified entity find commands for associations

---
 install/ui/associate.js |   46 ++++++++++++++++++++++++++--------------------
 install/ui/host.js      |    8 +-------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 600cd55c3abb99f810c8e322da83262c21b5e2c3..47b5b968d6b14110016b435bbfd130c1d96cbf47 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -394,8 +394,12 @@ IPA.association_table_widget = function (spec) {
             'on_success': on_success,
             'on_error': on_error
         });
+        var length = that.values.length;
+        if (length > 100){
+            length = 100;
+        }
 
-        for (var i=0; i<that.values.length; i++) {
+        for (var i=0; i< length; i++) {
             var value = that.values[i];
 
             var command = IPA.command({
@@ -597,6 +601,8 @@ IPA.association_facet = function (spec) {
     that.adder_columns = [];
     that.adder_columns_by_name = {};
 
+    that.relationship_filter = spec.relationship_filter;
+
     that.get_column = function(name) {
         return that.columns_by_name[name];
     };
@@ -881,28 +887,28 @@ IPA.association_facet = function (spec) {
 
         if (!pkeys.length) return;
 
-        var batch = IPA.batch_command({
-            'name': that.entity_name+'_'+that.name,
+
+        var options = {
+            'all': true,
+            'rights': true
+        };
+
+        var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
+        var args =[];
+        var relationship_filter = 'in_' + that.entity_name;
+        options[relationship_filter] = pkey;
+
+        var command = IPA.command({
             'on_success': on_success,
-            'on_error': on_error
+            'on_error': on_error,
+            'method': that.other_entity+'_find',
+            'args': args,
+            options: options
         });
 
-        for (var i=0; i<pkeys.length; i++) {
-            var pkey = pkeys[i];
+        command.execute();
 
-            var command = IPA.command({
-                'method': that.other_entity+'_show',
-                'args': [pkey],
-                'options': {
-                    'all': true,
-                    'rights': true
-                }
-            });
 
-            batch.add_command(command);
-        }
-
-        batch.execute();
     };
 
     that.refresh = function() {
@@ -926,9 +932,9 @@ IPA.association_facet = function (spec) {
                 that.get_records(
                     pkeys,
                     function(data, text_status, xhr) {
-                        var results = data.result.results;
+                        var results = data.result.result;
                         for (var i=0; i<results.length; i++) {
-                            var record = results[i].result;
+                            var record = results[i];
                             that.table.add_record(record);
                         }
                     }
diff --git a/install/ui/host.js b/install/ui/host.js
index 981bfc021924bc740379009e62ef5b8345b262d5..adaf2c1cb003f1ff97d646eab236b8a8e9ff0025 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -50,7 +50,7 @@ IPA.entity_factories.host = function () {
         that.add_facet(facet);
 
         facet = IPA.host_managedby_host_facet({
-            'name': 'managedby_host'
+            name: 'managedby_host'
         });
         that.add_facet(facet);
 
@@ -503,18 +503,12 @@ IPA.host_managedby_host_facet = function (spec) {
             }).appendTo(container);
         };
 
-        that.create_column({name: 'description'});
-
         that.create_adder_column({
             name: 'fqdn',
             primary_key: true,
             width: '100px'
         });
 
-        that.create_adder_column({
-            name: 'description',
-            width: '100px'
-        });
 
         that.association_facet_init();
     };
-- 
1.7.4

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

Reply via email to