diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c7c06..ca49197 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [#174](https://github.com/itk-dev/devops_itksites/pull/174) + Show detection result errors and warnings as readable messages instead of + JSON, so long messages are no longer cut off + ## [1.20.0] - 2026-11-04 - [#172](https://github.com/itk-dev/devops_itksites/pull/172) diff --git a/src/Controller/Admin/DetectionResultCrudController.php b/src/Controller/Admin/DetectionResultCrudController.php index ba57bd0..dc085e8 100644 --- a/src/Controller/Admin/DetectionResultCrudController.php +++ b/src/Controller/Admin/DetectionResultCrudController.php @@ -55,12 +55,10 @@ public function configureFields(string $pageName): iterable yield DateTimeField::new('modifiedAt')->hideOnIndex(); yield DateTimeField::new('lastContact'); yield TextMonospaceField::new('harvesterVersion'); - yield Field::new('prettyErrors')->onlyOnDetail()->setLabel('Errors') - ->setTemplatePath('EasyAdminBundle/Fields/code_highlight.html.twig') - ->setCustomOption('language', 'json'); - yield Field::new('prettyWarnings')->onlyOnDetail()->setLabel('Warnings') - ->setTemplatePath('EasyAdminBundle/Fields/code_highlight.html.twig') - ->setCustomOption('language', 'json'); + yield Field::new('errors')->onlyOnDetail() + ->setTemplatePath('EasyAdminBundle/Fields/harvester_messages.html.twig'); + yield Field::new('warnings')->onlyOnDetail() + ->setTemplatePath('EasyAdminBundle/Fields/harvester_messages.html.twig'); yield Field::new('prettyData')->onlyOnDetail()->setLabel('Data') ->setTemplatePath('EasyAdminBundle/Fields/code_highlight.html.twig') ->setCustomOption('language', 'json'); diff --git a/src/Entity/DetectionResult.php b/src/Entity/DetectionResult.php index c9b5003..cae5cc5 100644 --- a/src/Entity/DetectionResult.php +++ b/src/Entity/DetectionResult.php @@ -219,16 +219,6 @@ public function setWarnings(array $warnings): self return $this; } - public function getPrettyErrors(): string - { - return json_encode($this->errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); - } - - public function getPrettyWarnings(): string - { - return json_encode($this->warnings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR); - } - public function getHash(): ?string { return $this->hash; diff --git a/templates/EasyAdminBundle/Fields/harvester_messages.html.twig b/templates/EasyAdminBundle/Fields/harvester_messages.html.twig new file mode 100644 index 0000000..eb24295 --- /dev/null +++ b/templates/EasyAdminBundle/Fields/harvester_messages.html.twig @@ -0,0 +1,22 @@ +{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #} +{# Errors or warnings from the harvester: a list of {source, message} with + optional container, command and exitCode. #} +{% if field.value is empty %} + None +{% else %} +
{{ item.command }}
+ {% endif %}
+ {{ item.message }}
+