From 7c0c39581c567c2c5bd92f9396b6fd99a2b8a6f8 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Tue, 17 Jan 2012 15:50:49 -0600 Subject: Enabled paging on automount keys. The automount keys search facet has been modified to support paging. Since the automountkey-find command doesn't support --pkey-only option, the facet is configured such that during a refresh operation it will retrieve all entries (including the key and info attributes) and then display only the ones that are supposed to be visible in the current page. Ticket #2093 --- install/ui/association.js | 17 +++++++- install/ui/automount.js | 6 ++- install/ui/facet.js | 90 +++++++++++++++++++++++----------------- install/ui/hbac.js | 2 +- install/ui/hbactest.js | 38 +++-------------- install/ui/ipa.js | 4 ++ install/ui/jquery.ordered-map.js | 23 ++++++++++ install/ui/search.js | 35 +++++++--------- install/ui/selinux.js | 2 +- 9 files changed, 122 insertions(+), 95 deletions(-) diff --git a/install/ui/association.js b/install/ui/association.js index ed274eb44..2fbdb7dde 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -998,8 +998,21 @@ IPA.association_facet = function (spec) { dialog.open(that.container); }; - that.get_pkeys = function(data) { - return data.result.result[that.get_attribute_name()] || []; + that.get_records_map = function(data) { + + var records_map = $.ordered_map(); + var association_name = that.get_attribute_name(); + var pkey_name = that.managed_entity.metadata.primary_key; + + var pkeys = data.result.result[association_name]; + for (var i=0; pkeys && i', { href: '#'+key, diff --git a/install/ui/facet.js b/install/ui/facet.js index f0dbc1d42..d65024942 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -409,7 +409,8 @@ IPA.table_facet = function(spec) { that.managed_entity = spec.managed_entity ? IPA.get_entity(spec.managed_entity) : that.entity; that.pagination = spec.pagination === undefined ? true : spec.pagination; - that.search_all = spec.search_all; + that.search_all_entries = spec.search_all_entries; + that.search_all_attributes = spec.search_all_attributes; that.selectable = spec.selectable === undefined ? true : spec.selectable; that.columns = $.ordered_map(); @@ -504,20 +505,30 @@ IPA.table_facet = function(spec) { } }; - that.get_pkeys = function(data) { - return []; + that.get_records_map = function(data) { + + var records_map = $.ordered_map(); + + var result = data.result.result; + var pkey_name = that.managed_entity.metadata.primary_key; + + for (var i=0; i total ? total : end; @@ -553,31 +562,37 @@ IPA.table_facet = function(spec) { summary = summary.replace('${total}', total); that.table.summary.text(summary); - that.values = that.pkeys.slice(start-1, end); + // sort map based on primary keys + records_map = records_map.sort(); + + // trim map leaving the entries visible in the current page only + records_map = records_map.slice(start-1, end); var columns = that.table.columns.values; - if (columns.length == 1) { // show pkey only - var name = columns[0].name; - var records = []; - for (var i=0; i