awcodes / filament-curator

A media picker plugin for Filament Panels.
MIT License
298 stars 79 forks source link

Add support for Cluster #458

Closed atmonshi closed 1 month ago

atmonshi commented 3 months ago

~still draft... ... one moment plz.~

the issue

atmonshi commented 3 months ago

so instead of using the plugin configuration, as a work around we can use the config only, and its work as expected but its not customizable per panel. what do you think of this approach!

I left the code in the plugin class as comments to get back to it later.

awcodes commented 2 months ago

Do you happen to have a demo repo I can try all this out on? Honestly, I haven't even used the cluster feature so I don't have anything setup to test against.

atmonshi commented 2 months ago

ya I was procrastinating creating a reproduce repo to report to filament 😅

but here it is: https://github.com/atmonshi/issue-cluster

and I am using this fork: https://github.com/atmonshi/filament-curator/tree/cluster-panel

you'll see the error "Call to a member function getPlugin() on null", so you can disable ->cluster(Life::class) here:

https://github.com/atmonshi/issue-cluster/blob/05e27590c65b5f60ae53bf07728d918f3a5adffc/app/Providers/Filament/AdminPanelProvider.php#L47

awcodes commented 2 months ago

Awesome. Thanks. Just didn't want you to think I was ignoring this or didn't care. 😅

awcodes commented 2 months ago

Is this not ready or a bug in filament? I couldn't get it to work.

atmonshi commented 2 months ago

this PR is using the config file only, so its like half way there, a temp solution.

reported the bug here: https://github.com/filamentphp/filament/issues/12532

if this fixed then I'll update this PR to use the plugin class based configuration, so it will be customizable per panel.

awcodes commented 2 months ago

Ok. Can you change it back to draft until it's ready?

atmonshi commented 1 month ago

hey @awcodes, so it seems (cluster configuration from the panel) is not possible, as Dan explain:

as the cluster needs to be read when the routing is registered, and the panel may not be booted at that point so the plugins aren't there.

this PR is ready for a cluster configuration from the panel config file.

so if you want to merge it or not totally fine :) 🍻

awcodes commented 1 month ago

So how does this work? Lol.

atmonshi commented 1 month ago

😂 will simply in config/curator.php:

'cluster' => \App\Filament\Clusters\Cms::class,

what I was hopping was to customize it per panel:

CuratorPlugin::make()
       ->cluster(\App\Filament\Clusters\Cms::class)

but got greedy, will have to convince the client its "better" this way lol

awcodes commented 1 month ago

So, how is this different than over ridding the resource which is already possible?

atmonshi commented 1 month ago

less files to copy to the app :) same idea for navigation_label and other resources configuration.