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/aci.js | 14 ++-- install/ui/association.js | 123 +++++++++++++++++---------------- install/ui/automount.js | 8 +-- install/ui/details.js | 2 +- install/ui/dialog.js | 2 +- install/ui/entity.js | 9 ++- install/ui/facet.js | 23 +++--- install/ui/field.js | 8 +-- install/ui/hbactest.js | 20 +++--- install/ui/host.js | 2 +- install/ui/ipa.js | 6 +- install/ui/rule.js | 8 +-- install/ui/search.js | 10 ++- install/ui/sudo.js | 2 +- install/ui/test/aci_tests.html | 1 - install/ui/test/aci_tests.js | 4 +- install/ui/test/association_tests.html | 1 + install/ui/test/association_tests.js | 22 +++--- install/ui/test/details_tests.html | 1 - install/ui/test/ipa_tests.html | 1 - install/ui/test/ordered_map_tests.html | 1 - install/ui/test/widget_tests.html | 5 +- install/ui/test/widget_tests.js | 18 +++-- install/ui/widget.js | 20 +++--- 24 files changed, 157 insertions(+), 154 deletions(-) diff --git a/install/ui/aci.js b/install/ui/aci.js index c1f1ce9cc..2176dc310 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -353,6 +353,8 @@ IPA.aci.delegation_entity = function(spec) { var that = IPA.entity(spec); + that.group_entity = IPA.get_entity(spec.group_entity || 'group'); + that.init = function() { that.entity_init(); @@ -370,13 +372,13 @@ IPA.aci.delegation_entity = function(spec) { { type: 'entity_select', name: 'group', - other_entity: 'group', + other_entity: that.group_entity, other_field: 'cn' }, { type: 'entity_select', name: 'memberof', - other_entity: 'group', + other_entity: that.group_entity, other_field: 'cn', join: true }, @@ -397,13 +399,13 @@ IPA.aci.delegation_entity = function(spec) { { type: 'entity_select', name: 'group', - other_entity: 'group', + other_entity: that.group_entity, other_field: 'cn' }, { type: 'entity_select', name: 'memberof', - other_entity: 'group', + other_entity: that.group_entity, other_field: 'cn', join: true }, @@ -591,6 +593,8 @@ IPA.permission_target_widget = function(spec) { var that = factory(spec); + that.group_entity = IPA.get_entity(spec.group_entity || 'group'); + that.targets = [ 'filter', 'subtree', 'targetgroup', 'type' ]; that.target = that.targets[0]; that.show_target = spec.show_target; @@ -638,7 +642,7 @@ IPA.permission_target_widget = function(spec) { that.group_select = IPA.entity_select_widget({ entity: that.entity, name: 'targetgroup', - other_entity: 'group', + other_entity: that.group_entity, other_field: 'cn', hidden: true }); diff --git a/install/ui/association.js b/install/ui/association.js index 553e2bce1..ed274eb44 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -30,10 +30,10 @@ IPA.associator = function (spec) { var that = {}; - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.pkey = spec.pkey; - that.other_entity = spec.other_entity; + that.other_entity = IPA.get_entity(spec.other_entity); that.values = spec.values; that.method = spec.method; @@ -77,7 +77,7 @@ IPA.serial_associator = function(spec) { options[that.entity.name] = that.pkey; command = IPA.command({ - entity: that.other_entity, + entity: that.other_entity.name, method: that.method, args: args, options: options @@ -122,7 +122,7 @@ IPA.bulk_associator = function(spec) { var args = [that.pkey]; var options = { 'all': true }; - options[that.other_entity] = value; + options[that.other_entity.name] = value; var command = IPA.command({ entity: that.entity.name, @@ -150,19 +150,21 @@ IPA.association_adder_dialog = function(spec) { var that = IPA.adder_dialog(spec); - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.pkey = spec.pkey; - that.other_entity = spec.other_entity; + + that.other_entity = IPA.get_entity(spec.other_entity); that.attribute_member = spec.attribute_member; + that.exclude = spec.exclude || []; var init = function() { if (!that.get_columns().length) { - var pkey_name = IPA.metadata.objects[spec.other_entity].primary_key; + var pkey_name = that.other_entity.metadata.primary_key; that.create_column({ entity: that.entity, name: pkey_name, - label: IPA.metadata.objects[spec.other_entity].label, + label: that.other_entity.metadata.label, primary_key: true, width: '600px' }); @@ -174,13 +176,12 @@ IPA.association_adder_dialog = function(spec) { that.clear_available_values(); - var other_entity = IPA.get_entity(that.other_entity); - var pkey_attr = other_entity.metadata.primary_key; + var pkey_attr = that.other_entity.metadata.primary_key; var selected = that.get_selected_values(); var results = data.result; - var same_entity = that.entity.name === other_entity.name; + var same_entity = that.entity === that.other_entity; for (var i=0; i', { @@ -880,9 +881,9 @@ IPA.association_facet = function (spec) { that.get_attribute_name = function() { if (that.association_type == 'direct') { - return that.attribute_member+'_'+that.other_entity; + return that.attribute_member+'_'+that.other_entity.name; } else { - return that.indirect_attribute_member+'_'+that.other_entity; + return that.indirect_attribute_member+'_'+that.other_entity.name; } }; @@ -895,13 +896,14 @@ IPA.association_facet = function (spec) { that.show_add_dialog = function() { + var entity_label = that.entity.metadata.label_singular; var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); - var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; + var other_entity_label = that.other_entity.metadata.label; var title = that.add_title; - title = title.replace('${entity}', that.entity.metadata.label_singular); + title = title.replace('${entity}', entity_label); title = title.replace('${primary_key}', pkey); - title = title.replace('${other_entity}', label); + title = title.replace('${other_entity}', other_entity_label); var pkeys = that.data.result.result[that.get_attribute_name()]; @@ -924,16 +926,16 @@ IPA.association_facet = function (spec) { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); var associator = that.associator({ - 'entity': that.entity, - 'pkey': pkey, - 'other_entity': that.other_entity, - 'values': dialog.get_selected_values(), - 'method': that.add_method, - 'on_success': function() { + entity: that.entity, + pkey: pkey, + other_entity: that.other_entity, + values: dialog.get_selected_values(), + method: that.add_method, + on_success: function() { that.refresh(); dialog.close(); }, - 'on_error': function() { + on_error: function() { that.refresh(); dialog.close(); } @@ -947,7 +949,6 @@ IPA.association_facet = function (spec) { that.show_remove_dialog = function() { - var label = IPA.metadata.objects[that.other_entity] ? IPA.metadata.objects[that.other_entity].label : that.other_entity; var values = that.table.get_selected_values(); if (!values.length) { @@ -956,12 +957,14 @@ IPA.association_facet = function (spec) { return; } + var entity_label = that.entity.metadata.label_singular; var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); + var other_entity_label = that.other_entity.metadata.label; var title = that.remove_title; - title = title.replace('${entity}', that.entity.metadata.label_singular); + title = title.replace('${entity}', entity_label); title = title.replace('${primary_key}', pkey); - title = title.replace('${other_entity}', label); + title = title.replace('${other_entity}', other_entity_label); var dialog = IPA.association_deleter_dialog({ title: title, @@ -1042,7 +1045,7 @@ IPA.association_facet = function (spec) { var pkey = IPA.nav.get_state(that.entity.name+'-pkey'); if (that.pkey !== pkey) return true; - var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1; + var page = parseInt(IPA.nav.get_state(that.entity.name+'-page'), 10) || 1; if (that.table.current_page !== page) return true; return false; diff --git a/install/ui/automount.js b/install/ui/automount.js index 6c0f64ff9..3deb66129 100644 --- a/install/ui/automount.js +++ b/install/ui/automount.js @@ -245,10 +245,10 @@ IPA.automount_key_column = function(spec) { href: '#'+key, text: key, click: function() { - var state = IPA.nav.get_path_state(that.entity_name); - state[that.entity_name + '-facet'] = 'default'; - state[that.entity_name + '-info'] = info; - state[that.entity_name + '-pkey'] = key; + var state = IPA.nav.get_path_state(that.entity.name); + state[that.entity.name + '-facet'] = 'default'; + state[that.entity.name + '-info'] = info; + state[that.entity.name + '-pkey'] = key; IPA.nav.push_state(state); return false; } diff --git a/install/ui/details.js b/install/ui/details.js index 3e2a15bd5..c201dad5d 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -234,7 +234,7 @@ IPA.details_facet = function(spec) { var that = IPA.facet(spec); - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.update_command_name = spec.update_command_name || 'mod'; that.command_mode = spec.command_mode || 'save'; // [save, info] diff --git a/install/ui/dialog.js b/install/ui/dialog.js index 8128452df..e6e6e1cd2 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -59,7 +59,7 @@ IPA.dialog = function(spec) { var that = {}; - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.name = spec.name; that.id = spec.id; that.title = spec.title; diff --git a/install/ui/entity.js b/install/ui/entity.js index a701009a3..acfc9c440 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -72,8 +72,7 @@ IPA.entity = function(spec) { }; that.get_containing_entity = function() { - return that.containing_entity ? - IPA.get_entity(that.containing_entity) : null; + return that.containing_entity; }; that.get_dialog = function(name) { @@ -93,7 +92,7 @@ IPA.entity = function(spec) { }; that.dialog = function(dialog) { - dialog.entity_name = that.name; + dialog.entity = that; that.dialogs.put(dialog.name, dialog); return that; }; @@ -143,7 +142,6 @@ IPA.entity = function(spec) { }; that.add_facet = function(facet) { - facet.entity_name = that.name; facet.entity = that; that.facets.put(facet.name, facet); @@ -321,6 +319,7 @@ IPA.entity_builder = function() { } else { spec = { name: spec }; } + spec.builder = that; entity = factory(spec); @@ -495,7 +494,7 @@ IPA.entity_builder = function() { that.containing_entity = function(entity_name) { add_redirect_info(); - entity.containing_entity = entity_name; + entity.containing_entity = IPA.get_entity(entity_name); return that; }; diff --git a/install/ui/facet.js b/install/ui/facet.js index 5f658c141..f0dbc1d42 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -31,7 +31,7 @@ IPA.facet = function(spec) { var that = {}; - that.entity = spec.entity; + that.entity = IPA.get_entity(spec.entity); that.name = spec.name; that.label = spec.label; @@ -43,7 +43,6 @@ IPA.facet = function(spec) { that.header = spec.header || IPA.facet_header({ facet: that }); - that.entity_name = spec.entity_name; that._needs_update = spec.needs_update; that.dialogs = $.ordered_map(); @@ -407,7 +406,7 @@ IPA.table_facet = function(spec) { var that = IPA.facet(spec); - that.managed_entity_name = spec.managed_entity_name || that.entity.name; + that.managed_entity = spec.managed_entity ? IPA.get_entity(spec.managed_entity) : that.entity; that.pagination = spec.pagination === undefined ? true : spec.pagination; that.search_all = spec.search_all; @@ -431,7 +430,7 @@ IPA.table_facet = function(spec) { }; that.add_column = function(column) { - column.entity_name = that.managed_entity_name; + column.entity = that.managed_entity; that.columns.put(column.name, column); }; @@ -444,7 +443,7 @@ IPA.table_facet = function(spec) { spec = { name: spec }; } - spec.entity_name = that.managed_entity_name; + spec.entity = that.managed_entity; column = factory(spec); that.add_column(column); @@ -523,13 +522,13 @@ IPA.table_facet = function(spec) { delete that.table.current_page; var state = {}; - var page = parseInt(IPA.nav.get_state(that.entity_name+'-page'), 10) || 1; + var page = parseInt(IPA.nav.get_state(that.entity.name+'-page'), 10) || 1; if (page < 1) { - state[that.entity_name+'-page'] = 1; + state[that.entity.name+'-page'] = 1; IPA.nav.push_state(state); return; } else if (page > that.table.total_pages) { - state[that.entity_name+'-page'] = that.table.total_pages; + state[that.entity.name+'-page'] = that.table.total_pages; IPA.nav.push_state(state); return; } @@ -597,7 +596,7 @@ IPA.table_facet = function(spec) { }; that.get_records_command_name = function() { - return that.managed_entity_name+'_get_records'; + return that.managed_entity.name+'_get_records'; }; that.get_records = function(on_success, on_error) { @@ -682,7 +681,7 @@ IPA.table_facet = function(spec) { that.table.prev_page = function() { if (that.table.current_page > 1) { var state = {}; - state[that.entity_name+'-page'] = that.table.current_page - 1; + state[that.entity.name+'-page'] = that.table.current_page - 1; IPA.nav.push_state(state); } }; @@ -690,7 +689,7 @@ IPA.table_facet = function(spec) { that.table.next_page = function() { if (that.table.current_page < that.table.total_pages) { var state = {}; - state[that.entity_name+'-page'] = that.table.current_page + 1; + state[that.entity.name+'-page'] = that.table.current_page + 1; IPA.nav.push_state(state); } }; @@ -702,7 +701,7 @@ IPA.table_facet = function(spec) { page = that.total_pages; } var state = {}; - state[that.entity_name+'-page'] = page; + state[that.entity.name+'-page'] = page; IPA.nav.push_state(state); }; }; diff --git a/install/ui/field.js b/install/ui/field.js index 381f2360e..18a52c9b6 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: {}, diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js index e5c59316f..26aed6e00 100644 --- a/install/ui/hbactest.js +++ b/install/ui/hbactest.js @@ -40,7 +40,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_select_facet, name: 'user', label: IPA.messages.objects.hbacrule.user, - managed_entity_name: 'user', + managed_entity: 'user', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -53,7 +53,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_select_facet, name: 'targethost', label: IPA.messages.objects.hbacrule.host, - managed_entity_name: 'host', + managed_entity: 'host', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -70,7 +70,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_select_facet, name: 'service', label: IPA.messages.objects.hbacrule.service, - managed_entity_name: 'hbacsvc', + managed_entity: 'hbacsvc', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -82,7 +82,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_select_facet, name: 'sourcehost', label: IPA.messages.objects.hbacrule.sourcehost, - managed_entity_name: 'host', + managed_entity: 'host', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -99,7 +99,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_rules_facet, name: 'rules', label: IPA.messages.objects.hbactest.rules, - managed_entity_name: 'hbacrule', + managed_entity: 'hbacrule', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -115,7 +115,7 @@ IPA.hbac.test_entity = function(spec) { factory: IPA.hbac.test_run_facet, name: 'run_test', label: IPA.messages.objects.hbactest.run_test, - managed_entity_name: 'hbacrule', + managed_entity: 'hbacrule', disable_breadcrumb: true, facet_group: 'default', columns: [ @@ -145,13 +145,13 @@ IPA.hbac.test_facet = function(spec) { var init = function() { - that.managed_entity = IPA.get_entity(that.managed_entity_name); + that.managed_entity = IPA.get_entity(that.managed_entity); var columns = that.columns.values; for (var i=0; i - diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js index 8f8e8b571..e166aa3dc 100644 --- a/install/ui/test/aci_tests.js +++ b/install/ui/test/aci_tests.js @@ -22,7 +22,8 @@ var target_container; var target_widget; var target_facet; -var entity = IPA.entity({ name:'bogus', metadata: {} }); +var entity = IPA.entity({ name: 'bogus' }); +var group_entity = IPA.entity({ name: 'group' }); module('aci', { setup: function() { @@ -74,6 +75,7 @@ module('aci', { { type: 'permission_target', container_factory: IPA.details_table_section, + group_entity: group_entity, name: 'target', label: 'Target', show_target: false diff --git a/install/ui/test/association_tests.html b/install/ui/test/association_tests.html index a25e417af..716efd31d 100644 --- a/install/ui/test/association_tests.html +++ b/install/ui/test/association_tests.html @@ -13,6 +13,7 @@ + diff --git a/install/ui/test/association_tests.js b/install/ui/test/association_tests.js index ac5175347..547ca9f8b 100644 --- a/install/ui/test/association_tests.js +++ b/install/ui/test/association_tests.js @@ -27,11 +27,14 @@ test("Testing serial_associator().", function() { var orig_ipa_batch_command = IPA.batch_command; + var user = IPA.entity({ name: 'user' }); + var group = IPA.entity({ name: 'group' }); + var params = { method: 'add_member', pkey: 'test', - entity: {name:'user'}, - other_entity: 'group' + entity: user, + other_entity: group }; params.values = ['user1', 'user2', 'user3']; @@ -50,7 +53,7 @@ test("Testing serial_associator().", function() { command = that.commands[i]; equals( - command.entity, params.other_entity, + command.entity, params.other_entity.name, 'Checking IPA.command() parameter: entity'); equals( @@ -86,11 +89,14 @@ test("Testing bulk_associator().", function() { var counter = 0; + var user = IPA.entity({ name: 'user' }); + var group = IPA.entity({ name: 'group' }); + var params = { - method: "add_member", - pkey: "test", - entity: {name:"user"}, - other_entity: "group" + method: 'add_member', + pkey: 'test', + entity: user, + other_entity: group }; params.values = ['user1', 'user2', 'user3']; @@ -111,7 +117,7 @@ test("Testing bulk_associator().", function() { 'Checking IPA.command() parameter: primary key'); equals( - that.options[params.other_entity], 'user1,user2,user3', + that.options[params.other_entity.name], 'user1,user2,user3', 'Checking IPA.command() parameter: options[\""+params.other_entity+"\"]'); that.on_success({}); diff --git a/install/ui/test/details_tests.html b/install/ui/test/details_tests.html index e95a573ed..d8232cd72 100644 --- a/install/ui/test/details_tests.html +++ b/install/ui/test/details_tests.html @@ -15,7 +15,6 @@ - diff --git a/install/ui/test/ipa_tests.html b/install/ui/test/ipa_tests.html index cd8b5733b..56f28b34d 100644 --- a/install/ui/test/ipa_tests.html +++ b/install/ui/test/ipa_tests.html @@ -4,7 +4,6 @@ Core Test Suite - diff --git a/install/ui/test/ordered_map_tests.html b/install/ui/test/ordered_map_tests.html index dda669348..77f955c1f 100755 --- a/install/ui/test/ordered_map_tests.html +++ b/install/ui/test/ordered_map_tests.html @@ -4,7 +4,6 @@ Ordered Map Test Suite - diff --git a/install/ui/test/widget_tests.html b/install/ui/test/widget_tests.html index e504f6133..219608be1 100755 --- a/install/ui/test/widget_tests.html +++ b/install/ui/test/widget_tests.html @@ -4,16 +4,13 @@ Widget Test Suite - - - - + diff --git a/install/ui/test/widget_tests.js b/install/ui/test/widget_tests.js index d9992e225..7dce99243 100644 --- a/install/ui/test/widget_tests.js +++ b/install/ui/test/widget_tests.js @@ -55,7 +55,6 @@ function base_widget_test(value){ widget = factory(spec); - var entity_name = 'user'; var field_name = widget.name; ok (widget, "Created Widget"); @@ -151,16 +150,14 @@ test("IPA.table_widget" ,function(){ name:'uid', label:'User ID', primary_key:'uid', - width:'20em', - entity_name:'user' + width:'20em' })); widget.add_column(IPA.column({ entity: spec.entity, name:'title', lable:'Title', primary_key:'uid', - width:'20em', - entity_name:'user' + width:'20em' })); ok(!widget.container,'widget has no container before create'); @@ -269,13 +266,14 @@ test("IPA.select_widget" ,function(){ }); -test("IPA.entity_select_widget" ,function(){ - factory = IPA.entity_select_widget; +test("IPA.entity_select_widget" ,function() { + var user = IPA.entity({ name: 'user' }); + factory = IPA.entity_select_widget; spec = { name: 'uid', - other_entity:'user', - field_name:'uid', - other_field: 'uid' }; + other_entity: user, + other_field: 'uid' + }; base_widget_test('test_value'); var mock_record = { uid: ['kfrog']}; 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] }); -- cgit