Skip to content

Commit 02861d4

Browse files
committed
Merge branch 'release/1.10.0'
2 parents 4e73cd5 + 6f23f66 commit 02861d4

9 files changed

Lines changed: 129 additions & 5 deletions

File tree

.github/workflows/github_build_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
APP_ENV: prod
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6
2020

2121
- name: Composer install
2222
run: |

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.10.0] - 2026-04-23
11+
12+
- [#68](https://github.com/itk-dev/devops_itksites/pull/68)
13+
6667: Update advisories on Detailed site display
14+
15+
- [#68](https://github.com/itk-dev/devops_itksites/pull/68)
16+
6667: Show sites affected on advisories.
17+
1018
## [1.9.2] - 2026-04-07
1119

1220
- [#67](https://github.com/itk-dev/devops_itksites/pull/67)
@@ -151,7 +159,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
151159

152160
## [1.0.0] - 2022-09-15
153161

154-
[Unreleased]: https://github.com/itk-dev/devops_itksites/compare/1.9.2...HEAD
162+
[Unreleased]: https://github.com/itk-dev/devops_itksites/compare/1.10.0...HEAD
163+
[1.10.0]: https://github.com/itk-dev/devops_itksites/compare/1.9.2...1.10.0
155164
[1.9.2]: https://github.com/itk-dev/devops_itksites/compare/1.9.1...1.9.2
156165
[1.9.1]: https://github.com/itk-dev/devops_itksites/compare/1.9.0...1.9.1
157166
[1.9.0]: https://github.com/itk-dev/devops_itksites/compare/1.8.9...1.9.0

src/Admin/Field/AdvisoryCountField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public static function new(string $propertyName, TranslatableInterface|string|bo
1919
->setLabel($label)
2020

2121
// this template is used in 'index' and 'detail' pages
22-
->setTemplatePath('EasyAdminBundle/Fields/advisory_count.html.twig');
22+
->setTemplatePath('EasyAdminBundle/Fields/advisories.html.twig');
2323
}
2424
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Admin\Field;
6+
7+
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
8+
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
9+
use Symfony\Contracts\Translation\TranslatableInterface;
10+
11+
class AffectedSitesField implements FieldInterface
12+
{
13+
use FieldTrait;
14+
15+
public static function new(string $propertyName, TranslatableInterface|string|bool|null $label = null): self
16+
{
17+
return new self()
18+
->setProperty($propertyName)
19+
->setLabel($label)
20+
->setTemplatePath('EasyAdminBundle/Fields/affected_sites.html.twig');
21+
}
22+
}

src/Controller/Admin/AdvisoryCrudController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace App\Controller\Admin;
66

7+
use App\Admin\Field\AffectedSitesField;
78
use App\Admin\Field\SourcesField;
89
use App\Admin\Field\TextMonospaceField;
910
use App\Entity\Advisory;
@@ -58,6 +59,7 @@ public function configureFields(string $pageName): iterable
5859
yield DateField::new('reportedAt')->setColumns(6)->onlyOnIndex();
5960
yield DateTimeField::new('reportedAt')->setColumns(6)->onlyOnDetail();
6061
yield SourcesField::new('sourceLinks')->setColumns(6)->onlyOnDetail();
62+
yield AffectedSitesField::new('sites')->setLabel('Affected Sites');
6163
}
6264

6365
#[\Override]

src/Entity/Advisory.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,23 @@ public function removePackageVersion(PackageVersion $packageVersion): self
190190
return $this;
191191
}
192192

193+
/**
194+
* @return Collection<int, Site>
195+
*/
196+
public function getSites(): Collection
197+
{
198+
$sites = [];
199+
foreach ($this->packageVersions as $packageVersion) {
200+
foreach ($packageVersion->getInstallations() as $installation) {
201+
foreach ($installation->getSites() as $site) {
202+
$sites[$site->getId()->toRfc4122()] = $site;
203+
}
204+
}
205+
}
206+
207+
return new ArrayCollection(array_values($sites));
208+
}
209+
193210
public function getPackage(): ?Package
194211
{
195212
return $this->package;

src/Entity/Site.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ public function setType(string $type): self
200200
return $this;
201201
}
202202

203-
public function getAdvisoryCount(): int
203+
/**
204+
* @return Collection<int, Advisory>
205+
*/
206+
public function getAdvisories(): Collection
204207
{
205208
$advisories = new ArrayCollection();
206209
foreach ($this->installation->getPackageVersions() as $packageVersion) {
@@ -209,6 +212,11 @@ public function getAdvisoryCount(): int
209212
}
210213
}
211214

212-
return $advisories->count();
215+
return $advisories;
216+
}
217+
218+
public function getAdvisoryCount(): int
219+
{
220+
return $this->getAdvisories()->count();
213221
}
214222
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
2+
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
3+
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
4+
{% if ea().crud.currentAction == 'detail' %}
5+
{% set advisories = entity.instance.advisories %}
6+
{% if advisories|length > 0 %}
7+
<table class="table table-sm table-borderless">
8+
<thead>
9+
<tr>
10+
<th>Package</th>
11+
<th>CVE</th>
12+
<th>Title</th>
13+
</tr>
14+
</thead>
15+
<tbody>
16+
{% for advisory in advisories %}
17+
{% set url = ea_url()
18+
.unsetAll()
19+
.setController('App\\Controller\\Admin\\AdvisoryCrudController')
20+
.setAction('detail')
21+
.setEntityId(advisory.id) %}
22+
<tr>
23+
<td>{{ advisory.package }}</td>
24+
<td><a href="{{ url }}">{{ advisory.cve ?? advisory.advisoryId }}</a></td>
25+
<td>{{ advisory.title }}</td>
26+
</tr>
27+
{% endfor %}
28+
</tbody>
29+
</table>
30+
{% endif %}
31+
{% elseif field.formattedValue != 0 %}
32+
<span class="badge badge-danger">{{ field.formattedValue }}</span>
33+
{% endif %}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
2+
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
3+
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
4+
{% set sites = entity.instance.sites %}
5+
{% if ea().crud.currentAction == 'detail' %}
6+
{% if sites|length > 0 %}
7+
<table class="table table-sm table-borderless">
8+
<thead>
9+
<tr>
10+
<th>Domain</th>
11+
<th>Server</th>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
{% for site in sites %}
16+
{% set url = ea_url()
17+
.unsetAll()
18+
.setController('App\\Controller\\Admin\\SiteCrudController')
19+
.setAction('detail')
20+
.setEntityId(site.id) %}
21+
<tr>
22+
<td><a href="{{ url }}">{{ site.primaryDomain }}</a></td>
23+
<td>{{ site.server }}</td>
24+
</tr>
25+
{% endfor %}
26+
</tbody>
27+
</table>
28+
{% else %}
29+
<span class="text-muted">None</span>
30+
{% endif %}
31+
{% else %}
32+
<span class="badge badge-info">{{ sites|length }}</span>
33+
{% endif %}

0 commit comments

Comments
 (0)