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/facet.js | 90 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 39 deletions(-) (limited to 'install/ui/facet.js') diff --git a/install/ui/facet.js b/install/ui/facet.js index f0dbc1d4..d6502494 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