Fix log drain issue in advanced and service application

This commit is contained in:
Andras Bacsai 2023-11-22 14:21:03 +01:00
parent 5e27b88bef
commit 25a0489f7f
2 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ class Advanced extends Component
]; ];
public function instantSave() public function instantSave()
{ {
if ($this->application->settings->is_log_drain_enabled) { if ($this->application->isLogDrainEnabled()) {
if (!$this->application->destination->server->isLogDrainEnabled()) { if (!$this->application->destination->server->isLogDrainEnabled()) {
$this->application->settings->is_log_drain_enabled = false; $this->application->settings->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on this server.'); $this->emit('error', 'Log drain is not enabled on this server.');

View File

@ -28,7 +28,12 @@ public function instantSave()
} }
public function instantSaveAdvanced() public function instantSaveAdvanced()
{ {
$this->submit(); if (!$this->application->service->destination->server->isLogDrainEnabled()) {
$this->application->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.');
return;
}
$this->application->save();
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->emit('success', 'You need to restart the service for the changes to take effect.');
} }
public function delete() public function delete()
@ -49,11 +54,6 @@ public function submit()
{ {
try { try {
$this->validate(); $this->validate();
if (!$this->application->service->destination->server->isLogDrainEnabled()) {
$this->application->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.');
return;
}
$this->application->save(); $this->application->save();
updateCompose($this->application); updateCompose($this->application);
$this->emit('success', 'Application saved successfully.'); $this->emit('success', 'Application saved successfully.');