2023-09-30 13:08:40 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
namespace App\Livewire\Modal;
|
2023-09-30 13:08:40 +00:00
|
|
|
|
2023-12-06 13:57:03 +00:00
|
|
|
use App\Models\Service;
|
2023-12-06 14:50:13 +00:00
|
|
|
use LivewireUI\Modal\ModalComponent;
|
2023-09-30 13:08:40 +00:00
|
|
|
|
2023-12-07 12:28:11 +00:00
|
|
|
class EditCompose extends ModalComponent
|
2023-09-30 13:08:40 +00:00
|
|
|
{
|
2023-12-06 13:57:03 +00:00
|
|
|
public Service $service;
|
2023-12-06 14:50:13 +00:00
|
|
|
public $serviceId;
|
2023-12-06 13:57:03 +00:00
|
|
|
protected $rules = [
|
|
|
|
'service.docker_compose_raw' => 'required',
|
|
|
|
'service.docker_compose' => 'required',
|
|
|
|
];
|
2023-12-06 14:50:13 +00:00
|
|
|
public function mount() {
|
|
|
|
$this->service = Service::find($this->serviceId);
|
|
|
|
}
|
2023-09-30 13:08:40 +00:00
|
|
|
public function render()
|
|
|
|
{
|
2023-12-07 12:28:11 +00:00
|
|
|
return view('livewire.modal.edit-compose');
|
2023-09-30 13:08:40 +00:00
|
|
|
}
|
|
|
|
public function submit() {
|
2023-12-07 18:06:32 +00:00
|
|
|
$this->dispatch('warning', "Saving new docker compose...");
|
|
|
|
$this->dispatch('saveCompose', $this->service->docker_compose_raw);
|
2023-12-06 14:50:13 +00:00
|
|
|
$this->closeModal();
|
2023-09-30 13:08:40 +00:00
|
|
|
}
|
|
|
|
}
|