Conditionally show custom content listViewComponent in space sidebar

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 and entity_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).
5 Likes

As a workaround, I thought about proposing our users to manually hide the space sidebar item. However, I found some inconsistent behaviour there.

On one of my test instances, the sidebar item appears as a regular item in the list, and it can be hidden using the Sidebar Configuration in the Space Settings. This hides it for all users in that space:

On another one of my test instances, the sidebar item appears in a separate “Apps” section. It is not listed in the Sidebar Configuration, there is, however, an edit button in the “Apps” section which opens an “Edit space apps” dialog where I can hide the item. Hiding it there seems to only hide it for myself in that space, not for other users.

image

Is this inconsistency there on purpose?

4 Likes

Any update to this? Im trying to specify which space I would like the list view component to display. Documentation is lacking when it comes to this. Any help would be amazing.

Thanks!

1 Like

I’m on the same boat too. Any update?

1 Like