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

Adam Young ayoung at redhat.com
Wed Apr 20 16:50:19 UTC 2011


On 04/20/2011 12:28 PM, Endi Sukma Dewata wrote:
> 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?
Absolutely.  I think that the check should be something like:
that.start_entities = function(){
...
   for (name in that.entity_factories){
if (!metadata.objects[name])  continue;
...

}

and then the tab gets dropped later if the entity doesn't exist.


>
> 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.
"You don't need it now"  lets avoid introducing it for as long as 
possible.  The namespaces are not likely to  be needed for most 
entities.  They are really the exception, not the rule.

>
> 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>

Interesting approach.  I'd rather not do that right now, though.

>
> 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;
>




More information about the Freeipa-devel mailing list