IT-Service: /api/ex ergänzen, HTML-Antworten als Fehler, Kategorie und Standort Pflicht
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m35s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m32s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m54s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m53s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m1s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m17s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m31s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m11s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m33s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 20:17:39 +00:00
parent df7ebfa6cd
commit 7969a7ac83
108 changed files with 525 additions and 445 deletions

View file

@ -13,7 +13,7 @@ use Filament\Pages\Page;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Inhaus\Plugins\ItService\OpenNit\Client;
use Inhaus\Plugins\ItService\ItService;
use Inhaus\Plugins\ItService\OpenNit\OpenNitException;
use Inhaus\Plugins\ItService\OpenNit\Settings;
use UnitEnum;
@ -66,6 +66,7 @@ class ItServiceSettings extends Page
TextInput::make('url')
->label('API-Adresse')
->placeholder('https://itdoku.example.de/api/ex')
->helperText('Nur die Serveradresse eingetragen? „/api/ex“ wird automatisch ergänzt.')
->url()
->required()
->regex('#^https://#i')
@ -120,11 +121,15 @@ class ItServiceSettings extends Page
->label('Verbindung testen')
->icon(Heroicon::OutlinedSignal)
->color('gray')
->action(function (Client $client) {
->action(function () {
try {
$categories = count((array) ($client->get('/ticket-categories')['categories'] ?? []));
$types = count((array) ($client->get('/device-types')['types'] ?? []));
Notification::make()->success()->title('Verbindung klappt')->body("{$categories} Ticket-Kategorien und {$types} Gerätetypen gefunden.")->send();
$it = app(ItService::class);
$options = $it->ticketOptions();
$types = $it->deviceTypes();
$devices = $it->loanDevices(null, null, null);
Notification::make()->success()->title('Verbindung klappt')
->body(sprintf('%d Ticket-Kategorien, %d Standorte, %d Gerätetypen und %d Leihgeräte gefunden.', count($options['categories']), count($options['locations']), count($types), count($devices)))
->send();
} catch (OpenNitException $e) {
Notification::make()->danger()->title('Keine Verbindung')->body($e->getMessage().($e->status ? " (HTTP {$e->status})" : ''))->persistent()->send();
}