From caa9d52666e5beb7321dc6c80820eeacca356077 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Fri, 18 Nov 2011 19:47:39 -0600 Subject: [PATCH] Refactored facet.load(). The load() in IPA.facet has been modified to accept the complete data returned by the server instead of just the result. This is needed by HBAC Test to access other attributes returned in the test result. Ticket #388 --- install/ui/aci.js | 2 +- install/ui/add.js | 32 +++-- install/ui/association.js | 43 +++--- install/ui/automount.js | 58 +++++--- install/ui/details.js | 104 +++++++------- install/ui/dns.js | 199 ++++++++++++++------------ install/ui/entitle.js | 36 +++-- install/ui/facet.js | 232 +++++++++++++++++-------------- install/ui/group.js | 14 +- install/ui/hbac.js | 16 +-- install/ui/search.js | 65 +++------ install/ui/sudo.js | 16 +-- install/ui/test/aci_tests.js | 40 ++++-- install/ui/test/details_tests.js | 12 +- install/ui/user.js | 5 +- 15 files changed, 454 insertions(+), 420 deletions(-) diff --git a/install/ui/aci.js b/install/ui/aci.js index 8e9e5433b..30f5de792 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -716,7 +716,7 @@ IPA.permission_target_policy = function (widget_name) { for (var i=0; i that.table.total_pages) { + state[that.entity_name+'-page'] = that.table.total_pages; + IPA.nav.push_state(state); + return; + } + that.table.current_page = page; + + if (!that.pkeys || !that.pkeys.length) { + that.table.empty(); + that.table.summary.text(IPA.messages.association.no_entries); + that.table.unselect_all(); + return; + } + + that.pkeys.sort(); + var total = that.pkeys.length; + + var start = (that.table.current_page - 1) * that.table.page_length + 1; + var end = that.table.current_page * that.table.page_length; + end = end > total ? total : end; + + var summary = IPA.messages.association.paging; + summary = summary.replace('${start}', start); + summary = summary.replace('${end}', end); + summary = summary.replace('${total}', total); + that.table.summary.text(summary); + + that.values = that.pkeys.slice(start-1, end); + + var columns = that.table.columns.values; + if (columns.length == 1) { // show pkey only + var name = columns[0].name; + that.table.empty(); + for (var i=0; i that.table.total_pages) { - state[that.entity_name+'-page'] = that.table.total_pages; - IPA.nav.push_state(state); - return; - } - that.table.current_page = page; - - if (!that.pkeys || !that.pkeys.length) { - that.table.empty(); - that.table.summary.text(IPA.messages.association.no_entries); - return; - } - - that.pkeys.sort(); - var total = that.pkeys.length; - - var start = (that.table.current_page - 1) * that.table.page_length + 1; - var end = that.table.current_page * that.table.page_length; - end = end > total ? total : end; - - var summary = IPA.messages.association.paging; - summary = summary.replace('${start}', start); - summary = summary.replace('${end}', end); - summary = summary.replace('${total}', total); - that.table.summary.text(summary); - - that.values = that.pkeys.slice(start-1, end); - - var columns = that.table.columns.values; - if (columns.length == 1) { // show pkey only - var name = columns[0].name; - that.table.empty(); - for (var i=0; i"); container.append(details); - var result = {}; + var data = {}; + data.result = {}; + data.result.result = {}; section.create(container); - facet.load(result); + facet.load(data); var table = $('table', container); diff --git a/install/ui/user.js b/install/ui/user.js index 09b4b2a3c..77fbae5bb 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -32,10 +32,7 @@ IPA.user.entity = function(spec) { that.init = function() { that.entity_init(); - var link = true; - if (IPA.nav && IPA.nav.name == 'self-service') { - link = false; - } + var link = IPA.nav.name == 'self-service' ? false : undefined; that.builder.search_facet({ columns: [