No search widget. This will keep the UI from throwing an Error, but doesn't give a way to get results beyond the first 100


On 03/02/2011 01:20 PM, Endi Sukma Dewata wrote:
On 3/2/2011 10:56 AM, Adam Young wrote:
This version uses the search widget. A little more intrusive than I
wanted, but if fixes the issue with
https://fedorahosted.org/freeipa/ticket/1011

I tested this with Group's Member User:

The Add button doesn't open a dialog box, but it tries to create the content of the dialog box under the search table.

The Delete button does open a dialog box, but it doesn't delete the member, then it goes back to group's search page.

Another thing, I was expecting the entire that.table = IPA.table_widget
to be replaced by that.table = IPA.search_widget so we don't have to do this:
  if (that.columns.length == 1) {
    // do things with table widget
  } else {
    // do things with search widget
  }
but it might be to complicated for this release.

604: that.relationship_filter = spec.relationship_filter;
899: var relationship_filter = 'in_' + that.entity_name;

Removed the code at 604 for now. We'll see what the right solution is
when we start implementing the others. I don't like how the code had to
be split up due to the init function.

Then I'd ask that you put a note above 899, something like this:
// TODO: fix hard-coded relationship filter


From ae4b78e2a2708f4dc041018bc7fc0ddb11c1e51b 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

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

Does not completely fix the problem in the ticket, but it does mitigate the failure.
---
 install/ui/associate.js |   45 +++++++++++++++++++++++++--------------------
 install/ui/host.js      |   10 ++--------
 install/ui/service.js   |    8 +-------
 3 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 2f1a28d5a66e989d562c3605fa335763bcd00324..db3a9cd55ed5ccdc78e0c90b69c9e652139bed9f 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -430,8 +430,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({
@@ -917,28 +921,29 @@ 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 =[];
+        /* TODO: make a general solution to generate this value */
+        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() {
@@ -962,9 +967,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..9ef7553e950d3cde5f22ca1a966067c445f6acd7 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'
+            width: '200px'
         });
 
-        that.create_adder_column({
-            name: 'description',
-            width: '100px'
-        });
 
         that.association_facet_init();
     };
diff --git a/install/ui/service.js b/install/ui/service.js
index ff642a808b9d1c6aebf02d7c9385c7a245cba1aa..d8d8ad501c820a8e3305a4d072b92297c67abe25 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -395,17 +395,11 @@ IPA.service_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'
+            width: '200px'
         });
 
         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