fix: service config hash update

This commit is contained in:
Andras Bacsai 2024-04-12 13:15:24 +02:00
parent 7a32b8d1d2
commit 45281360d5
5 changed files with 31 additions and 19 deletions

View File

@ -66,7 +66,7 @@ public function check_status()
try { try {
dispatch_sync(new ContainerStatusJob($this->service->server)); dispatch_sync(new ContainerStatusJob($this->service->server));
$this->dispatch('refresh')->self(); $this->dispatch('refresh')->self();
$this->dispatch('serviceStatusChanged'); $this->dispatch('updateStatus');
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -30,23 +30,20 @@ public function getListeners()
$userId = auth()->user()->id; $userId = auth()->user()->id;
return [ return [
"echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted', "echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',
"serviceStatusChanged" "updateStatus"=> '$refresh',
]; ];
} }
public function serviceStarted() public function serviceStarted()
{ {
$this->dispatch('success', 'Service status changed.'); $this->dispatch('success', 'Service status changed.');
if (is_null($this->service->config_hash) || $this->service->isConfigurationChanged()) {
$this->service->isConfigurationChanged(true);
$this->dispatch('configurationChanged');
} else {
$this->dispatch('configurationChanged');
}
} }
public function serviceStatusChanged()
{
$this->dispatch('refresh')->self();
// if (is_null($this->service->config_hash) || $this->service->isConfigurationChanged()) {
// $this->service->isConfigurationChanged(true);
// $this->dispatch('configurationChanged');
// } else {
// $this->dispatch('configurationChanged');
// }
}
public function check_status() public function check_status()
{ {
$this->dispatch('check_status'); $this->dispatch('check_status');

View File

@ -1,9 +1,14 @@
<div {{ $attributes->merge(['class' => "group"]) }}> <div {{ $attributes->merge(['class' => 'group']) }}>
<div class="info-helper"> <div class="info-helper">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 stroke-current"> @isset($icon)
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" {{ $icon }}
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> @else
</svg> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
@endisset
</div> </div>
<div class="info-helper-popup"> <div class="info-helper-popup">
<div class="p-4"> <div class="p-4">

View File

@ -9,7 +9,17 @@
{{ str($status)->before(':')->headline() }} {{ str($status)->before(':')->headline() }}
</div> </div>
@if (!str($status)->startsWith('Proxy') && !str($status)->contains('(')) @if (!str($status)->startsWith('Proxy') && !str($status)->contains('('))
<div class="text-xs {{ str($status)->contains('unhealthy') ? 'dark:text-warning' : 'text-success' }}">({{ str($status)->after(':') }})</div> @if (str($status)->contains('unhealthy'))
<x-helper helper="Unhealthy state. <span class='dark:text-warning text-coollabs'>This doesn't mean that the resource is malfunctioning.</span><br><br>- If the resource is accessible, it indicates that no health check is configured - it is not mandatory.<br>- If the resource is not accessible (returning 404 or 503), it may indicate that a health check is needed and has not passed. <span class='dark:text-warning text-coollabs'>Your action is required.</span>" >
<x-slot:icon>
<svg class="hidden w-4 h-4 dark:text-warning lg:block" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor" d="M240.26 186.1L152.81 34.23a28.74 28.74 0 0 0-49.62 0L15.74 186.1a27.45 27.45 0 0 0 0 27.71A28.31 28.31 0 0 0 40.55 228h174.9a28.31 28.31 0 0 0 24.79-14.19a27.45 27.45 0 0 0 .02-27.71m-20.8 15.7a4.46 4.46 0 0 1-4 2.2H40.55a4.46 4.46 0 0 1-4-2.2a3.56 3.56 0 0 1 0-3.73L124 46.2a4.77 4.77 0 0 1 8 0l87.44 151.87a3.56 3.56 0 0 1 .02 3.73M116 136v-32a12 12 0 0 1 24 0v32a12 12 0 0 1-24 0m28 40a16 16 0 1 1-16-16a16 16 0 0 1 16 16"></path>
</svg>
</x-slot:icon>
</x-helper>
{{-- @else
<div class="text-xs dark:text-success">({{ str($status)->after(':') }})</div> --}}
@endif
@endif @endif
</span> </span>
</div> </div>

View File

@ -1,5 +1,5 @@
<form wire:submit.prevent='submit' class="flex flex-col w-full gap-2"> <form wire:submit.prevent='submit' class="flex flex-col w-full gap-2">
<x-forms.input required placeholder="https://app.coolify.io" label="Domains" id="application.fqdn" <x-forms.input required placeholder="https://app.coolify.io" label="Domains" id="application.fqdn"
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. "></x-forms.input> helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. "></x-forms.input>
<x-forms.button type="submit">Save</x-forms.button> <x-forms.button type="submit">Save</x-forms.button>
</form> </form>