diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-11-13 15:49:25 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-04-03 12:40:37 +0200 |
commit | 0d05a50e19b71cade636d9ca4882e453f614a78c (patch) | |
tree | 8b7fee3645c6c08f0a90be334ecd11543a6c2f91 /install/ui/src/freeipa/details.js | |
parent | 66fb4d5e849a049e95d3ef4fcf2b86217488634d (diff) | |
download | freeipa-0d05a50e19b71cade636d9ca4882e453f614a78c.tar.gz freeipa-0d05a50e19b71cade636d9ca4882e453f614a78c.tar.xz freeipa-0d05a50e19b71cade636d9ca4882e453f614a78c.zip |
webui: field and widget binding refactoring
This is a Web UI wide change. Fields and Widgets binding was refactored
to enable proper two-way binding between them. This should allow to have
one source of truth (field) for multiple consumers - widgets or something
else. One of the goal is to have fields and widget implementations
independent on each other. So that one could use a widget without field
or use one field for multiple widgets, etc..
Basically a fields logic was split into separate components:
- adapters
- parsers & formatters
- binder
Adapters
- extract data from data source (FreeIPA RPC command result)
- prepares them for commands.
Parsers
- parse extracted data to format expected by field
- parse widget value to format expected by field
Formatters
- format field value to format suitable for widgets
- format field value to format suitable for adapter
Binder
- is a communication bridge between field and widget
- listens to field's and widget's events and call appropriate methods
Some side benefits:
- better validation reporting in multivalued widget
Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/details.js')
-rw-r--r-- | install/ui/src/freeipa/details.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index 8b3eddb1f..279b76a1a 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -591,6 +591,15 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) { that.dirty_changed = IPA.observer(); /** + * Get field + * @param {string} name Field name + * @returns {IPA.field} + */ + that.get_field = function(name) { + return that.fields.get_field(name); + }; + + /** * @inheritDoc */ that.create = function(container) { @@ -685,7 +694,7 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) { that.is_dirty = function() { var fields = that.fields.get_fields(); for (var i=0; i<fields.length; i++) { - if (fields[i].enabled && fields[i].is_dirty()) { + if (fields[i].enabled && fields[i].dirty) { return true; } } @@ -741,7 +750,7 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) { for (var i=0; i<fields.length; i++) { var field = fields[i]; - if (!field.enabled || only_dirty && !field.is_dirty()) continue; + if (!field.enabled || only_dirty && !field.dirty) continue; var values = field.save(); if (require_value && !values) continue; |