fix(sentinel): Add missing instantSave method and prevent duplicate notifications

- Add public instantSave() method to handle instant saves from checkbox clicks
- Remove redundant updatedIsMetricsEnabled() and updatedIsSentinelDebugEnabled() hooks
- These hooks were causing duplicate notifications when checkboxes were toggled

The instantSave attribute on checkboxes triggers wire:click='instantSave', which was failing
because the method didn't exist. Now it saves settings and restarts Sentinel in one action,
preventing the duplicate updates from both wire:click and wire:model events.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-12-23 15:34:09 +01:00
parent f77a2674fc
commit f995426fb3

View file

@ -110,26 +110,6 @@ public function restartSentinel()
}
}
public function updatedIsSentinelDebugEnabled($value)
{
try {
$this->submit();
$this->restartSentinel();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function updatedIsMetricsEnabled($value)
{
try {
$this->submit();
$this->restartSentinel();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function updatedIsSentinelEnabled($value)
{
try {
@ -175,6 +155,16 @@ public function submit()
}
}
public function instantSave()
{
try {
$this->syncData(true);
$this->restartSentinel();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function render()
{
return view('livewire.server.sentinel');