lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.32k stars 1.46k forks source link

ClusterPageMenus don't nest more than one level #2614

Open Nokel81 opened 3 years ago

Nokel81 commented 3 years ago

Describe the bug ClusterPageMenus have a hierarchy of parent menus by way of id and parentId matching. However, if a child of a root menu item doesn't have a target then it is not shown. Furthermore, of a child of a root menu has itself a child, that grandchild of a root menu is never rendered

To Reproduce Steps to reproduce the behaviour:

  1. Create an extension with the following fields:
Example Extension ```ts export default class ThingExtension extends LensRendererExtension { clusterPages = [ { id: "thing_page_1", components: { Page: (): JSX.Element => (

page 1

) } }, { id: "thing_page_2", components: { Page: (): JSX.Element => (

page 2

) } }, { id: "thing_page_3a", components: { Page: (): JSX.Element => (

page 3a

) } }, ] clusterPageMenus = [ { id: "thing", title: "thing", components: { Icon: MyIcon } }, { parentId: "thing", target: { pageId: "thing_page_1", params: {} }, title: "1", components: { Icon: (): JSX.Element => } }, { parentId: "thing", target: { pageId: "thing_page_2", params: {} }, title: "2", components: { Icon: (): JSX.Element => } }, { id: "3", parentId: "thing", title: "3", components: { Icon: (): JSX.Element => } }, { parentId: "3", target: { pageId: "thing_page_3a", params: {} }, title: "3a", components: { Icon: (): JSX.Element => } }, ]; } ```
  1. Observe that only the following is rendered:

    image

Expected behavior ClusterPageMenu's should always be rendered, even if they don't have a matching entry and they should do somethings sane if clicked (maybe a warning notification)

Furthermore, menus should be able to be arbitrarily nested.

Nokel81 commented 3 years ago

Initially the docs should be modified to specify that this is only supported to a single level of nesting, before the work to support N levels is done.