Fix styling
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
41fb6a1fc9
commit
d86274cc37
@@ -9,34 +9,44 @@ use App\Models\PrivateKey;
|
||||
use App\Models\Project;
|
||||
use App\Models\StandaloneDocker;
|
||||
use App\Models\SwarmDocker;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Component;
|
||||
use Spatie\Url\Url;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class GithubPrivateRepositoryDeployKey extends Component
|
||||
{
|
||||
public $current_step = 'private_keys';
|
||||
|
||||
public $parameters;
|
||||
|
||||
public $query;
|
||||
|
||||
public $private_keys = [];
|
||||
|
||||
public int $private_key_id;
|
||||
|
||||
public int $port = 3000;
|
||||
|
||||
public string $type;
|
||||
|
||||
public bool $is_static = false;
|
||||
public null|string $publish_directory = null;
|
||||
|
||||
public ?string $publish_directory = null;
|
||||
|
||||
public string $repository_url;
|
||||
|
||||
public string $branch;
|
||||
|
||||
public $build_pack = 'nixpacks';
|
||||
|
||||
public bool $show_is_static = true;
|
||||
|
||||
private object $repository_url_parsed;
|
||||
|
||||
private GithubApp|GitlabApp|string $git_source = 'other';
|
||||
|
||||
private ?string $git_host = null;
|
||||
|
||||
private string $git_repository;
|
||||
|
||||
protected $rules = [
|
||||
@@ -47,6 +57,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
'publish_directory' => 'nullable|string',
|
||||
'build_pack' => 'required|string',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'repository_url' => 'Repository',
|
||||
'branch' => 'Branch',
|
||||
@@ -56,7 +67,6 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
'build_pack' => 'Build pack',
|
||||
];
|
||||
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (isDev()) {
|
||||
@@ -76,7 +86,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
if ($this->build_pack === 'nixpacks') {
|
||||
$this->show_is_static = true;
|
||||
$this->port = 3000;
|
||||
} else if ($this->build_pack === 'static') {
|
||||
} elseif ($this->build_pack === 'static') {
|
||||
$this->show_is_static = false;
|
||||
$this->is_static = false;
|
||||
$this->port = 80;
|
||||
@@ -85,6 +95,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
$this->is_static = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
if ($this->is_static) {
|
||||
@@ -108,10 +119,10 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
try {
|
||||
$destination_uuid = $this->query['destination'];
|
||||
$destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
|
||||
if (!$destination) {
|
||||
if (! $destination) {
|
||||
$destination = SwarmDocker::where('uuid', $destination_uuid)->first();
|
||||
}
|
||||
if (!$destination) {
|
||||
if (! $destination) {
|
||||
throw new \Exception('Destination not found. What?!');
|
||||
}
|
||||
$destination_class = $destination->getMorphClass();
|
||||
@@ -146,7 +157,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
'destination_type' => $destination_class,
|
||||
'private_key_id' => $this->private_key_id,
|
||||
'source_id' => $this->git_source->id,
|
||||
'source_type' => $this->git_source->getMorphClass()
|
||||
'source_type' => $this->git_source->getMorphClass(),
|
||||
];
|
||||
}
|
||||
if ($this->build_pack === 'dockerfile' || $this->build_pack === 'dockerimage') {
|
||||
@@ -175,15 +186,16 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
{
|
||||
$this->repository_url_parsed = Url::fromString($this->repository_url);
|
||||
$this->git_host = $this->repository_url_parsed->getHost();
|
||||
$this->git_repository = $this->repository_url_parsed->getSegment(1) . '/' . $this->repository_url_parsed->getSegment(2);
|
||||
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
||||
|
||||
if ($this->git_host == 'github.com') {
|
||||
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
||||
|
||||
return;
|
||||
}
|
||||
if (Str::of($this->repository_url)->startsWith('http')) {
|
||||
$this->git_host = $this->repository_url_parsed->getHost();
|
||||
$this->git_repository = $this->repository_url_parsed->getSegment(1) . '/' . $this->repository_url_parsed->getSegment(2);
|
||||
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
||||
$this->git_repository = Str::finish("git@$this->git_host:$this->git_repository", '.git');
|
||||
} else {
|
||||
$this->git_repository = $this->repository_url;
|
||||
|
Reference in New Issue
Block a user