Context-Aware Config Editor: Control Collection and Property inheritance

Description

context-aware configuration supports config resource collection inheritance, and config resource property inheritance (which can be combined with config resource collection inheritance). both are not active by default, but have to be switched on explicitely for each config collection or config.

general handling for special properties:

  • whenever a property with name sling:configCollectionInherit or sling:configPropertyInherit is found, it should not be displaye in the GUI as configuration field.

  • collection properties should not be displayed at all, the current usage is only to contain the sling:configCollectionInherit property or nothing.

property inheritance:

  • for each configuration (singleton or item of a collection) a checkbox "Enable property inheritance" should be displayed

  • it is checked when a property sling:configPropertyInherit is present, and has the value true

  • when saving the configuration: if sling:configPropertyInherit is set, put it in the list of posted config values with value true. if not set, remove it from the list of posted config values.

collection inheritance:

  • if a config collection is displayed a checkbox "Enable collection inheritance" is additionally displayed

  • it is checked when a property sling:configCollectionInherit is present, and has the value true

  • when saving the configuration collection: if sling:configCollectionInherit is set, put it in the collection properties with value true. if not set, remove it from the collection properties.

examples:

(please use the lastest snapshot of sample app & content to reproduce the usecases with the URLs)

Activity

Show:
Stefan Seifert
January 17, 2017, 11:04 PM

i do not understand fully the first of the two last comments - you cannot set property inheritance for a single property, only for the whole singleton configuration, or for each item of a configuration collection - it always affects all properties in it.
and property (and collection) inheritance is always false if the property is not set explicitly to true.

concerning the last comment: setting the inheritX property to false or removing is should have exactly the same effect - you can choose what is simpler in the frontend.

David Ding
January 18, 2017, 12:59 AM

I might be causing confusion between "property inheritance" (sling:configPropertyInherit) and "properties' inheritance" (the value of inherited for each individual property within a config).

From what I understand, for a singleton configuration, if sling:configPropertyInherit is true, the user can toggle inherited for individual properties.

If sling:configPropertyInherit is false, the inherited value for properties can by toggled by the user, but they must all be the same - i.e. all true or all false. Hence your suggestion: "perhaps when checking one checkbox check all other checkboxes"

The question I tried to ask was:

If sling:configPropertyInherit is true for a singleton config, the user can toggle the individual properties within the config. Therefore it is possible that there is a mix of inherited: true and inherited: false properties in the config.

If the config properties have such "mixed" inheritance and then the user sets sling:configPropertyInherit to false - what should happen?

It seems logical that the app should automatically check or uncheck all inherited checkboxes within the config, so that they are all the same. (Otherwise, the user could make no further changes, and save the "mix")

And, if this automatic (un)checking will happen, is it better to check (inherited: true) or uncheck (inherited: false) all properties?

Stefan Seifert
January 18, 2017, 1:06 AM

From what I understand, for a singleton configuration, if sling:configPropertyInherit is true, the user can toggle inherited for individual properties.

no - this is not supported by the backend. all properties are inherited or none (but the caconfig impl decides for each property if a value exists on the current level -> no inheritance, or not and only on a higher level -> value is inherited).

the only "trick" done in the UI is that if a user unchecks the "inherited" checkbox he can enter a new value that is stored on the current level. if he is doing this the inheritance is broken and replaced with the new value. if he does not enter a value or removes it later (by clearing the field or checking the inherited checkbox again) the inheritance does not take place.

Therefore it is possible that there is a mix of inherited: true and inherited: false properties in the config.

yes, but in the end it is only relevant what values are stored in the valuemap of the current value.

if the config properties have such "mixed" inheritance and then the user sets sling:configPropertyInherit to false - what should happen?

the inheritance checkbox for each row should be disabled or invisible if property inheritance for the configuration is not enabled.
if it was enabled before and is disabled then by unchecking the checkbox for the configuration, for each row only the real value of the current level should be displayed, and all inheritance checkboxes on each row unchecked and disabled or hiddden.

sorry for not being more precise initially, the topic is a bit complex, hopefully i've thought about all special cases this time.

David Ding
January 18, 2017, 2:44 AM

Updates committed in 48158b5

Stefan Seifert
January 24, 2017, 8:14 AM

thanks - great work!

Done

Assignee

Unassigned

Reporter

Stefan Seifert

Labels

None

Components

Priority

Major