Skip to content

Commit c023288

Browse files
committed
Merge branch 'main' into hotfix/5566_maintenance_contract-merge-from-main
2 parents 514260b + 4402754 commit c023288

21 files changed

Lines changed: 882 additions & 26 deletions

.php-cs-fixer.dist.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
$config = new PhpCsFixer\Config();
1717
$config->setFinder($finder);
18+
// Allow running on PHP versions php-cs-fixer doesn't officially support yet
19+
// (we run on the latest stable PHP). Replaces the deprecated
20+
// PHP_CS_FIXER_IGNORE_ENV env var.
21+
$config->setUnsupportedPhpVersionAllowed(true);
1822

1923
$config->setRules([
2024
'@Symfony' => true,

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Update ITK docker template
1414
- Update github actions workflows
1515

16+
## [1.11.0] - 2026-05-19
17+
18+
- [#78](https://github.com/itk-dev/devops_itksites/pull/78)
19+
Update composer dependencies, fix php-cs-fixer deprecation
20+
- [#77](https://github.com/itk-dev/devops_itksites/pull/77)
21+
Fix SemverFilter: respect value2 with directional operators
22+
- [#76](https://github.com/itk-dev/devops_itksites/pull/76)
23+
Add server type filter and sort on Installation, Site, Domain
24+
- [#75](https://github.com/itk-dev/devops_itksites/pull/75)
25+
Add semver-aware filter on every admin version column, make version
26+
column semver sortable
27+
1628
## [1.10.1] - 2026-05-11
1729

1830
- [#71](https://github.com/itk-dev/devops_itksites/pull/71)
@@ -170,7 +182,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
170182

171183
## [1.0.0] - 2022-09-15
172184

173-
[Unreleased]: https://github.com/itk-dev/devops_itksites/compare/1.10.0...HEAD
185+
[Unreleased]: https://github.com/itk-dev/devops_itksites/compare/1.11.0...HEAD
186+
[1.11.0]: https://github.com/itk-dev/devops_itksites/compare/1.10.1...1.11.0
187+
[1.10.1]: https://github.com/itk-dev/devops_itksites/compare/1.10.0...1.10.1
174188
[1.10.0]: https://github.com/itk-dev/devops_itksites/compare/1.9.2...1.10.0
175189
[1.9.2]: https://github.com/itk-dev/devops_itksites/compare/1.9.1...1.9.2
176190
[1.9.1]: https://github.com/itk-dev/devops_itksites/compare/1.9.0...1.9.1

composer.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@
114114
"cache:clear": "symfony-cmd",
115115
"assets:install %PUBLIC_DIR%": "symfony-cmd",
116116
"importmap:install": "symfony-cmd"
117-
}
117+
},
118+
"coding-standards-apply": [
119+
"vendor/bin/php-cs-fixer fix"
120+
],
121+
"coding-standards-check": [
122+
"vendor/bin/php-cs-fixer fix --dry-run"
123+
],
124+
"fixtures-load": [
125+
"bin/console hautelook:fixtures:load --no-interaction"
126+
],
127+
"queues": [
128+
"bin/console messenger:consume async --failure-limit=1 -vvv"
129+
],
130+
"tests": [
131+
"bin/console --env=test doctrine:database:drop --if-exists --force --quiet",
132+
"bin/console --env=test doctrine:database:create --no-interaction --if-not-exists --quiet",
133+
"bin/console --env=test doctrine:migrations:migrate --no-interaction --quiet",
134+
"vendor/bin/phpunit --stop-on-failure"
135+
],
136+
"update-api-spec": [
137+
"bin/console api:openapi:export --output=public/api-spec-v1.yaml --yaml --no-interaction",
138+
"bin/console api:openapi:export --output=public/api-spec-v1.json --no-interaction"
139+
]
118140
}
119141
}

composer.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/packages/doctrine.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ doctrine:
2121
dir: '%kernel.project_dir%/src/Entity'
2222
prefix: 'App\Entity'
2323
alias: App
24+
dql:
25+
numeric_functions:
26+
SEMVER_NUMERIC: App\Doctrine\Functions\SemverNumeric
2427
controller_resolver:
2528
auto_mapping: false
2629

src/Admin/SemverSort.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Admin;
6+
7+
use Doctrine\ORM\QueryBuilder;
8+
9+
final class SemverSort
10+
{
11+
/**
12+
* Rewrite the QueryBuilder's ORDER BY so that the listed root-alias
13+
* properties sort in semver order (via the SEMVER_NUMERIC DQL function)
14+
* instead of lexicographic string order. Other ORDER BY parts are
15+
* left untouched. Intended for use from a CRUD controller's
16+
* createIndexQueryBuilder() after the parent has built the QB.
17+
*/
18+
public static function apply(QueryBuilder $qb, string ...$properties): void
19+
{
20+
$orderByParts = $qb->getDQLPart('orderBy');
21+
if ([] === $orderByParts) {
22+
return;
23+
}
24+
25+
$alias = (string) current($qb->getRootAliases());
26+
$needles = [];
27+
foreach ($properties as $property) {
28+
$needles[$alias.'.'.$property] = 'SEMVER_NUMERIC('.$alias.'.'.$property.')';
29+
}
30+
31+
$qb->resetDQLPart('orderBy');
32+
foreach ($orderByParts as $orderBy) {
33+
foreach ($orderBy->getParts() as $part) {
34+
if (preg_match('/^(.+?)\s+(ASC|DESC)$/i', $part, $m)) {
35+
[$expr, $dir] = [$m[1], strtoupper($m[2])];
36+
} else {
37+
[$expr, $dir] = [$part, 'ASC'];
38+
}
39+
40+
$expr = $needles[$expr] ?? $expr;
41+
$qb->addOrderBy($expr, $dir);
42+
}
43+
}
44+
}
45+
}

src/Controller/Admin/DockerImageTagCrudController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use App\Admin\Field\VersionField;
88
use App\Entity\DockerImageTag;
9+
use App\Form\Type\Admin\SemverFilter;
10+
use App\Trait\SemverSortableCrudControllerTrait;
911
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
1012
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
1113
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
@@ -16,6 +18,8 @@
1618

1719
class DockerImageTagCrudController extends AbstractCrudController
1820
{
21+
use SemverSortableCrudControllerTrait;
22+
1923
public static function getEntityFqcn(): string
2024
{
2125
return DockerImageTag::class;
@@ -49,7 +53,13 @@ public function configureFilters(Filters $filters): Filters
4953
{
5054
return $filters
5155
->add('dockerImage')
52-
->add('tag')
56+
->add(SemverFilter::new('tag'))
5357
;
5458
}
59+
60+
#[\Override]
61+
protected function semverSortedProperties(): array
62+
{
63+
return ['tag'];
64+
}
5565
}

src/Controller/Admin/DomainCrudController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Admin\Field\ServerTypeField;
99
use App\Admin\Field\SiteTypeField;
1010
use App\Entity\Domain;
11+
use App\Form\Type\Admin\ServerTypeFilter;
1112
use App\Trait\ExportCrudControllerTrait;
1213
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
1314
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
@@ -47,7 +48,7 @@ public function configureFields(string $pageName): iterable
4748
yield DomainField::new('address')->setColumns(12);
4849
yield SiteTypeField::new('site.type')->hideOnIndex();
4950
yield AssociationField::new('site')->hideOnIndex();
50-
yield ServerTypeField::new('server.type')->setLabel('Type');
51+
yield ServerTypeField::new('server.type')->setLabel('Type')->setSortable(true);
5152
yield AssociationField::new('server');
5253
yield AssociationField::new('detectionResult')->hideOnIndex();
5354
yield DateTimeField::new('createdAt')->hideOnIndex();
@@ -61,6 +62,7 @@ public function configureFilters(Filters $filters): Filters
6162
->add('address')
6263
->add('site')
6364
->add('server')
65+
->add(ServerTypeFilter::new('server.type', 'Server type'))
6466
;
6567
}
6668
}

src/Controller/Admin/GitTagCrudController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use App\Admin\Field\VersionField;
88
use App\Entity\GitTag;
9+
use App\Form\Type\Admin\SemverFilter;
10+
use App\Trait\SemverSortableCrudControllerTrait;
911
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
1012
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
1113
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
@@ -15,6 +17,8 @@
1517

1618
class GitTagCrudController extends AbstractCrudController
1719
{
20+
use SemverSortableCrudControllerTrait;
21+
1822
public static function getEntityFqcn(): string
1923
{
2024
return GitTag::class;
@@ -50,7 +54,13 @@ public function configureFilters(Filters $filters): Filters
5054
{
5155
return $filters
5256
->add('repo')
53-
->add('tag')
57+
->add(SemverFilter::new('tag'))
5458
;
5559
}
60+
61+
#[\Override]
62+
protected function semverSortedProperties(): array
63+
{
64+
return ['tag'];
65+
}
5666
}

src/Controller/Admin/InstallationCrudController.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
use App\Admin\Field\VersionField;
1212
use App\Entity\Installation;
1313
use App\Form\Type\Admin\FrameworkFilter;
14+
use App\Form\Type\Admin\SemverFilter;
15+
use App\Form\Type\Admin\ServerTypeFilter;
1416
use App\Trait\ExportCrudControllerTrait;
17+
use App\Trait\SemverSortableCrudControllerTrait;
1518
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
1619
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
1720
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
@@ -25,6 +28,7 @@
2528
class InstallationCrudController extends AbstractCrudController
2629
{
2730
use ExportCrudControllerTrait;
31+
use SemverSortableCrudControllerTrait;
2832

2933
public static function getEntityFqcn(): string
3034
{
@@ -61,7 +65,7 @@ public function configureFields(string $pageName): iterable
6165
yield CodeEditorField::new('gitChanges')->hideOnIndex();
6266
yield AssociationField::new('sites')->hideOnIndex();
6367
yield RootDirField::new('rootDir')->setColumns(12);
64-
yield ServerTypeField::new('server.type')->setLabel('Type');
68+
yield ServerTypeField::new('server.type')->setLabel('Type')->setSortable(true);
6569
yield AssociationField::new('server');
6670
yield AssociationField::new('detectionResult')->hideOnIndex();
6771
yield DateTimeField::new('createdAt')->hideOnIndex();
@@ -73,13 +77,20 @@ public function configureFilters(Filters $filters): Filters
7377
{
7478
return $filters
7579
->add(FrameworkFilter::new('type'))
76-
->add('frameworkVersion')
80+
->add(SemverFilter::new('frameworkVersion', 'ver.'))
7781
->add('lts')
7882
->add('eol')
79-
->add('composerVersion')
83+
->add(SemverFilter::new('composerVersion', 'Comp.'))
8084
->add('rootDir')
8185
->add('server')
86+
->add(ServerTypeFilter::new('server.type', 'Server type'))
8287
// ->add(SystemFilter::new('system')->mapped(false))
8388
;
8489
}
90+
91+
#[\Override]
92+
protected function semverSortedProperties(): array
93+
{
94+
return ['frameworkVersion', 'composerVersion'];
95+
}
8596
}

0 commit comments

Comments
 (0)