On 07/18/2013 05:29 PM, Jan Cholasta wrote:
On 18.7.2013 17:26, Martin Kosek wrote:
On 07/18/2013 05:22 PM, Jan Cholasta wrote:
On 18.7.2013 17:07, Martin Kosek wrote:
On 07/18/2013 04:53 PM, Jan Cholasta wrote:
Added patch which adds new hidden option no_members to suppress
membership
processing for commands of all objects that have member attributes.
This can be
used by the WebUI to prevent member lookups where they are not
necessary (as we
discussed off-line with Martin and Petr).

Honza


1) Should the new option really have "exclude='webui'? I thought
that Web UI is
the main and only consumer of this option.

The 'webui' context doesn't actually exist and the only meaning of
this stanza
is that the option is not shown in the output of the show_mappings
command.


2) I would clearly state this is an internal option only, e.g.

+ doc=_('INTERNAL: suppress processing of membership attributes.'),

No other internal option has this kind of thing in its doc and nobody
will see
it anyway, so we might just leave it like that IMHO.

OK.



3) It would be nice to state that this option is mutually exclusive
with --all,
but given it is internal anyway and there is no central place to
define it, we
do not need to do that.

The options are not really mutually exclusive at this point, they can be
specified together, --all takes precedence.

Well, they can be specified together, but the option is then NOOP
which could
confuse users which may have different expectations. Being explicit
helps.

I agree.

But
as I said, in this case this is not a requirement.

I agree as well :-)

Honza


Functional ACK for Honza's patch (didn't break Web UI test suite)

Attaching Web UI patch.

It:
1) Removed --all from _find and _show commands used by search pages. All displayed attributes should be already included in default attributes.

2) Removed search_all_attributes - Not needed since introduction of paging.

3) Added --no-members options to search _show commmands.
--
Petr Vobornik
From 0b793660e14324596fe7a36290dfd62f83d176be Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Thu, 18 Jul 2013 16:17:40 +0200
Subject: [PATCH] Web UI search optimization

This patch optimizes options used in commands executed by search pages.

1) Removed --all from _find and _show commands used by search pages. All displayed attributes should be already included in default attributes.

2) Removed search_all_attributes - Not needed since introduction of paging.

3) Added --no-members options to search _show commmands. Members are not displayed on search pages and such change drastically improves performance. It reduces computations on server and amount of data transferred to Web UI.
---
 install/ui/src/freeipa/entity.js  | 14 ++++++++++++++
 install/ui/src/freeipa/facet.js   | 11 ++++++-----
 install/ui/src/freeipa/hbac.js    |  1 -
 install/ui/src/freeipa/search.js  |  5 +----
 install/ui/src/freeipa/selinux.js |  1 -
 5 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/install/ui/src/freeipa/entity.js b/install/ui/src/freeipa/entity.js
index 22efd47afaf5dfd7ae6e1c39a6608b1186de6fb7..eef58d1a40b0d8a32e99f61bdd3e239843c0c0aa 100644
--- a/install/ui/src/freeipa/entity.js
+++ b/install/ui/src/freeipa/entity.js
@@ -217,6 +217,20 @@ exp.entity = IPA.entity = function(spec) {
         return that;
     };
 
+    that.has_members = function() {
+        var members = that.metadata.attribute_members;
+        var has = false;
+        if (members) {
+            for (var member in members) {
+                if (members.hasOwnProperty(member)) {
+                    has = true;
+                    break;
+                }
+            }
+        }
+        return has;
+    };
+
     that.builder = spec.builder || IPA.entity_builder(that);
 
     that.entity_init = that.init;
diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js
index 166203a93cd539a36993cfed7816ca9ab616116a..37106e22f44b2fb50fc79b8183cc62e9eb35b6e4 100644
--- a/install/ui/src/freeipa/facet.js
+++ b/install/ui/src/freeipa/facet.js
@@ -1082,7 +1082,6 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
 
     that.pagination = spec.pagination === undefined ? true : spec.pagination;
     that.search_all_entries = spec.search_all_entries;
-    that.search_all_attributes = spec.search_all_attributes;
     that.sort_enabled = spec.sort_enabled === undefined ? true : spec.sort_enabled;
     that.selectable = spec.selectable === undefined ? true : spec.selectable;
     that.select_changed = IPA.observer();
@@ -1312,7 +1311,7 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
 
     that.create_get_records_command = function(pkeys, on_success, on_error) {
 
-         var batch = IPA.batch_command({
+        var batch = IPA.batch_command({
             name: that.get_records_command_name(),
             on_success: on_success,
             on_error: on_error
@@ -1324,10 +1323,13 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
             var command = IPA.command({
                 entity: that.table.entity.name,
                 method: 'show',
-                args: [ pkey ],
-                options: { all: true }
+                args: [pkey]
             });
 
+            if (that.table.entity.has_members()) {
+                command.set_options({no_members: true});
+            }
+
             batch.add_command(command);
         }
 
@@ -1353,7 +1355,6 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
             label: entity.metadata.label,
             entity: entity,
             pagination: true,
-            search_all_attributes: that.search_all_attributes,
             scrollable: true,
             selectable: that.selectable && !that.read_only
         });
diff --git a/install/ui/src/freeipa/hbac.js b/install/ui/src/freeipa/hbac.js
index dc29fad5553fd887b4e350103955eb4f2a575479..e977b4d2611e8a8d4562d1ed806cb8e2c86b50a5 100644
--- a/install/ui/src/freeipa/hbac.js
+++ b/install/ui/src/freeipa/hbac.js
@@ -44,7 +44,6 @@ var spec =  {
         {
             $type: 'search',
             row_enabled_attribute: 'ipaenabledflag',
-            search_all_attributes: true,
             columns: [
                 'cn',
                 {
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
index 03ec0b12adedb8c8ad0272f308e8dc70000931da..c2e678a35e7d7d5179c1b766eea88599710593c3 100644
--- a/install/ui/src/freeipa/search.js
+++ b/install/ui/src/freeipa/search.js
@@ -239,10 +239,7 @@ IPA.search_facet = function(spec, no_init) {
             name: that.get_search_command_name(),
             entity: that.managed_entity.name,
             method: 'find',
-            args: args,
-            options: {
-                all: that.search_all_attributes
-            }
+            args: args
         });
 
         if (that.pagination) {
diff --git a/install/ui/src/freeipa/selinux.js b/install/ui/src/freeipa/selinux.js
index 4eb5fbee5ff98630c6710f86b599eab8fd6dfe40..8a308b434ab20c7657464af702c57ed28cd6d42b 100644
--- a/install/ui/src/freeipa/selinux.js
+++ b/install/ui/src/freeipa/selinux.js
@@ -42,7 +42,6 @@ var spec = {
         {
             $type: 'search',
             row_enabled_attribute: 'ipaenabledflag',
-            search_all_attributes: true,
             columns: [
                 'cn',
                 'ipaselinuxuser',
-- 
1.8.3.1

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

Reply via email to