diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-03-22 17:31:48 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2012-03-29 13:39:53 +0200 |
commit | 18a6ab356a159a88c5aab014f344eb14a9d38c81 (patch) | |
tree | 2bfa238383478b44615542e508b776065366a13e /install/ui/dns.js | |
parent | bbe672a2aea1651a4a0eeca20b8339f0799f3431 (diff) | |
download | freeipa-18a6ab356a159a88c5aab014f344eb14a9d38c81.tar.gz freeipa-18a6ab356a159a88c5aab014f344eb14a9d38c81.tar.xz freeipa-18a6ab356a159a88c5aab014f344eb14a9d38c81.zip |
Inter-facet expiration
Problem:
When some facet perform action which modifies data, some other facet may become expired.
Example: User modifies group's description. Now group search facet contains old data and has to be refreshed.
Solution:
New event was added to facet: on_update. It should be executed when facet performs action which modifies data ie: details facet update or add entry to dnsrecord.
Then entity policies were introduced. Entity policies are a objects which are stored in entity.policies. They have similar function as facet_policies - performing communications and other functionality between facets. This way facets don't have to contain such logic and thus they aren't dependant on each other.
This patch adds IPA.facet_update_policy, IPA.adder_facet_update_policy, IPA.search_facet_update_policy, IPA.details_facet_update_policy.
IPA.facet_update_policy: On facets_created it bind itself to [current entity].[source facet].[event]. Default event is on_update. When the event is executed it sets expiration flag to [dest entity].[dest facet].
IPA.search_facet_update_policy: IPA.facet_update_policy where source facet = search, dest facet = details, dest entity = current entity. Its a default policy for updatein changes from search facet to details facet. Right now it isn't needed but it will be needed when action lists come to play.
IPA.details_facet_update_policy: same as IPA.search_facet_update_policy just reversed. Very important.
IPA.adder_facet_update_policy: similar functionality, just source of the event is dialog. Default event is added (new event in entity_adder_dialog).
Entity policies should be specified in entity's spec object. If none are specified a default ones are used. Default policies are: IPA.search_facet_update_policy and IPA.details_facet_update_policy.
https://fedorahosted.org/freeipa/ticket/2075
Diffstat (limited to 'install/ui/dns.js')
-rw-r--r-- | install/ui/dns.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/install/ui/dns.js b/install/ui/dns.js index 33b21e4cf..6a684b9ea 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -262,6 +262,7 @@ IPA.dnszone_details_facet = function(spec) { that.update_on_success = function(data, text_status, xhr) { that.refresh(); + that.on_update.notify(); }; that.update_on_error = function(xhr, text_status, error_thrown) { @@ -914,6 +915,17 @@ IPA.dns.get_record_type = function(type_name) { IPA.dns.record_entity = function(spec) { + spec = spec || {}; + + spec.policies = spec.policies || [ + IPA.facet_update_policy({ + source_facet: 'details', + dest_entity: 'dnszone', + dest_facet: 'records' + }), + IPA.adder_facet_update_policy() + ]; + var that = IPA.entity(spec); that.init = function() { @@ -1599,6 +1611,7 @@ IPA.dns.record_type_table_widget = function(spec) { function(data) { that.reload_facet(data); dialog.close(); + that.notify_facet_update(); }, function() { that.refresh_facet(); @@ -1670,6 +1683,7 @@ IPA.dns.record_type_table_widget = function(spec) { that.refresh_facet(); } dialog.close(); + that.notify_facet_update(); }, dialog.on_error); } @@ -1693,6 +1707,7 @@ IPA.dns.record_type_table_widget = function(spec) { that.refresh_facet(); } dialog.reset(); + that.notify_facet_update(); }, dialog.on_error); } @@ -1784,6 +1799,7 @@ IPA.dns.record_type_table_widget = function(spec) { command.on_success = function(data) { that.reload_facet(data); dialog.close(); + that.notify_facet_update(); }; command.on_error = function() { that.refresh_facet(); @@ -1825,6 +1841,11 @@ IPA.dns.record_type_table_widget = function(spec) { facet.refresh(); }; + that.notify_facet_update = function() { + var facet = IPA.current_entity.get_facet(); + facet.on_update.notify(); + }; + that.update = function(values) { that.idnsname = values.idnsname; |