Skip to content

API for hiding single panels #1186

@borglin

Description

@borglin

Problem
I want to hide/disable access to some panels in a standard layout config based on the users permission, or a feature flag, and instead of having them removed from the layout when the users lacks permissions I'd like to hide them so that I can unhide when the user gains permissions.

Framework
All (React)

Proposed solution
There's an API method for hiding groups, I'd like to have the same API available on a panel level. The visibility status would be serialised into the JSON state format, ideally as a property of the panel in the panels map. It should trigger an onDidVisibilityChange event for the panel.

panel.setVisible(false) // => panel.isVisible === false

Alternatives considered
I tried storing the visibility state in the panel params and using a custom tab renderer and CSS to hide the tab and some logic to change the active panel to something else if a panel becomes unavailable and to prevent the panel component from rendering its content if it is hidden. It works, but it is hacky and the overflow menu still counts the tab as visible so the number showing the number of overflowing doesn't match the number of tabs in the overflow menu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions