36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
// src/Controller/Admin/SystemAgentController.php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
use App\Service\Admin\IndexNdjsonInspector;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
#[IsGranted('ROLE_SUPER_ADMIN')]
|
|
final class SystemAgentController extends AbstractController
|
|
{
|
|
#[Route('/admin/system/agent', name: 'admin_system_agent', methods: ['GET'])]
|
|
public function index(Request $request, IndexNdjsonInspector $inspector): Response
|
|
{
|
|
$page = max(1, (int) $request->query->get('page', 1));
|
|
$limit = max(1, min(200, (int) $request->query->get('limit', 50)));
|
|
|
|
$paths = $inspector->getPaths();
|
|
$meta = $inspector->readMeta();
|
|
$ndjsonPage = $inspector->readNdjsonPage($page, $limit);
|
|
|
|
return $this->render('admin/system/agent_overview.html.twig', [
|
|
'paths' => $paths,
|
|
'meta' => $meta,
|
|
'ndjson' => $ndjsonPage,
|
|
'debugCount'=>count($ndjsonPage['items'])
|
|
]);
|
|
}
|
|
}
|