54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Infrastructure\Http\Controller\Admin;
|
||
|
|
|
||
|
|
use App\Domain\Pipeline\AIPipelineJob;
|
||
|
|
use App\Domain\Pipeline\AIPipelineJobStatus;
|
||
|
|
use App\Domain\Pipeline\AIPipelineJobType;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||
|
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
|
||
|
|
|
||
|
|
/** @extends AbstractCrudController<AIPipelineJob> */
|
||
|
|
final class AIPipelineJobCrudController extends AbstractCrudController
|
||
|
|
{
|
||
|
|
public static function getEntityFqcn(): string
|
||
|
|
{
|
||
|
|
return AIPipelineJob::class;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureCrud(Crud $crud): Crud
|
||
|
|
{
|
||
|
|
return $crud->setEntityLabelInSingular('AI Pipeline Job')->setEntityLabelInPlural('AI Pipeline Jobs');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureActions(Actions $actions): Actions
|
||
|
|
{
|
||
|
|
return $actions->disable(Action::NEW, Action::EDIT, Action::DELETE);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function configureFields(string $pageName): iterable
|
||
|
|
{
|
||
|
|
yield IdField::new('id')->hideOnForm();
|
||
|
|
yield ChoiceField::new('type')->setChoices(
|
||
|
|
array_combine(
|
||
|
|
array_map(static fn ($t) => $t->value, AIPipelineJobType::cases()),
|
||
|
|
AIPipelineJobType::cases(),
|
||
|
|
)
|
||
|
|
);
|
||
|
|
yield ChoiceField::new('status')->setChoices(
|
||
|
|
array_combine(
|
||
|
|
array_map(static fn ($s) => $s->value, AIPipelineJobStatus::cases()),
|
||
|
|
AIPipelineJobStatus::cases(),
|
||
|
|
)
|
||
|
|
);
|
||
|
|
yield IntegerField::new('attemptCount', 'Attempts');
|
||
|
|
}
|
||
|
|
}
|