wip: services

feat: able to map port<->domain
This commit is contained in:
Andras Bacsai
2023-09-22 14:47:25 +02:00
parent c91f426af3
commit 67078fdc71
36 changed files with 233 additions and 248 deletions

View File

@@ -52,8 +52,6 @@ class General extends Component
'application.ports_exposes' => 'required',
'application.ports_mappings' => 'nullable',
'application.dockerfile' => 'nullable',
'application.dockercompose_raw' => 'nullable',
'application.dockercompose' => 'nullable',
];
protected $validationAttributes = [
'application.name' => 'name',
@@ -72,8 +70,6 @@ class General extends Component
'application.ports_exposes' => 'Ports exposes',
'application.ports_mappings' => 'Ports mappings',
'application.dockerfile' => 'Dockerfile',
'application.dockercompose_raw' => 'Docker Compose (raw)',
'application.dockercompose' => 'Docker Compose',
];
@@ -165,10 +161,6 @@ class General extends Component
if ($this->application->publish_directory && $this->application->publish_directory !== '/') {
$this->application->publish_directory = rtrim($this->application->publish_directory, '/');
}
if (data_get($this->application, 'dockercompose_raw')) {
$details = generateServiceFromTemplate( $this->application);
$this->application->dockercompose = data_get($details, 'dockercompose');
}
$this->application->save();
$this->emit('success', 'Application settings updated!');
} catch (\Throwable $e) {

View File

@@ -10,6 +10,7 @@ class Application extends Component
public ServiceApplication $application;
protected $rules = [
'application.human_name' => 'nullable',
'application.description' => 'nullable',
'application.fqdn' => 'nullable',
];
public function render()

View File

@@ -11,6 +11,7 @@ class Database extends Component
public ServiceDatabase $database;
protected $rules = [
'database.human_name' => 'nullable',
'database.description' => 'nullable',
];
public function render()
{

View File

@@ -2,11 +2,7 @@
namespace App\Http\Livewire\Project\Service;
use App\Actions\Service\StartService;
use App\Actions\Service\StopService;
use App\Jobs\ContainerStatusJob;
use App\Models\Service;
use Illuminate\Support\Collection;
use Livewire\Component;
class Index extends Component
@@ -18,6 +14,8 @@ class Index extends Component
protected $rules = [
'service.docker_compose_raw' => 'required',
'service.docker_compose' => 'required',
'service.name' => 'required',
'service.description' => 'required',
];
public function mount()
@@ -36,5 +34,13 @@ class Index extends Component
$this->service->refresh();
$this->emit('refreshEnvs');
}
public function submit() {
try {
$this->validate();
$this->service->save();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
}

View File

@@ -38,7 +38,7 @@ class Danger extends Component
'environment_name' => $this->parameters['environment_name']
]);
} catch (\Throwable $e) {
return handleError($e);
return handleError($e, $this);
}
}
}