diff options
author | Adam Young <ayoung@redhat.com> | 2011-01-19 21:10:18 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-01-27 16:46:44 -0500 |
commit | f904df0f0dfd4734f978cdc3ddf5badabc067ed6 (patch) | |
tree | a9da10718ae2982b0f8721cdf7df4bad05532f93 /install/ui/entity.js | |
parent | 442d6ad30ce1156914e6245aa7502499e50ec0da (diff) | |
download | freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.tar.gz freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.tar.xz freeipa-f904df0f0dfd4734f978cdc3ddf5badabc067ed6.zip |
declarative defintions
Delay the creation of entities until after ipa init is called
made the user and group entity definitions declarative
removed unused facet from groups
adjusted unit tests
made review changes:
factories are now in an associative array
entity init called right after factory
init dialogs in entity init
fixed type on search
Diffstat (limited to 'install/ui/entity.js')
-rw-r--r-- | install/ui/entity.js | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/install/ui/entity.js b/install/ui/entity.js index c5c423dba..8d39b8e79 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -110,8 +110,17 @@ IPA.entity = function (spec) { dialog.entity_name = that.name; that.dialogs.push(dialog); that.dialogs_by_name[dialog.name] = dialog; + return that; }; + function init_dialogs (){ + var i; + for (i = 0; i < that.dialogs.length; i += 1){ + that.dialogs[i].init(); + } + return that; + } + that.get_facet = function(name) { return that.facets_by_name[name]; }; @@ -120,6 +129,14 @@ IPA.entity = function (spec) { facet.entity_name = that.name; that.facets.push(facet); that.facets_by_name[facet.name] = facet; + return that; + }; + + that.facet = function(facet) { + facet.entity_name = that.name; + that.facets.push(facet); + that.facets_by_name[facet.name] = facet; + return that; }; that.get_associations = function() { @@ -141,6 +158,13 @@ IPA.entity = function (spec) { return config; }; + that.association = function(spec) { + var config = IPA.association_config(spec); + that.add_association(config); + return that; + }; + + that.create_association_facet = function(attribute_member, other_entity, label, facet_group) { if (!attribute_member) { @@ -190,8 +214,12 @@ IPA.entity = function (spec) { that.add_facet(facet); } } + return that; }; + that.standard_associations = that.create_association_facets; + + that.init = function() { if (!that.label) { @@ -206,6 +234,7 @@ IPA.entity = function (spec) { var facet = that.facets[i]; facet.init(); } + init_dialogs(); }; that.entity_init = that.init; @@ -221,6 +250,7 @@ var window_hash_cache = {}; IPA.fetch_entity = function (entity_name) { var entity = IPA.get_entity(entity_name); +/* if (entity) return entity; entity = IPA.entity({ @@ -228,6 +258,7 @@ IPA.fetch_entity = function (entity_name) { }); IPA.add_entity(entity); +*/ return entity; }; @@ -264,30 +295,6 @@ IPA.entity_set_search_definition = function (entity_name, data) { }; -IPA.entity_set_add_definition = function (entity_name, data) { - - var entity = IPA.fetch_entity(entity_name); - - var dialog = IPA.add_dialog({ - 'name': 'add', - 'title': data[1] - }); - entity.add_dialog(dialog); - - for (var i=0; i<data[2].length; i++) { - var field = data[2][i]; - dialog.add_field(IPA.text_widget({ - name: field[0], - label: field[1], - setup: field[2], - undo: false - })); - } - - dialog.init(); -}; - - IPA.entity_get_add_dialog = function (entity_name) { var entity = IPA.fetch_entity(entity_name); |