diff --git a/install/ui/aci.js b/install/ui/aci.js index 92c5dcf02..5d66bfb2b 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -200,6 +200,7 @@ IPA.aci.selfservice_entity = function(spec) { that.init = function(params) { params.builder.search_facet({ + pagination: false, columns:['aciname']}). details_facet({ sections:[{ @@ -232,6 +233,7 @@ IPA.aci.delegation_entity = function(spec) { that.init = function(params) { params.builder.search_facet({ + pagination: false, columns:['aciname']}). details_facet({sections:[ { diff --git a/install/ui/add.js b/install/ui/add.js index 621861fd6..c9d5e46bb 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -46,8 +46,7 @@ IPA.entity_adder_dialog = function(spec) { that.add( function(data, text_status, xhr) { var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); + facet.refresh(); that.close(); }, that.on_error); @@ -67,8 +66,7 @@ IPA.entity_adder_dialog = function(spec) { that.show_message(message); var facet = IPA.current_entity.get_facet(); - var table = facet.table; - table.refresh(); + facet.refresh(); that.reset(); }, that.on_error); diff --git a/install/ui/association.js b/install/ui/association.js index 6ef73dafe..553966eb9 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -457,9 +457,9 @@ IPA.association_table_widget = function (spec) { } var batch = IPA.batch_command({ - 'name': that.entity.name+'_'+that.name, - 'on_success': on_success, - 'on_error': on_error + name: that.entity.name+'_'+that.name, + on_success: on_success, + on_error: on_error }); for (var i=0; i 1) { - var state = {}; - state[that.entity_name+'-page'] = that.table.current_page - 1; - IPA.nav.push_state(state); - } - }; + var other_entity = IPA.get_entity(that.other_entity); + that.init_table(other_entity); + }; - that.table.next_page = function() { - if (that.table.current_page < that.table.total_pages) { - var state = {}; - state[that.entity_name+'-page'] = that.table.current_page + 1; - IPA.nav.push_state(state); - } - }; - - that.table.set_page = function(page) { - if (page < 1) { - page = 1; - } else if (page > that.total_pages) { - page = that.total_pages; - } - var state = {}; - state[that.entity_name+'-page'] = page; - IPA.nav.push_state(state); - }; - - that.table.refresh = function() { - var state = {}; - var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1; - if (page < 1) { - state[that.entity_name+'-page'] = 1; - IPA.nav.push_state(state); - return; - } else if (page > that.table.total_pages) { - state[that.entity_name+'-page'] = that.table.total_pages; - IPA.nav.push_state(state); - return; - } - that.table.current_page = page; - that.table.current_page_input.val(page); - that.refresh_table(); - }; - - that.table.select_changed = function() { - - var values = that.table.get_selected_values(); - - if (that.remove_button) { - if (values.length === 0) { - that.remove_button.addClass('action-button-disabled'); - } else { - that.remove_button.removeClass('action-button-disabled'); - } - } - }; - } + that.get_records_command_name = function() { + return that.entity.name+'_'+that.get_attribute_name(); + }; that.create_header = function(container) { @@ -1070,105 +992,8 @@ IPA.association_facet = function (spec) { dialog.open(that.container); }; - that.refresh_table = function() { - - that.table.current_page_input.val(that.table.current_page); - that.table.total_pages_span.text(that.table.total_pages); - - var pkeys = that.data[that.get_attribute_name()]; - if (!pkeys || !pkeys.length) { - that.table.empty(); - that.table.summary.text(IPA.messages.association.no_entries); - return; - } - - pkeys.sort(); - var total = 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); - - var list = 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 1) { + var state = {}; + state[that.entity_name+'-page'] = that.table.current_page - 1; + IPA.nav.push_state(state); + } + }; + + that.table.next_page = function() { + if (that.table.current_page < that.table.total_pages) { + var state = {}; + state[that.entity_name+'-page'] = that.table.current_page + 1; + IPA.nav.push_state(state); + } + }; + + that.table.set_page = function(page) { + if (page < 1) { + page = 1; + } else if (page > that.total_pages) { + page = that.total_pages; + } + var state = {}; + state[that.entity_name+'-page'] = page; + IPA.nav.push_state(state); + }; + + that.table.load = function(result) { + + 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