From f34d6e7ca91731cbb09d19bbf73c12d663da731d 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/add.js | 32 ++-- install/ui/association.js | 43 +++--- install/ui/automount.js | 58 +++++--- install/ui/details.js | 102 ++++++------- install/ui/dns.js | 301 ++++++++++++++++++++++---------------- 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/details_tests.js | 6 +- install/ui/user.js | 5 +- 13 files changed, 480 insertions(+), 446 deletions(-) diff --git a/install/ui/add.js b/install/ui/add.js index c9d5e46bb44bafd087fe214be06adb0ecf3d180b..0433e30c2d6daf86750f042de1c3f54149e17d33 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -30,7 +30,6 @@ IPA.entity_adder_dialog = function(spec) { var that = IPA.dialog(spec); that.method = spec.method || 'add'; - that.pre_execute_hook = spec.pre_execute_hook; that.on_error = spec.on_error ; that.retry = typeof spec.retry !== 'undefined' ? spec.retry : true; that.command = null; @@ -107,26 +106,18 @@ IPA.entity_adder_dialog = function(spec) { IPA.nav.show_entity_page(that.entity, 'default', pkey); } - that.add = function(on_success, on_error) { + that.create_add_command = function(record) { var pkey_name = that.entity.metadata.primary_key; var command = IPA.command({ entity: that.entity.name, method: that.method, - retry: that.retry, - on_success: on_success, - on_error: on_error + retry: that.retry }); - that.command = command; command.add_args(that.entity.get_primary_key_prefix()); - if (!that.validate()) return; - - var record = {}; - that.save(record); - var sections = that.sections.values; 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