headlamp-k8s / headlamp

A Kubernetes web UI that is fully-featured, user-friendly and extensible
https://headlamp.dev
Apache License 2.0
2.22k stars 156 forks source link

SectionFilterHeader custom actions problem #1307

Closed callmevladik closed 10 months ago

callmevladik commented 1 year ago

Problem description: There is a "SectionFilterHeader" component which enforces plugin developers to develop with strictly defined use cases of passing actions property. Developers cannot pass custom filter item into the area with "NamespacesAutocomplete" and search text field, they cannot align vertically components passed as actions property, because they have no access to parent component, also devs cannot use NamespacesAutocomplete or search text field components to create their own section header, because those components are not exported, so the only way to achieve custom behaviour is to copy NamespacesAutocomplete component code, Search component code and create our own component.

I've already faced similar problem with SimpleTable component. I wanted to add custom header row, but couldn't do that with the component, also the component had pagination logic inside. As a workaround I chose not to use SimpleTable component and copy its pagination logic into separate hook.

Those components I've described earlier are examples of hardly customizable and encapsulated with important logic components.

image image image image

joaquimrocha commented 1 year ago

@callmevladik , we have taken the approach of "let's make available only what's needed" so we could break compatibility if needed without breaking the plugins. "What's needed" here means what plugin developers need, so we should find a way to enable the use-cases you need. And if there's a component that's not exported and you need it, we should export it.

Can you share exactly what you're trying to accomplish? So we have a better understanding of what's needed from our side.

callmevladik commented 1 year ago

Yeah, sure. I would like to create a custom filter component and I need to use already implemented logic by headlamp, for example namespace and search filters. It would be nice if they were exported.