Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend Map: Allow plugins to customize the map #2602

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

sniok
Copy link
Contributor

@sniok sniok commented Nov 22, 2024

Basic Map extension

This PR introduces 3 new functions that allow for the simplest case of extending the Map.

You can read the full docs page over here https://github.com/headlamp-k8s/headlamp/blob/d02531292dd770360d127a792d345e82428ad994/docs/development/plugins/functionality/extending-the-map.md

You can add your own nodes and edges, customize the icon for the nodes and show a details page for the node.

  1. registerMapSource
    registers a "Source" which provides Nodes and Edges to the map

  2. registerKindIcon
    adds an icon for a specific resource "kind", which is displayed on the node and the map search (not the global one)

  3. registerKindDetailsPage
    registers details panel for a specific resource "kind"

Reasoning and intentions

The registerKindIcon and registerKindDetailsPage don't mention Map and have a generic name (and not registerMapNodeIcon for example) for a reason.
I think in the near future this can be used in other places and not just Map.
For example KindIcon can be used in the global search, and Details component can be used in the normal Details page for custom resources.
For now the customizations are very granular to keep it simple but I think in the future we should have an ability to register a custom resource that will integrate it everywhere all at once, something like this:

registerCustomResource(params) {
  registerKindIcon(...);
  registerKindDetailsPage(...);
  registerMapSource(...);
  registerGlobalSearch(...);
  registerSidebarItem(...);
  registerRoute(...);
}

which I think would be extremely useful since a lot of plugins are listing/displaying custom resources.

@sniok sniok force-pushed the map-plugins branch 2 times, most recently from 870e4cc to f434b04 Compare November 27, 2024 10:38
@sniok sniok changed the title WIP frontend Map: Allow plugins to customize the map frontend Map: Allow plugins to customize the map Nov 27, 2024
@sniok sniok marked this pull request as ready for review November 27, 2024 11:39
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Nov 27, 2024
@sniok sniok requested a review from a team November 27, 2024 11:39
@sniok sniok added resourceMap frontend Issues related to the frontend plugins labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Issues related to the frontend plugins resourceMap size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant