Overview

This page contains screen scribbles for the Editor GUI implemented in wcm.io for the Sling Context-Aware Configuration.

Basic concepts

The configuration editor does not allow to edit all configuration levels or fallback modes. It shows only the configuration for the current inner-most context path (this may be the current site, current language, current region etc.) and allows to edit it. Although the configuration itself is normally stored not inside the context content, the editor page is created there to automatically detect the matching context path. When writing back configuration still the ACLs of the configuration path apply.

Configuration overview

This screen is shown when the configuration editor is opening first time.

Overview View

==== Configuration Editor ====

[ Add ]

Context path: /x/y/z

|     | Configuration Name  |  Description
| [S] | Config 1            |
[ [L] | Config 2            |

Add Dialog

==== Add Configuration ====

Configuration Name:   [ Dropdown ]

[ OK ] [ Cancel ]


Configuration Detail View

This screen is shown when an existing or new configuration is displayed (technicall it's exactly the same, even from the calls to the API).

Detail View (Singleton)

=== Configuration Editor: <Config Name> ====

[ Save ] [ Cancel ]

Context Path: /x/y/z

--- Configuration ---
| Property    | Value   | Description   | Inherited   | Overwritten
| Param 1     | 123     | (i)           | [x]         | [ ]
| Param 2     | abc     | (i)           | [ ]         | [ ]

[ Delete ]

Detail View (Configuration Collection)

=== Configuration Editor: <Config Name> ====

[ Save ]  [ Cancel ]

Context Path: /x/y/z


--- Configuration: item1 ---
| Property    | Value   | Description   | Inherited   | Overwritten
| Param 1     | 123     | (i)           | [x]         | [ ]
| Param 2     | abc     | (i)           | [ ]         | [ ]

[ Delete ]

--- Configuration: item2 ---
| Property    | Value   | Description   | Inherited   | Overwritten
| Param 1     | 123     | (i)           | [x]         | [ ]

[ Delete ]


[ Add ]


Configuration Editor HTTP API

Configuration Names

URL: <resource-path>.configNames.json

Returns the current context path, and an array with all configuration names and metadata.

Example response:

{
  "contextPath": "/content/path",
  "configNames": [
    {
      "configName": "configName",
      "label": "Sample Configuration",
      "description": "This is a sample configuration.",
      "collection": false,
      "exists": true
    },
    {
      "configName": "configNameList",
      "label": "Sample Configuration List",
      "description": "This is a sample configuration list.",
      "collection": true,
      "exists": true
    }
  ]
}

Read Configuration Data

URL: <resource-path>.configData.json?configName=<configName>[&collection=true]

Use the configName as parameter for the configPersist URL when posting back the changed configuration data.

Example response for singleton config:

{
  "configName": "configName",
  "properties": [
    {
      "name": "stringParam",
      "value": "This is an example string value",
      "effectiveValue": "This is an example string value",
      "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSample",
      "default": false,
      "inherited": false,
      "overridden": false,
      "metadata": {
        "type": "String",
        "label": "String Param",
        "description": "This is a string parameter in the singleton configuration."
      }
    },
    {
      "name": "stringArrayParam",
      "effectiveValue": [
        "value1",
        "value2"
      ],
      "default": true,
      "inherited": false,
      "overridden": false,
      "metadata": {
        "type": "String",
        "multivalue": true,
        "defaultValue": [
          "value1",
          "value2"
        ],
        "label": "String Array Param"
      }
    }
  ]
}

Example response for collection config:

{
  "configName": "configNameList",
  "properties": {
    "colProp1": "value1"
  },
  "items": [
    {
      "configName": "configNameList",
      "collectionItemName": "item1",
      "properties": [
        {
          "name": "stringParam",
          "value": "Value of item1",
          "effectiveValue": "Value of item1",
          "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSampleList/item1",
          "default": false,
          "inherited": false,
          "overridden": false,
          "metadata": {
            "type": "String",
            "label": "String Param",
            "description": "This is a string parameter within the configuration list."
          }
        }
      ]
    },
    {
      "configName": "configNameList",
      "collectionItemName": "item2",
      "properties": [
        {
          "name": "stringParam",
          "value": "Value of item2",
          "effectiveValue": "Value of item2",
          "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSampleList/item2",
          "default": false,
          "inherited": false,
          "overridden": false,
          "metadata": {
            "type": "String",
            "label": "String Param",
            "description": "This is a string parameter within the configuration list."
          }
        }
      ]
    }
  ]
}

In case of nested configurations the property object contains a nestedConfig (singleton) or nestedConfigCollection (collection) object, which content has the same structure as shown above. Each nested configuration has it's own configName which can be used for posting as well.

Persist Configuration Data

URL: <resource-path>.configPersist.json?configName=<configName>[&collection=true]

Use POST method.

Post singleton configuration with a JSON body like this:

{"properties": {
  "prop1": "value1",
  "prop2": 55,
  "prop3": true,
  "prop4": ["value1","value2"]
}}


Post configuration collections with a JSON body like this:

{
  "properties": {"colProp", "value1"},
  "items": [
    {"collectionItemName": "item1", "properties": {
      "prop1": "value1",
      "prop2": 55,
      "prop3": true,
      "prop4": ["value1","value2"]
    }},
    {"collectionItemName": "item2", "properties": {
      "prop1": "value2"
    }}
  ]
}


No nested configurations are allowed when posting. Post them individually.