fix: monitors page & pagination

This commit is contained in:
2025-06-01 14:07:29 -05:00
parent b1ccf3bf00
commit 393e3ef41f
8 changed files with 90 additions and 10 deletions

View File

@@ -4,13 +4,19 @@ namespace App\Twig\Components;
use App\Monitor\Framework\Repository\MonitorRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveAction;
use Symfony\UX\LiveComponent\Attribute\LiveArg;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\DefaultActionTrait;
#[AsTwigComponent]
#[AsLiveComponent]
final class MonitorList extends AbstractController
{
use DefaultActionTrait;
use PaginateTrait;
#[LiveProp(writable: true)]
public bool $isWidget = true;
public function __construct(
@@ -18,8 +24,8 @@ final class MonitorList extends AbstractController
) {}
#[LiveAction]
public function getUserMonitors(#[LiveArg] int $page = 1, #[LiveArg] int $perPage = 5)
public function getUserMonitors()
{
return $this->monitorRepository->getUserMonitorsPaginated($this->getUser(), $page, $perPage);
return $this->monitorRepository->getUserMonitorsPaginated($this->getUser(), $this->pageNumber, $this->perPage);
}
}