TiagoSilvaPereira / vemto-filament-plugin

A Vemto plugin for generating Filament admin panels
21 stars 9 forks source link

Compatibility with newer versions #12

Closed juliangums closed 7 months ago

TiagoSilvaPereira commented 11 months ago

Hi @juliangums thank you for committing this PR... does it make the plugin compatible with Filament v3?

juliangums commented 11 months ago

@TiagoSilvaPereira not entirely. But if you add another file to generate an AdminPanelProver, something like this:

<?php

namespace App\Providers\Filament;

use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Navigation\NavigationGroup;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->id('admin')
            ->path('/admin')
            ->login()
            ->colors([
                'primary' => Color::Amber,
            ])
            ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
            ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
            ->pages([
                Pages\Dashboard::class,
            ])
            ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
            ->widgets([
                Widgets\AccountWidget::class,
                Widgets\FilamentInfoWidget::class,
            ])
            ->middleware([
                EncryptCookies::class,
                AddQueuedCookiesToResponse::class,
                StartSession::class,
                AuthenticateSession::class,
                ShareErrorsFromSession::class,
                VerifyCsrfToken::class,
                SubstituteBindings::class,
                DisableBladeIconComponents::class,
                DispatchServingFilamentEvent::class,
            ])
            ->authMiddleware([
                Authenticate::class,
            ]);
    }
}

and register it in config/app.php and then you change the version here https://github.com/TiagoSilvaPereira/vemto-filament-plugin/blob/main/src/main.js#L55 it should work I think. Seems to work for me.

TiagoSilvaPereira commented 11 months ago

@nicollassilva could you please check this?

juliangums commented 11 months ago

@nicollassilva @TiagoSilvaPereira I've done those things now and fixed a couple more things I came across, but it would still need to be tested properly. But then it should be ready, I guess.

nicollassilva commented 11 months ago

@juliangums Thank you very much for your contribution. I'll check the changes.

xerk commented 10 months ago

Hello guys this PR is working fine?

chrispian commented 7 months ago

I've been testing this on my local with the latest plugin and latest versions of all the Laravel/Filament/Livewire, etc. And one thing needs to be fixed and I think this may be ready. I'm going to keep doing some testing but in the FilamentResource.vemto template the nav icon needs to be changed from o-collection to heroicon-o-rectangle-stack as that's the new heroiocons name. Otherwise you get an svg not found error on all the resources page.

Hopefully this will help get this closed out. I have a working copy merged into main on my fork.

chrispian commented 7 months ago

I've tested about 30 or so project exports with the latest versions as of yesterday. I wanted to test against the very latest.

I haven't seen any issues. Seems to be working like a champ. The field type for MultiSelect::make() is just now Select::make()->multiple() and that was the only other thing I could think of that might need eyes on but this plugin favors RelationManagers anywhere that would normally be used.

I think this is GTG, but I'll test more this weekend and report on Sunday evening. I'll be working on a project with Vemto all weekend anyway and I would love to get the official Filament plugin out there for everyone else.

I'll do my best to help contribute to keep things up to date with Filament in the future too. Would love to help out on this one if it's needed.

nicollassilva commented 7 months ago

Hey @juliangums, I just tested the pull request and it's working, congratulations on your effort and dedication! Analyzing the resources, I see that they do not have actions (create, edit and delete buttons), so I think that would be the only thing missing. If you want to make these additions, we will push your changes to an official release.

Thanks again for your effort!

juliangums commented 7 months ago

I won't get a chance in the next 3 weeks. @chrispian do you want to create a pull request for those actions on my patch, and I'll merge it.

chrispian commented 7 months ago

@juliangums , @nicollassilva - I just added the table actions. Do they need any conditional logic, seems like just the straight actions make sense. I also grouped the imports for Forms and Tables in the template to clean that up a little.

Do we need an edit header action on the view template?

I have the code merged into my fork for testing and seems good so far. https://github.com/chrispian/vemto-filament-plugin/pull/3

Let me know if there's anything else and if not, I'll get this PR'd asap.

juliangums commented 7 months ago

Looks good to me

chrispian commented 7 months ago

Not sure how to PR to a PR. I tried from local but it said permission denied, probably because I don't have write permission. But it's merged into my main branch in the fork and the PR I used is linked in my previous comment if someone wants to merge that in.

If someone wants to tell me how to do the merge correctly I'll do that part too, would love to know the right way to get this added.

chrispian commented 7 months ago

Figured out how to submit to the patch-1 branch (just needed to target the proper fork for destination, duh). It's ready for review.

TiagoSilvaPereira commented 7 months ago

@nicollassilva please take a look on it when possible, thanks

nicollassilva commented 7 months ago

It looks good now. Could you also include getHeaderActions within the ListResource class to display the Create button on the table page?

Thanks.

chrispian commented 7 months ago

@nicollassilva Absolutely. While I'm there, do we want to add the edit button on the ViewResource? That also now has to be explicitly defined.

chrispian commented 7 months ago

I've added the create button to to the header actions on the FilamentResource (which adds it to the table view for ListResource). I went ahead and added the Edit button to the ViewResource as well.

LMK if you want any further changes. Tested and so far so good.

nicollassilva commented 7 months ago

@chrispian Sounds great! Where are these modifications? It seems that PR is without them.

chrispian commented 7 months ago

@nicollassilva I may be doing this wrong, but I submitted them here: https://github.com/juliangums/vemto-filament-plugin/pulls

I'm not sure how to target a PR on this vs a branch in a repo. I'll see if I can figure it out, first time I've done one this way.

chrispian commented 7 months ago

@nicollassilva If I'm reading this correctly, I would need write access here. I don't have that yet so I have to PR to his branch so he'll need to merge them before they show up? If there's another way point me in that direction and I'll get it done.

cc: @juliangums

nicollassilva commented 7 months ago

Don't worry, I will take your changes manually and make a new branch to release the release.

Thank you for your commitment!

@chrispian @juliangums

chrispian commented 7 months ago

Ok, sounds good! Happy to help. I've got some ideas but I'm still learning the plugin system. Hopefully I can keep helping out.

TiagoSilvaPereira commented 7 months ago

Support added through https://github.com/TiagoSilvaPereira/vemto-filament-plugin/pull/14