Our app introduces a custom content type, objects of which can be attached to pages. We provide a UI with an overview of such objects in the current space, and make this UI accessible through the space sidebar. We are declaring the overview page as a generalPages
module and list that as the listViewComponent
of the custom content type. In order to make the item shown in the space sidebar, we add space
to the supportedContainerTypes
of the custom content, even though we only ever attach this content to pages, never to spaces.
Roughly, our configuration looks like this:
"modules": {
"customContent": [
{
"key": "document",
"name": { "value": "Document Library" },
"uiSupport": {
"listViewComponent": {
"moduleKey": "k15t-docs-documents-overview-page"
},
},
"apiSupport": {
"supportedContainerTypes": [
"space",
"page"
],
}
}
],
"generalPages": [
{
"key": "k15t-docs-documents-overview-page",
"url": "...",
"location": "none",
"name": {
"value": "Document Library"
}
}
]
}
This works successfully and shows up in the space sidebar:
Now I want to implement a feature where users can enable/disable our app for a specific space. I thought the best way to do this would be to use a space property that defines whether the app should be enabled in the space or not. Then a condition could be used to show/hide the UI elements:
{
"condition": "space_property_equal_to",
"params": {
"propertyKey": "K15tDocsEnabled",
"value": "1"
}
}
While this works for other UI elements, for example a web item, I cannot find a way to do this for the space sidebar item.
The custom content module does not seem to support any conditions for its list view component.
When trying add this condition to the general page model, Confluence gives me an error Installation failed. The app includes a Page module with an unsupported condition (space_property_equal_to).
The documentation seems to be wrongly listing this and some other conditions as supported. However, using another condition that is supported (for example user_is_logged_in
) doesn’t show any effect, the item is always shown. The reason is probably that the general page conditions configure whether it is shown in its configured location
, but not if it is shown in the space sidebar when used as the listViewComponent
of a custom content type.
What I would like to see:
- Correct the general page module documentation about which conditions are really supported (I suspect all the
content_property
,space_property
andentity_property
conditions are not supported). - Provide a better way to control whether a custom content list view should be listed in the space sidebar, with the possibility to use conditions. Right now this is determined by whether
supportedContainerTypes
contains"space"
, but there can be cases where people want to use this content type on a space level without showing the item, and cases where people want to not use this content type on a space level but still show the item (like ours).