feat: use new ServerReachabilityChanged event instead of isDirty
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Events\ServerReachabilityChanged;
|
||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
@@ -92,6 +93,8 @@ class CloudCleanupSubscriptions extends Command
|
|||||||
$server->update([
|
$server->update([
|
||||||
'ip' => '1.2.3.4',
|
'ip' => '1.2.3.4',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
ServerReachabilityChanged::dispatch($server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Livewire\Server;
|
|||||||
|
|
||||||
use App\Actions\Server\StartSentinel;
|
use App\Actions\Server\StartSentinel;
|
||||||
use App\Actions\Server\StopSentinel;
|
use App\Actions\Server\StopSentinel;
|
||||||
|
use App\Events\ServerReachabilityChanged;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Livewire\Attributes\Computed;
|
use Livewire\Attributes\Computed;
|
||||||
use Livewire\Attributes\Validate;
|
use Livewire\Attributes\Validate;
|
||||||
@@ -202,6 +203,7 @@ class Show extends Component
|
|||||||
$this->server->settings->is_reachable = $this->isReachable = true;
|
$this->server->settings->is_reachable = $this->isReachable = true;
|
||||||
$this->server->settings->is_usable = $this->isUsable = true;
|
$this->server->settings->is_usable = $this->isUsable = true;
|
||||||
$this->server->settings->save();
|
$this->server->settings->save();
|
||||||
|
ServerReachabilityChanged::dispatch($this->server);
|
||||||
$this->dispatch('proxyStatusUpdated');
|
$this->dispatch('proxyStatusUpdated');
|
||||||
} else {
|
} else {
|
||||||
$this->dispatch('error', 'Server is not reachable.', 'Please validate your configuration and connection.<br><br>Check this <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/openssh">documentation</a> for further help. <br><br>Error: '.$error);
|
$this->dispatch('error', 'Server is not reachable.', 'Please validate your configuration and connection.<br><br>Check this <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/openssh">documentation</a> for further help. <br><br>Error: '.$error);
|
||||||
|
|||||||
@@ -85,9 +85,6 @@ class ServerSetting extends Model
|
|||||||
) {
|
) {
|
||||||
$settings->server->restartSentinel();
|
$settings->server->restartSentinel();
|
||||||
}
|
}
|
||||||
if ($settings->isDirty('is_reachable')) {
|
|
||||||
$settings->server->isReachableChanged();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Events\ServerReachabilityChanged;
|
||||||
use App\Notifications\Channels\SendsDiscord;
|
use App\Notifications\Channels\SendsDiscord;
|
||||||
use App\Notifications\Channels\SendsEmail;
|
use App\Notifications\Channels\SendsEmail;
|
||||||
use App\Notifications\Channels\SendsPushover;
|
use App\Notifications\Channels\SendsPushover;
|
||||||
@@ -202,6 +203,7 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
|
|||||||
'is_usable' => false,
|
'is_usable' => false,
|
||||||
'is_reachable' => false,
|
'is_reachable' => false,
|
||||||
]);
|
]);
|
||||||
|
ServerReachabilityChanged::dispatch($server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user