diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-11-07 14:21:45 -0600 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2011-12-21 14:59:49 +0100 |
commit | 5fc064f13e44812042a617a322bcd6111d2b39b2 (patch) | |
tree | f89503069c5d4eabbb940aff34b9733607ce93d2 /install/ui/widget.js | |
parent | 49e5555b11d0bee814bce807acacbfeb381379f1 (diff) | |
download | freeipa-5fc064f13e44812042a617a322bcd6111d2b39b2.tar.gz freeipa-5fc064f13e44812042a617a322bcd6111d2b39b2.tar.xz freeipa-5fc064f13e44812042a617a322bcd6111d2b39b2.zip |
Refactored entity object resolution.
The IPA.get_entity() has been modified to accept either entity name
or entity object. If it receives an entity object it will return
the object itself. Otherwise, it will resolve the name in the entity
registry.
The other_entity variables have been modified to store a reference
to the entity object instead of its name. The test cases have been
modified to use real entity objects instead of just the names.
Ticket #2042
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r-- | install/ui/widget.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js index 29c133c0a..43910d6e6 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -36,7 +36,7 @@ IPA.widget = function(spec) { that.id = spec.id; that.label = spec.label; that.tooltip = spec.tooltip; - that.entity = spec.entity; //some old widgets still need it + that.entity = IPA.get_entity(spec.entity); //some old widgets still need it that.create = function(container) { container.addClass('widget'); @@ -932,20 +932,20 @@ IPA.column = function (spec) { var that = {}; + that.entity = IPA.get_entity(spec.entity); that.name = spec.name; + that.label = spec.label; that.width = spec.width; - that.entity_name = spec.entity ? spec.entity.name : spec.entity_name; that.primary_key = spec.primary_key; that.link = spec.link; that.format = spec.format; - if (!that.entity_name){ - var except = { + if (!that.entity) { + throw { expected: false, - message:'Column created without an entity_name.' + message: 'Column created without an entity.' }; - throw except; } that.setup = function(container, record, suppress_link) { @@ -978,8 +978,8 @@ IPA.column = function (spec) { /*column initialization*/ - if (that.entity_name && !that.label) { - var metadata = IPA.get_entity_param(that.entity_name, that.name); + if (that.entity && !that.label) { + var metadata = IPA.get_entity_param(that.entity.name, that.name); if (metadata) { that.label = metadata.label; } @@ -1726,14 +1726,14 @@ IPA.entity_select_widget = function(spec) { var that = IPA.combobox_widget(spec); - that.other_entity = spec.other_entity; + that.other_entity = IPA.get_entity(spec.other_entity); that.other_field = spec.other_field; that.options = spec.options || []; that.create_search_command = function(filter) { return IPA.command({ - entity: that.other_entity, + entity: that.other_entity.name, method: 'find', args: [filter] }); |