save sentinel form update
This commit is contained in:
@@ -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)
|
public function restartSentinel($notification = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -185,7 +198,8 @@ class Form extends Component
|
|||||||
$this->validate([
|
$this->validate([
|
||||||
'server.settings.sentinel_custom_url' => 'required|url',
|
'server.settings.sentinel_custom_url' => 'required|url',
|
||||||
]);
|
]);
|
||||||
$this->server->restartSentinel();
|
$this->server->settings->save();
|
||||||
|
$this->server->restartSentinel(async: false);
|
||||||
if ($notification) {
|
if ($notification) {
|
||||||
$this->dispatch('success', 'Sentinel restarted.');
|
$this->dispatch('success', 'Sentinel restarted.');
|
||||||
}
|
}
|
||||||
|
@@ -173,9 +173,6 @@ function get_latest_sentinel_version(): string
|
|||||||
|
|
||||||
return data_get($versions, 'coolify.sentinel.version');
|
return data_get($versions, 'coolify.sentinel.version');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
//throw $e;
|
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return '0.0.0';
|
return '0.0.0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,10 +359,6 @@ function isCloud(): bool
|
|||||||
return ! config('coolify.self_hosted');
|
return ! config('coolify.self_hosted');
|
||||||
}
|
}
|
||||||
|
|
||||||
function isExperimentalFeaturesEnabled(): bool
|
|
||||||
{
|
|
||||||
return config('coolify.is_experimental_features_enabled');
|
|
||||||
}
|
|
||||||
function translate_cron_expression($expression_to_validate): string
|
function translate_cron_expression($expression_to_validate): string
|
||||||
{
|
{
|
||||||
if (isset(VALID_CRON_STRINGS[$expression_to_validate])) {
|
if (isset(VALID_CRON_STRINGS[$expression_to_validate])) {
|
||||||
|
@@ -158,68 +158,63 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (!$server->isSwarm() && !$server->isBuildServer())
|
</form>
|
||||||
@if (isExperimentalFeaturesEnabled())
|
@if ($server->isFunctional() && !$server->isSwarm() && !$server->isBuildServer())
|
||||||
<div class="flex gap-2 items-center pt-4 pb-2">
|
<form wire:submit.prevent='saveSentinel'>
|
||||||
<h3>Sentinel</h3>
|
<div class="flex gap-2 items-center pt-4 pb-2">
|
||||||
@if ($server->isSentinelEnabled())
|
|
||||||
<div class="flex gap-2 items-center"
|
|
||||||
wire:poll.{{ $server->settings->sentinel_push_interval_seconds }}s="checkSyncStatus">
|
|
||||||
@if ($server->isSentinelLive())
|
|
||||||
<x-status.running status="In sync" noLoading
|
|
||||||
title="{{ $server->sentinel_updated_at }}" />
|
|
||||||
<x-forms.button wire:click='restartSentinel'>Restart</x-forms.button>
|
|
||||||
@else
|
|
||||||
<x-status.stopped status="Out of sync" noLoading
|
|
||||||
title="{{ $server->sentinel_updated_at }}" />
|
|
||||||
<x-forms.button wire:click='restartSentinel'>Sync</x-forms.button>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<h3>Sentinel</h3>
|
<h3>Sentinel</h3>
|
||||||
<div>Sentinel is not available in this version (soon).</div>
|
@if ($server->isSentinelEnabled())
|
||||||
@endif
|
<div class="flex gap-2 items-center">
|
||||||
@if (isExperimentalFeaturesEnabled())
|
@if ($server->isSentinelLive())
|
||||||
<div class="flex flex-col gap-2">
|
<x-status.running status="In sync" noLoading title="{{ $server->sentinel_updated_at }}" />
|
||||||
<div class="w-64">
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
<x-forms.checkbox wire:model.live="server.settings.is_sentinel_enabled"
|
<x-forms.button wire:click='restartSentinel'>Restart</x-forms.button>
|
||||||
label="Enable Sentinel" />
|
|
||||||
@if ($server->isSentinelEnabled())
|
|
||||||
<x-forms.checkbox instantSave id="server.settings.is_metrics_enabled"
|
|
||||||
label="Enable Metrics" />
|
|
||||||
@else
|
@else
|
||||||
<x-forms.checkbox instantSave disabled id="server.settings.is_metrics_enabled"
|
<x-status.stopped status="Out of sync" noLoading
|
||||||
label="Enable Metrics" />
|
title="{{ $server->sentinel_updated_at }}" />
|
||||||
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
|
<x-forms.button wire:click='restartSentinel'>Sync</x-forms.button>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<div class="w-64">
|
||||||
|
<x-forms.checkbox wire:model.live="server.settings.is_sentinel_enabled" label="Enable Sentinel" />
|
||||||
@if ($server->isSentinelEnabled())
|
@if ($server->isSentinelEnabled())
|
||||||
<div class="flex flex-wrap gap-2 sm:flex-nowrap items-end">
|
<x-forms.checkbox instantSave id="server.settings.is_metrics_enabled"
|
||||||
<x-forms.input type="password" id="server.settings.sentinel_token" label="Sentinel token"
|
label="Enable Metrics" />
|
||||||
required helper="Token for Sentinel." />
|
@else
|
||||||
<x-forms.button wire:click="regenerateSentinelToken">Regenerate</x-forms.button>
|
<x-forms.checkbox instantSave disabled id="server.settings.is_metrics_enabled"
|
||||||
</div>
|
label="Enable Metrics" />
|
||||||
|
|
||||||
<x-forms.input id="server.settings.sentinel_custom_url" required label="Coolify URL"
|
|
||||||
helper="URL to your Coolify instance. If it is empty that means you do not have a FQDN set for your Coolify instance." />
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<div class="flex flex-wrap gap-2 sm:flex-nowrap">
|
|
||||||
<x-forms.input id="server.settings.sentinel_metrics_refresh_rate_seconds"
|
|
||||||
label="Metrics rate (seconds)" required
|
|
||||||
helper="The interval for gathering metrics. Lower means more disk space will be used." />
|
|
||||||
<x-forms.input id="server.settings.sentinel_metrics_history_days"
|
|
||||||
label="Metrics history (days)" required
|
|
||||||
helper="How many days should the metrics data should be reserved." />
|
|
||||||
<x-forms.input id="server.settings.sentinel_push_interval_seconds"
|
|
||||||
label="Push interval (seconds)" required
|
|
||||||
helper="How many seconds should the metrics data should be pushed to the collector." />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@if ($server->isSentinelEnabled())
|
||||||
@endif
|
<div class="flex flex-wrap gap-2 sm:flex-nowrap items-end">
|
||||||
</form>
|
<x-forms.input type="password" id="server.settings.sentinel_token" label="Sentinel token"
|
||||||
|
required helper="Token for Sentinel." />
|
||||||
|
<x-forms.button wire:click="regenerateSentinelToken">Regenerate</x-forms.button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<x-forms.input id="server.settings.sentinel_custom_url" required label="Coolify URL"
|
||||||
|
helper="URL to your Coolify instance. If it is empty that means you do not have a FQDN set for your Coolify instance." />
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<div class="flex flex-wrap gap-2 sm:flex-nowrap">
|
||||||
|
<x-forms.input id="server.settings.sentinel_metrics_refresh_rate_seconds"
|
||||||
|
label="Metrics rate (seconds)" required
|
||||||
|
helper="The interval for gathering metrics. Lower means more disk space will be used." />
|
||||||
|
<x-forms.input id="server.settings.sentinel_metrics_history_days"
|
||||||
|
label="Metrics history (days)" required
|
||||||
|
helper="How many days should the metrics data should be reserved." />
|
||||||
|
<x-forms.input id="server.settings.sentinel_push_interval_seconds"
|
||||||
|
label="Push interval (seconds)" required
|
||||||
|
helper="How many seconds should the metrics data should be pushed to the collector." />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user