[Freeipa-devel] [PATCH] 142 Moved entity builder registration into webui.js.

Endi Sukma Dewata edewata at redhat.com
Wed Apr 20 16:28:05 UTC 2011


On 4/20/2011 9:43 AM, Adam Young wrote:
> On 04/19/2011 06:50 PM, Endi Sukma Dewata wrote:
>> The entity builder registration have been moved into webui.js. This
>> allows the WebUI to control which entities will be loaded. For instance,
>> the entitlement should be loaded only if the plugin is enabled. This
>> is done by checking the metadata.
>>
>>
>> _______________________________________________
>> Freeipa-devel mailing list
>> Freeipa-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/freeipa-devel
> NACK.
>
> I like the concept, but the implementation is too verbose. Instead:
>
> Leave the factories as the top level object. For the factory name, say
> 'entitle' check that the object is in the metadata. If not, don't create
> the entity. Then, when processing the tabs, if the entity does not
> exist, drop the tab from the tab set. The explicit enumeration of
> entities in webui.js is not necessary, nor is putting every entity's
> factory into its own namespace.

I think it would be even better to create only the entities that are 
actually needed. So entity creation should be done after we determine 
the user and the tab set for that user. What do you think?

Creating a namespace for each entity is actually a separate but related 
issue. It's mainly needed to avoid conflicts and we have done that for 
certificates and entitlements. Sooner or later we'll create name space 
for other entities anyway.

The namespace will also improve modularity. It can be used to specify 
the default builder for that entity (e.g. IPA.user.entity_builder) 
instead of registering itself into IPA.entity_factories with a fixed 
name. This would be useful suppose one day we want to provide different 
entity implementations with the same name for different users. For example:

     IPA.user.entity_builder = <simplified UI>

     IPA.admin.user.entity_builder = <complete UI>

Both are 'user' entity, but depending on which user logs in, the web ui 
can decide which implementation to use:

     var module = <either IPA.user or IPA.admin.user>
     IPA.entity_factory[entity_name] = module.entity_builder;

-- 
Endi S. Dewata




More information about the Freeipa-devel mailing list