Before 2.6.8 when a user opens a Weave client all of the entities that are registered with Weave are sent to the browser but if you do not need all of the entities to be available in the client then individual panels and components, if they support it, would each have to be configured to refine which entities that they would display.
Weave 2.6.8 adds the concept of a “context” to Weave that will allow you to group entities, and other configuration items, and then specify that a client should only present the entities that have been assigned to that context, thereby removing the need to apply additional configuration too all of the panels/component. The panels/components can be cleaned up to remove the additional configuration that specifies which entities they should include and switch back to including all entities, since now “all entities” means the entities that were linked to the context specified by the client.
For example suppose we have three entities configured for a Weave instance
<entity:entity id='properties' label='Properties'/> <entity:entity id='trees' label='Trees'/> <entity:entity id='lights' label='Lights'/>
Prior to Weave 2.6.8 if you wanted to create two specialised editing clients, one for just editing trees and another for just editing lights, and you don’t want trees in the lights client or lights in the trees client but you do want properties in both, then you would create two separate client configuration and for certain components in the client you would have to add additional configuration to the component to tell it only to include the entities it was interested in, for example for the tree editing client the entity selector would be something like:
<client:config id='tree_edit'> <!-- other config --> <item component='weave.entitySelector'> <entity>properties</entity> <entity>trees</entity> </item> <!-- other config --> </client:config>
and in the light editing client it would be configured something like:
<client:config id='light_edit'> <!-- other config --> <item component='weave.entitySelector'> <entity>properties</entity> <entity>lights</entity> </item> <!-- other config --> </client:config>
this would have to be done for every other component in the client that needed to only show a subset of the available entities, and this is with only three entities, it can quickly get out of hand if there are dozens or hundreds of entities.
Note that if the entitySelector component configuration did not include the list of entity sub-tags then both clients would display all three entities.
As of Weave 2.6.8 you would first assign the entities to the appropriate contexts, in our example we’ll create two contexts, “tree” and “light”. We do this by adding a “context” attribute to the entities, e.g.
<entity:entity id='properties' label='Properties'/> <entity:entity id='trees' label='Trees' context='tree'/> <entity:entity id='lights' label='Lights' context='light'/>
Then the client configuration would be updated to reference the context that should use, so the tree editing client would be changed to something like:
<client:config id='tree_edit' context='tree'> <!-- other config --> <item component='weave.entitySelector'/> <!-- other config --> </client:config>
and the light editing client:
<client:config id='tree_edit' context='light'> <!-- other config --> <item component='weave.entitySelector'/> <!-- other config --> </client:config>
Now the clients will only be provided a subset of the available entities, those associated with the context set for the client, plus those entities that are not associated with a context at all, and none of the panels or components in the client would need to be configured to refine the entities that they should present to the user, they can just display all of the available entities since that list now contains just the entities that the client requires.