From 04440fc5e3c312b36fc5b278a322c92fc96c2767 Mon Sep 17 00:00:00 2001 From: Rune Piper Date: Wed, 24 Apr 2024 13:37:05 +0200 Subject: [PATCH 1/2] feat: add version to systeminformation --- .../AddVersionToSystemInformationToolbar.php | 26 +++++++++++++++++++ Configuration/Services.yaml | 4 +++ 2 files changed, 30 insertions(+) create mode 100644 Classes/EventListener/AddVersionToSystemInformationToolbar.php diff --git a/Classes/EventListener/AddVersionToSystemInformationToolbar.php b/Classes/EventListener/AddVersionToSystemInformationToolbar.php new file mode 100644 index 0000000..c58e446 --- /dev/null +++ b/Classes/EventListener/AddVersionToSystemInformationToolbar.php @@ -0,0 +1,26 @@ +get('t3meilisearch'); + $client = new Client($settings['host'], $settings['apiKey']); + $version = $client->version()['pkgVersion']; + + $event->getToolbarItem()->addSystemInformation( + 'Meilisearch Version', + $version, + 'actions-search', + InformationStatus::STATUS_NOTICE + ); + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 7a2a051..6f3857f 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -6,3 +6,7 @@ services: VV\T3meilisearch\: resource: '../Classes/*' + + VV\T3meilisearch\EventListener\AddVersionToSystemInformationToolbar: + tags: + - name: event.listener From 68806408cf0eb6ac22b50569997e3fbafae7bedc Mon Sep 17 00:00:00 2001 From: Rune Piper Date: Wed, 24 Apr 2024 13:38:09 +0200 Subject: [PATCH 2/2] chore: use correct coding style --- .../EventListener/AddVersionToSystemInformationToolbar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/EventListener/AddVersionToSystemInformationToolbar.php b/Classes/EventListener/AddVersionToSystemInformationToolbar.php index c58e446..1a2a83d 100644 --- a/Classes/EventListener/AddVersionToSystemInformationToolbar.php +++ b/Classes/EventListener/AddVersionToSystemInformationToolbar.php @@ -2,11 +2,11 @@ namespace VV\T3meilisearch\EventListener; +use MeiliSearch\Client; use TYPO3\CMS\Backend\Backend\Event\SystemInformationToolbarCollectorEvent; use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; -use MeiliSearch\Client; class AddVersionToSystemInformationToolbar { @@ -20,7 +20,7 @@ public function __invoke(SystemInformationToolbarCollectorEvent $event): void 'Meilisearch Version', $version, 'actions-search', - InformationStatus::STATUS_NOTICE + InformationStatus::STATUS_NOTICE ); } }