From 14c276d21865f70e0ff939357b52a9830d32b5ea Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 18 Apr 2013 12:38:38 +0200 Subject: Convert definitions of entities to spec objects https://fedorahosted.org/freeipa/ticket/3235 --- install/ui/src/freeipa/netgroup.js | 77 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 33 deletions(-) (limited to 'install/ui/src/freeipa/netgroup.js') diff --git a/install/ui/src/freeipa/netgroup.js b/install/ui/src/freeipa/netgroup.js index 7c7bb9b8d..776872514 100644 --- a/install/ui/src/freeipa/netgroup.js +++ b/install/ui/src/freeipa/netgroup.js @@ -18,51 +18,56 @@ * along with this program. If not, see . */ -define(['./ipa', './jquery', './details', './search', './association', - './entity'], function(IPA, $) { +define([ + './ipa', + './jquery', + './phases', + './reg', + './details', + './search', + './association', + './entity'], + function(IPA, $, phases, reg) { -IPA.netgroup = { +var exp = IPA.netgroup = { remove_method_priority: IPA.config.default_priority - 1, enable_priority: IPA.config.default_priority + 1 }; -IPA.netgroup.entity = function(spec) { - - var that = IPA.entity(spec); - - that.init = function() { - that.entity_init(); - - that.builder.facet_groups(['settings', 'member', 'memberof']). - search_facet({ +var make_spec = function() { +return { + name: 'netgroup', + facet_groups: ['settings', 'member', 'memberof'], + facets: [ + { + $type: 'search', columns: [ 'cn', 'description' ] - }). - details_facet({ + }, + { + $type: 'details', $factory: IPA.netgroup.details_facet, - entity: that, command_mode: 'info' - }). - association_facet({ + }, + { + $type: 'association', name: 'memberof_netgroup', associator: IPA.serial_associator - }). - standard_association_facets(). - adder_dialog({ - fields: [ - 'cn', - { - $type: 'textarea', - name: 'description' - } - ] - }); - }; - - return that; -}; + } + ], + standard_association_facets: true, + adder_dialog: { + fields: [ + 'cn', + { + $type: 'textarea', + name: 'description' + } + ] + } +};}; IPA.netgroup.details_facet = function(spec) { @@ -302,7 +307,13 @@ IPA.netgroup.details_facet = function(spec) { return that; }; -IPA.register('netgroup', IPA.netgroup.entity); +exp.entity_spec = make_spec(); +exp.register = function() { + var e = reg.entity; + + e.register({type: 'netgroup', spec: exp.entity_spec}); +}; +phases.on('registration', exp.register); return {}; }); \ No newline at end of file -- cgit