diff --git a/app/Livewire/Project/Service/Configuration.php b/app/Livewire/Project/Service/Configuration.php index cdedb3f8e..ea0e804b7 100644 --- a/app/Livewire/Project/Service/Configuration.php +++ b/app/Livewire/Project/Service/Configuration.php @@ -18,7 +18,8 @@ public function getListeners() $userId = auth()->user()->id; return [ "echo-private:user.{$userId},ServiceStatusChanged" => 'check_status', - "check_status" + "check_status", + "refresh" => '$refresh', ]; } public function render() diff --git a/app/Livewire/Project/Service/EditDomain.php b/app/Livewire/Project/Service/EditDomain.php new file mode 100644 index 000000000..246d43421 --- /dev/null +++ b/app/Livewire/Project/Service/EditDomain.php @@ -0,0 +1,52 @@ + 'nullable', + 'application.required_fqdn' => 'required|boolean', + ]; + public function mount() { + $this->application = ServiceApplication::find($this->applicationId); + } + public function updatedApplicationFqdn() + { + $this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim(); + $this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim(); + $this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) { + return str($domain)->trim()->lower(); + }); + $this->application->fqdn = $this->application->fqdn->unique()->implode(','); + $this->application->save(); + } + public function submit() + { + try { + check_domain_usage(resource: $this->application); + $this->validate(); + $this->application->save(); + updateCompose($this->application); + if (str($this->application->fqdn)->contains(',')) { + $this->dispatch('warning', 'Some services do not support multiple domains, which can lead to problems and is NOT RECOMMENDED.

Only use multiple domains if you know what you are doing.'); + } else { + $this->dispatch('success', 'Service saved.'); + } + } catch (\Throwable $e) { + return handleError($e, $this); + } finally { + $this->dispatch('generateDockerCompose'); + $this->dispatch('refresh'); + } + } + public function render() + { + return view('livewire.project.service.edit-domain'); + } +} diff --git a/resources/views/livewire/project/service/configuration.blade.php b/resources/views/livewire/project/service/configuration.blade.php index 54c7dfffd..e90d2d605 100644 --- a/resources/views/livewire/project/service/configuration.blade.php +++ b/resources/views/livewire/project/service/configuration.blade.php @@ -45,13 +45,13 @@
@foreach ($applications as $application)
Str::of( + 'border-l border-dashed border-red-500 ' => Str::of( $application->status)->contains(['exited']), 'border-l border-dashed border-success' => Str::of( $application->status)->contains(['running']), 'border-l border-dashed border-warning' => Str::of( $application->status)->contains(['starting']), - 'flex gap-2 box-without-bg dark:bg-coolgray-100 bg-white dark:hover:text-neutral-300 group', + 'flex gap-2 box-without-bg-without-border dark:bg-coolgray-100 bg-white dark:hover:text-neutral-300 group', ])>
@@ -70,9 +70,29 @@ {{ Str::limit($application->description, 60) }} @endif @if ($application->fqdn) - {{ Str::limit($application->fqdn, 60) }} + {{ Str::limit($application->fqdn, 60) }} + + + + + + + + + + + + + + + @endif -
{{ $application->status }}
+ {{--
{{ $application->status }}
--}}
status)->contains(['running']), 'border-l border-dashed border-warning' => Str::of( $database->status)->contains(['restarting']), - 'flex gap-2 box-without-bg dark:bg-coolgray-100 bg-white dark:hover:text-neutral-300 group', + 'flex gap-2 box-without-bg-without-border dark:bg-coolgray-100 bg-white dark:hover:text-neutral-300 group', ])>
@@ -120,8 +140,8 @@ href="{{ route('project.service.index', [...$parameters, 'stack_service_uuid' => $database->uuid]) }}"> Settings - + This database will be unavailable during the restart.
Please think again.
diff --git a/resources/views/livewire/project/service/edit-domain.blade.php b/resources/views/livewire/project/service/edit-domain.blade.php new file mode 100644 index 000000000..ff8f03bf5 --- /dev/null +++ b/resources/views/livewire/project/service/edit-domain.blade.php @@ -0,0 +1,5 @@ +
+ + Save +