diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-12-15 13:40:29 +0100 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-12-15 19:59:57 +0000 |
commit | 187bedafd0e261661c6368b6df90eb9d31ef9ceb (patch) | |
tree | 959f57ae298f8a8c85ddf6407ee22f1974a4790d /install/ui/association.js | |
parent | cb649f2de2f0399ca02adb14684109ef12a55d52 (diff) | |
download | freeipa.git-187bedafd0e261661c6368b6df90eb9d31ef9ceb.tar.gz freeipa.git-187bedafd0e261661c6368b6df90eb9d31ef9ceb.tar.xz freeipa.git-187bedafd0e261661c6368b6df90eb9d31ef9ceb.zip |
Fixed displaying of external records in rule association widgets
It's a fix for regression introduced by widget refactoring #2040.
https://fedorahosted.org/freeipa/ticket/2040
Diffstat (limited to 'install/ui/association.js')
-rw-r--r-- | install/ui/association.js | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/install/ui/association.js b/install/ui/association.js index 9d7950dc..708b2372 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -305,6 +305,8 @@ IPA.association_table_widget = function (spec) { that.adder_columns = $.ordered_map(); + that.needs_refresh = IPA.observer(); + that.get_adder_column = function(name) { return that.adder_columns.get(name); }; @@ -644,24 +646,7 @@ IPA.association_table_widget = function (spec) { that.refresh = function() { - function on_success(data, text_status, xhr) { - that.load(data.result.result); - } - - function on_error(xhr, text_status, error_thrown) { - var summary = $('span[name=summary]', that.tfoot).empty(); - summary.append(error_thrown.name+': '+error_thrown.message); - } - - var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - IPA.command({ - entity: that.entity.name, - method: 'show', - args: [pkey], - options: { all: true, rights: true }, - on_success: on_success, - on_error: on_error - }).execute(); + that.needs_refresh.notify([], that); }; /*initialization code*/ @@ -687,6 +672,45 @@ IPA.association_table_widget = function (spec) { return that; }; +IPA.association_table_field = function (spec) { + + spec = spec || {}; + + var that = IPA.field(spec); + + that.refresh = function() { + + function on_success(data, text_status, xhr) { + that.load(data.result.result); + } + + function on_error(xhr, text_status, error_thrown) { + that.widget.summary.text(error_thrown.name+': '+error_thrown.message); + } + + var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); + IPA.command({ + entity: that.entity.name, + method: 'show', + args: [pkey], + options: { all: true, rights: true }, + on_success: on_success, + on_error: on_error + }).execute(); + }; + + that.widgets_created = function() { + + that.field_widgets_created(); + that.widget.needs_refresh.attach(that.refresh); + }; + + return that; +}; + +IPA.widget_factories['association_table'] = IPA.association_table_widget; +IPA.field_factories['association_table'] = IPA.association_table_field; + IPA.association_facet = function (spec) { |