diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-11-02 14:07:07 -0500 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2011-11-04 16:51:54 +0100 |
commit | 8ca348b99e350862418ac2fe0addfb0e354ea57e (patch) | |
tree | 0b91d8548037f5e10b6c491d7c1b969ce7a1ba57 /install/ui/ipa.js | |
parent | 5db9fed8a5c62a65adf43f1d8c24a0e061f6b301 (diff) | |
download | freeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.tar.gz freeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.tar.xz freeipa-8ca348b99e350862418ac2fe0addfb0e354ea57e.zip |
Added extensible UI framework.
The entity definitions have been converted into classes. The entity
init() method will use the builder to construct the facets and dialogs.
The UI can be customized by creating a subclass of the original entity
in extension.js and then overriding the init() method.
Ticket #2043
Diffstat (limited to 'install/ui/ipa.js')
-rw-r--r-- | install/ui/ipa.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 0ce783dbc..c0aa98b98 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -25,7 +25,7 @@ /* REQUIRES: jquery.ordered-map.js */ /*global $:true, location:true */ -var IPA = ( function () { +var IPA = function() { var that = { jsonrpc_id: 0 @@ -172,22 +172,37 @@ var IPA = ( function () { batch.execute(); }; + that.register = function(name, factory) { + that.entity_factories[name] = factory; + }; + that.get_entities = function() { return that.entities.values; }; - - that.get_entity = function(name) { var entity = that.entities.get(name); - if (!entity){ + if (!entity) { var factory = that.entity_factories[name]; - if (!factory){ + if (!factory) { return null; } + try { - entity = factory(); + var builder = that.entity_builder(); + + builder.entity({ + factory: factory, + name: name + }); + + entity = builder.build(); + entity.init({ + builder: builder + }); + that.add_entity(entity); + } catch (e) { if (e.expected){ /*expected exceptions thrown by builder just mean that @@ -256,7 +271,7 @@ var IPA = ( function () { }; return that; -}()); +}(); /** * Call an IPA command over JSON-RPC. |