-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInstallationCrudController.php
More file actions
98 lines (88 loc) · 3.56 KB
/
Copy pathInstallationCrudController.php
File metadata and controls
98 lines (88 loc) · 3.56 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Admin\Field\ChangesField;
use App\Admin\Field\EolTypeField;
use App\Admin\Field\RootDirField;
use App\Admin\Field\ServerTypeField;
use App\Admin\Field\VersionField;
use App\Entity\Installation;
use App\Form\Type\Admin\FrameworkFilter;
use App\Form\Type\Admin\SemverFilter;
use App\Trait\ExportCrudControllerTrait;
use App\Trait\SemverSortableCrudControllerTrait;
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\BooleanField;
use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
class InstallationCrudController extends AbstractCrudController
{
use ExportCrudControllerTrait;
use SemverSortableCrudControllerTrait;
public static function getEntityFqcn(): string
{
return Installation::class;
}
#[\Override]
public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined();
}
#[\Override]
public function configureActions(Actions $actions): Actions
{
return $actions
->add(Crud::PAGE_INDEX, Action::DETAIL)
->add(Crud::PAGE_INDEX, $this->createExportAction())
->remove(Crud::PAGE_INDEX, Action::NEW)
->remove(Crud::PAGE_INDEX, Action::EDIT)
->remove(Crud::PAGE_INDEX, Action::DELETE)
->remove(Crud::PAGE_DETAIL, Action::EDIT)
->remove(Crud::PAGE_DETAIL, Action::DELETE);
}
#[\Override]
public function configureFields(string $pageName): iterable
{
yield VersionField::new('type');
yield VersionField::new('frameworkVersion', 'ver.');
yield BooleanField::new('lts')->renderAsSwitch(false)->hideOnIndex();
yield EolTypeField::new('eol')->hideOnIndex();
yield VersionField::new('composerVersion', 'Comp.');
yield ChangesField::new('gitChangesCount')->hideOnDetail()->setLabel('Git');
yield VersionField::new('gitTag.tag')->hideOnDetail()->setLabel('Tag');
yield AssociationField::new('gitTag')->hideOnIndex();
yield ChangesField::new('gitChangesCount')->hideOnIndex();
yield CodeEditorField::new('gitChanges')->hideOnIndex();
yield AssociationField::new('sites')->hideOnIndex();
yield RootDirField::new('rootDir')->setColumns(12);
yield ServerTypeField::new('server.type')->setLabel('Type');
yield AssociationField::new('server');
yield AssociationField::new('detectionResult')->hideOnIndex();
yield DateTimeField::new('createdAt')->hideOnIndex();
yield DateTimeField::new('detectionResult.lastContact')->hideOnIndex();
}
#[\Override]
public function configureFilters(Filters $filters): Filters
{
return $filters
->add(FrameworkFilter::new('type'))
->add(SemverFilter::new('frameworkVersion', 'ver.'))
->add('lts')
->add('eol')
->add(SemverFilter::new('composerVersion', 'Comp.'))
->add('rootDir')
->add('server')
// ->add(SystemFilter::new('system')->mapped(false))
;
}
#[\Override]
protected function semverSortedProperties(): array
{
return ['frameworkVersion', 'composerVersion'];
}
}