refactor server view (phuuu)

This commit is contained in:
Andras Bacsai
2024-10-30 14:54:27 +01:00
parent ee79faf542
commit 96ca72fcdb
38 changed files with 1365 additions and 893 deletions

View File

@@ -63,7 +63,11 @@ class Server extends BaseModel
$payload['ip'] = str($server->ip)->trim();
}
$server->forceFill($payload);
});
static::saved(function ($server) {
if ($server->privateKey->isDirty()) {
refresh_server_connection($server->privateKey);
}
});
static::created(function ($server) {
ServerSetting::create([
@@ -1027,7 +1031,6 @@ $schema://$host {
$this->refresh();
$unreachableNotificationSent = (bool) $this->unreachable_notification_sent;
$isReachable = (bool) $this->settings->is_reachable;
loggy('Server setting is_reachable changed to '.$isReachable.' for server '.$this->id.'. Unreachable notification sent: '.$unreachableNotificationSent);
// If the server is reachable, send the reachable notification if it was sent before
if ($isReachable === true) {
if ($unreachableNotificationSent === true) {