From 5fc064f13e44812042a617a322bcd6111d2b39b2 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 7 Nov 2011 14:21:45 -0600 Subject: 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 --- install/ui/field.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'install/ui/field.js') diff --git a/install/ui/field.js b/install/ui/field.js index 381f2360..18a52c9b 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -29,7 +29,7 @@ IPA.field = function(spec) { var that = {}; - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.container = null; that.name = spec.name; that.label = spec.label; @@ -532,7 +532,7 @@ IPA.link_field = function(spec) { var that = IPA.field(spec); - var other_entity = spec.other_entity; + that.other_entity = IPA.get_entity(spec.other_entity); function other_pkeys () { return that.entity.get_primary_key(); @@ -542,7 +542,7 @@ IPA.link_field = function(spec) { that.on_link_clicked = function() { IPA.nav.show_entity_page( - IPA.get_entity(other_entity), + that.other_entity, 'default', that.other_pkeys()); }; @@ -556,7 +556,7 @@ IPA.link_field = function(spec) { that.check_entity_link = function() { IPA.command({ - entity: other_entity, + entity: that.other_entity.name, method: 'show', args: that.other_pkeys(), options: {}, -- cgit