From 2263734129e4b4fe38bcd2f7c4b5beebfe81a3cc Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 25 Oct 2024 11:42:37 +0200 Subject: [PATCH] save sentinel form update --- app/Livewire/Server/Form.php | 16 ++- bootstrap/helpers/shared.php | 7 -- .../views/livewire/server/form.blade.php | 109 +++++++++--------- 3 files changed, 67 insertions(+), 65 deletions(-) diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php index 335b17396..82d9f5d8e 100644 --- a/app/Livewire/Server/Form.php +++ b/app/Livewire/Server/Form.php @@ -178,6 +178,19 @@ class Form extends Component } } + public function saveSentinel() + { + try { + $this->validate(); + $this->server->settings->save(); + $this->dispatch('success', 'Sentinel updated.'); + } catch (\Throwable $e) { + return handleError($e, $this); + } finally { + $this->checkSyncStatus(); + } + } + public function restartSentinel($notification = true) { try { @@ -185,7 +198,8 @@ class Form extends Component $this->validate([ 'server.settings.sentinel_custom_url' => 'required|url', ]); - $this->server->restartSentinel(); + $this->server->settings->save(); + $this->server->restartSentinel(async: false); if ($notification) { $this->dispatch('success', 'Sentinel restarted.'); } diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index d658be125..7ae9df749 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -173,9 +173,6 @@ function get_latest_sentinel_version(): string return data_get($versions, 'coolify.sentinel.version'); } catch (\Throwable $e) { - //throw $e; - ray($e->getMessage()); - return '0.0.0'; } } @@ -362,10 +359,6 @@ function isCloud(): bool return ! config('coolify.self_hosted'); } -function isExperimentalFeaturesEnabled(): bool -{ - return config('coolify.is_experimental_features_enabled'); -} function translate_cron_expression($expression_to_validate): string { if (isset(VALID_CRON_STRINGS[$expression_to_validate])) { diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php index 3f3361124..35ec6c71b 100644 --- a/resources/views/livewire/server/form.blade.php +++ b/resources/views/livewire/server/form.blade.php @@ -158,68 +158,63 @@ @endif - @if (!$server->isSwarm() && !$server->isBuildServer()) - @if (isExperimentalFeaturesEnabled()) -
-

Sentinel

- @if ($server->isSentinelEnabled()) -
settings->sentinel_push_interval_seconds }}s="checkSyncStatus"> - @if ($server->isSentinelLive()) - - Restart - @else - - Sync - @endif -
- @endif -
- @else + + @if ($server->isFunctional() && !$server->isSwarm() && !$server->isBuildServer()) +
+

Sentinel

-
Sentinel is not available in this version (soon).
- @endif - @if (isExperimentalFeaturesEnabled()) -
-
- - @if ($server->isSentinelEnabled()) - + @if ($server->isSentinelEnabled()) +
+ @if ($server->isSentinelLive()) + + Save + Restart @else - + + Save + Sync @endif
+ @endif +
+
+
+ @if ($server->isSentinelEnabled()) -
- - Regenerate -
- - - -
-
- - - -
-
+ + @else + @endif
- @endif - @endif - + @if ($server->isSentinelEnabled()) +
+ + Regenerate +
+ + + +
+
+ + + +
+
+ @endif +
+ + @endif +