feat: Enhance General component with additional properties and validation rules

This commit is contained in:
Andras Bacsai 2025-11-04 08:51:05 +01:00
parent fbaa5eb369
commit 3d9c4954c1

View file

@ -7,6 +7,7 @@
use App\Support\ValidationPatterns; use App\Support\ValidationPatterns;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Livewire\Attributes\Validate;
use Livewire\Component; use Livewire\Component;
use Spatie\Url\Url; use Spatie\Url\Url;
use Visus\Cuid2\Cuid2; use Visus\Cuid2\Cuid2;
@ -21,92 +22,136 @@ class General extends Component
public Collection $services; public Collection $services;
#[Validate('required|regex:/^[a-zA-Z0-9\s\-_.\/:()]+$/')]
public string $name; public string $name;
#[Validate(['string', 'nullable'])]
public ?string $description = null; public ?string $description = null;
#[Validate(['nullable'])]
public ?string $fqdn = null; public ?string $fqdn = null;
#[Validate(['required'])]
public string $gitRepository; public string $gitRepository;
#[Validate(['required'])]
public string $gitBranch; public string $gitBranch;
#[Validate(['string', 'nullable'])]
public ?string $gitCommitSha = null; public ?string $gitCommitSha = null;
#[Validate(['string', 'nullable'])]
public ?string $installCommand = null; public ?string $installCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $buildCommand = null; public ?string $buildCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $startCommand = null; public ?string $startCommand = null;
#[Validate(['required'])]
public string $buildPack; public string $buildPack;
#[Validate(['required'])]
public string $staticImage; public string $staticImage;
#[Validate(['required'])]
public string $baseDirectory; public string $baseDirectory;
#[Validate(['string', 'nullable'])]
public ?string $publishDirectory = null; public ?string $publishDirectory = null;
#[Validate(['string', 'nullable'])]
public ?string $portsExposes = null; public ?string $portsExposes = null;
#[Validate(['string', 'nullable'])]
public ?string $portsMappings = null; public ?string $portsMappings = null;
#[Validate(['string', 'nullable'])]
public ?string $customNetworkAliases = null; public ?string $customNetworkAliases = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerfile = null; public ?string $dockerfile = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerfileLocation = null; public ?string $dockerfileLocation = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerfileTargetBuild = null; public ?string $dockerfileTargetBuild = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerRegistryImageName = null; public ?string $dockerRegistryImageName = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerRegistryImageTag = null; public ?string $dockerRegistryImageTag = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerComposeLocation = null; public ?string $dockerComposeLocation = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerCompose = null; public ?string $dockerCompose = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerComposeRaw = null; public ?string $dockerComposeRaw = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerComposeCustomStartCommand = null; public ?string $dockerComposeCustomStartCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $dockerComposeCustomBuildCommand = null; public ?string $dockerComposeCustomBuildCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $customDockerRunOptions = null; public ?string $customDockerRunOptions = null;
#[Validate(['string', 'nullable'])]
public ?string $preDeploymentCommand = null; public ?string $preDeploymentCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $preDeploymentCommandContainer = null; public ?string $preDeploymentCommandContainer = null;
#[Validate(['string', 'nullable'])]
public ?string $postDeploymentCommand = null; public ?string $postDeploymentCommand = null;
#[Validate(['string', 'nullable'])]
public ?string $postDeploymentCommandContainer = null; public ?string $postDeploymentCommandContainer = null;
#[Validate(['string', 'nullable'])]
public ?string $customNginxConfiguration = null; public ?string $customNginxConfiguration = null;
#[Validate(['boolean', 'required'])]
public bool $isStatic = false; public bool $isStatic = false;
#[Validate(['boolean', 'required'])]
public bool $isSpa = false; public bool $isSpa = false;
#[Validate(['boolean', 'required'])]
public bool $isBuildServerEnabled = false; public bool $isBuildServerEnabled = false;
#[Validate(['boolean', 'required'])]
public bool $isPreserveRepositoryEnabled = false; public bool $isPreserveRepositoryEnabled = false;
#[Validate(['boolean', 'required'])]
public bool $isContainerLabelEscapeEnabled = true; public bool $isContainerLabelEscapeEnabled = true;
#[Validate(['boolean', 'required'])]
public bool $isContainerLabelReadonlyEnabled = false; public bool $isContainerLabelReadonlyEnabled = false;
#[Validate(['boolean', 'required'])]
public bool $isHttpBasicAuthEnabled = false; public bool $isHttpBasicAuthEnabled = false;
#[Validate(['string', 'nullable'])]
public ?string $httpBasicAuthUsername = null; public ?string $httpBasicAuthUsername = null;
#[Validate(['string', 'nullable'])]
public ?string $httpBasicAuthPassword = null; public ?string $httpBasicAuthPassword = null;
#[Validate(['nullable'])]
public ?string $watchPaths = null; public ?string $watchPaths = null;
#[Validate(['string', 'required'])]
public string $redirect; public string $redirect;
#[Validate(['nullable'])]
public $customLabels; public $customLabels;
public bool $labelsChanged = false; public bool $labelsChanged = false;