refactor: Simplify log drain installation and stop log drain if necessary

This commit is contained in:
Andras Bacsai
2024-08-06 10:52:47 +02:00
parent c5de1a25c3
commit 74e8a4a703
3 changed files with 25 additions and 6 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Livewire\Server;
use App\Actions\Server\InstallLogDrain;
use App\Actions\Server\StopLogDrain;
use App\Models\Server;
use Livewire\Component;
@@ -132,6 +133,9 @@ class LogDrains extends Component
'is_logdrain_axiom_enabled' => false,
]);
}
if (! $this->server->isLogDrainEnabled()) {
StopLogDrain::dispatch($this->server);
}
$this->server->settings->save();
$this->dispatch('success', 'Settings saved.');