Refactor Livewire server show view to remove redundant code

This commit is contained in:
Andras Bacsai
2024-11-01 23:51:23 +01:00
parent 0a3b5cc4e3
commit 77a019405a

View File

@@ -187,29 +187,26 @@ class Show extends Component
public function updatedIsSentinelDebugEnabled($value) public function updatedIsSentinelDebugEnabled($value)
{ {
$this->server->settings->is_sentinel_debug_enabled = $value; $this->submit();
$this->server->settings->save();
$this->restartSentinel(); $this->restartSentinel();
} }
public function updatedIsMetricsEnabled($value) public function updatedIsMetricsEnabled($value)
{ {
$this->server->settings->is_metrics_enabled = $value; $this->submit();
$this->server->settings->save();
$this->restartSentinel(); $this->restartSentinel();
} }
public function updatedIsSentinelEnabled($value) public function updatedIsSentinelEnabled($value)
{ {
$this->server->settings->is_sentinel_enabled = $value;
if ($value === true) { if ($value === true) {
StartSentinel::run($this->server, true); StartSentinel::run($this->server, true);
} else { } else {
$this->server->settings->is_metrics_enabled = false; $this->isMetricsEnabled = false;
$this->server->settings->is_sentinel_debug_enabled = false; $this->isSentinelDebugEnabled = false;
StopSentinel::dispatch($this->server); StopSentinel::dispatch($this->server);
} }
$this->server->settings->save(); $this->submit();
} }