diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-06-23 11:44:44 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-06-24 12:05:51 -0400 |
commit | 1717d638fc69d38ac5ed848847c7b01601c910dc (patch) | |
tree | 815e337b558d1cfe8723ad521780f1268016ea57 /install/ui/association.js | |
parent | 8a32bb3746802a29b2655e4ad2cbbba8481e1eaf (diff) | |
download | freeipa-1717d638fc69d38ac5ed848847c7b01601c910dc.tar.gz freeipa-1717d638fc69d38ac5ed848847c7b01601c910dc.tar.xz freeipa-1717d638fc69d38ac5ed848847c7b01601c910dc.zip |
Added record count into association facet tabs.
The details and association facets have been modified to show the number of records in each association in the corresponding facet tab.
Ticket #1386
Diffstat (limited to 'install/ui/association.js')
-rw-r--r-- | install/ui/association.js | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index ad8d84795..54a8f6ae2 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -1011,7 +1011,7 @@ IPA.association_facet = function (spec) { that.table.current_page_input.val(that.table.current_page); that.table.total_pages_span.text(that.table.total_pages); - var pkeys = that.record[that.get_attribute_name()]; + var pkeys = that.data[that.get_attribute_name()]; if (!pkeys || !pkeys.length) { that.table.empty(); that.table.summary.text('No entries.'); @@ -1087,6 +1087,22 @@ IPA.association_facet = function (spec) { batch.execute(); }; + that.load = function(data) { + that.facet_load(data); + + var pkeys = that.data[that.get_attribute_name()]; + if (pkeys) { + that.table.total_pages = + Math.ceil(pkeys.length / that.table.page_length); + } else { + that.table.total_pages = 1; + } + + that.table.current_page = 1; + + that.table.refresh(); + }; + that.refresh = function() { if (that.association_type == 'direct') { @@ -1099,31 +1115,21 @@ IPA.association_facet = function (spec) { if (that.remove_button) that.remove_button.css('display', 'none'); } - function on_success(data, text_status, xhr) { - that.record = data.result.result; - - that.table.current_page = 1; - - var pkeys = that.record[that.get_attribute_name()]; - if (pkeys) { - that.table.total_pages = - Math.ceil(pkeys.length / that.table.page_length); - } else { - that.table.total_pages = 1; - } - - that.table.refresh(); - } - var pkey = IPA.get_entity(that.entity_name).get_primary_key(); - IPA.command({ + var command = IPA.command({ entity: that.entity_name, method: 'show', - args: pkey, - on_success: on_success, - on_error: that.on_error - }).execute(); + args: pkey + }); + + command.on_success = function(data, text_status, xhr) { + that.load(data.result.result); + }; + + command.on_error = that.on_error; + + command.execute(); }; that.association_facet_init = that.init; |