-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDetectionResultCrudController.php
More file actions
67 lines (59 loc) · 2.18 KB
/
Copy pathDetectionResultCrudController.php
File metadata and controls
67 lines (59 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Admin\Field\RootDirField;
use App\Admin\Field\ServerTypeField;
use App\Admin\Field\TextMonospaceField;
use App\Admin\Field\VersionField;
use App\Entity\DetectionResult;
use App\Form\Type\Admin\DetectionFilter;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
class DetectionResultCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return DetectionResult::class;
}
#[\Override]
public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined()->setDefaultSort(['lastContact' => 'DESC']);
}
#[\Override]
public function configureActions(Actions $actions): Actions
{
return $actions
->disable(Action::DELETE, Action::NEW, Action::EDIT)
->add(Crud::PAGE_INDEX, Action::DETAIL);
}
#[\Override]
public function configureFields(string $pageName): iterable
{
yield TextMonospaceField::new('id')->hideOnIndex();
yield VersionField::new('type')->setColumns(4);
yield RootDirField::new('rootDir')->setColumns(12);
yield ServerTypeField::new('server.type')->setLabel('Type');
yield AssociationField::new('server');
yield DateTimeField::new('createdAt')->hideOnIndex();
yield DateTimeField::new('modifiedAt')->hideOnIndex();
yield DateTimeField::new('lastContact');
yield CodeEditorField::new('prettyData')->hideOnIndex()->setLabel('Data');
}
#[\Override]
public function configureFilters(Filters $filters): Filters
{
return $filters
->add(DetectionFilter::new('type'))
->add('rootDir')
->add('server')
->add('lastContact')
;
}
}