Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc39e46bfd |
@@ -2,17 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Monitor\Framework\Controller;
|
namespace App\Monitor\Framework\Controller;
|
||||||
|
|
||||||
use App\Download\Action\Input\DeleteDownloadInput;
|
|
||||||
use App\Monitor\Action\Handler\AddMonitorHandler;
|
use App\Monitor\Action\Handler\AddMonitorHandler;
|
||||||
use App\Monitor\Action\Handler\DeleteMonitorHandler;
|
use App\Monitor\Action\Handler\DeleteMonitorHandler;
|
||||||
use App\Monitor\Action\Input\AddMonitorInput;
|
use App\Monitor\Action\Input\AddMonitorInput;
|
||||||
use App\Monitor\Action\Input\DeleteMonitorInput;
|
use App\Monitor\Action\Input\DeleteMonitorInput;
|
||||||
use App\Util\Broadcaster;
|
use App\Util\Broadcaster;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Bundle\SecurityBundle\Security;
|
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
|
||||||
use Symfony\Component\Mercure\HubInterface;
|
use Symfony\Component\Mercure\HubInterface;
|
||||||
use Symfony\Component\Mercure\Update;
|
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
class ApiController extends AbstractController
|
class ApiController extends AbstractController
|
||||||
@@ -46,19 +42,9 @@ class ApiController extends AbstractController
|
|||||||
public function deleteMonitor(
|
public function deleteMonitor(
|
||||||
DeleteMonitorInput $input,
|
DeleteMonitorInput $input,
|
||||||
DeleteMonitorHandler $handler,
|
DeleteMonitorHandler $handler,
|
||||||
HubInterface $hub,
|
|
||||||
) {
|
) {
|
||||||
$response = $handler->handle($input->toCommand());
|
$response = $handler->handle($input->toCommand());
|
||||||
|
|
||||||
$hub->publish(new Update(
|
|
||||||
'alerts',
|
|
||||||
$this->renderer->render('broadcast/Alert.stream.html.twig', [
|
|
||||||
'alert_id' => uniqid(),
|
|
||||||
'title' => 'Success',
|
|
||||||
'message' => "New monitor added for {$response->monitor->getTitle()}",
|
|
||||||
])
|
|
||||||
));
|
|
||||||
|
|
||||||
return $this->json([
|
return $this->json([
|
||||||
'status' => 200,
|
'status' => 200,
|
||||||
'message' => $response
|
'message' => $response
|
||||||
|
|||||||
Reference in New Issue
Block a user