Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- [#68](https://github.com/itk-dev/devops_itksites/pull/68)
6667: Update advisories on Detailed site display

## [1.9.2] - 2026-04-07

- [#67](https://github.com/itk-dev/devops_itksites/pull/67)
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Field/AdvisoryCountField.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public static function new(string $propertyName, TranslatableInterface|string|bo
->setLabel($label)

// this template is used in 'index' and 'detail' pages
->setTemplatePath('EasyAdminBundle/Fields/advisory_count.html.twig');
->setTemplatePath('EasyAdminBundle/Fields/advisories.html.twig');
}
}
12 changes: 10 additions & 2 deletions src/Entity/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ public function setType(string $type): self
return $this;
}

public function getAdvisoryCount(): int
/**
* @return Collection<int, Advisory>
*/
public function getAdvisories(): Collection
{
$advisories = new ArrayCollection();
foreach ($this->installation->getPackageVersions() as $packageVersion) {
Expand All @@ -209,6 +212,11 @@ public function getAdvisoryCount(): int
}
}

return $advisories->count();
return $advisories;
}

public function getAdvisoryCount(): int
{
return $this->getAdvisories()->count();
}
}
33 changes: 33 additions & 0 deletions templates/EasyAdminBundle/Fields/advisories.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% if ea().crud.currentAction == 'detail' %}
{% set advisories = entity.instance.advisories %}
{% if advisories|length > 0 %}
<table class="table table-sm table-borderless">
<thead>
<tr>
<th>Package</th>
<th>CVE</th>
<th>Title</th>
</tr>
</thead>
<tbody>
{% for advisory in advisories %}
{% set url = ea_url()
.unsetAll()
.setController('App\\Controller\\Admin\\AdvisoryCrudController')
.setAction('detail')
.setEntityId(advisory.id) %}
<tr>
<td>{{ advisory.package }}</td>
<td><a href="{{ url }}">{{ advisory.cve ?? advisory.advisoryId }}</a></td>
<td>{{ advisory.title }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% elseif field.formattedValue != 0 %}
<span class="badge badge-danger">{{ field.formattedValue }}</span>
{% endif %}
6 changes: 0 additions & 6 deletions templates/EasyAdminBundle/Fields/advisory_count.html.twig
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be deleted. It is still used in App\Admin\Field\AdvisoryCountFieldwhich is used by App\Controller\Admin\PackageCrudController and App\Controller\Admin\PackageVersionCrudController

This file was deleted.

Loading