This commit is contained in:
Andras Bacsai 2023-05-03 10:41:25 +02:00
parent 499101ae9c
commit c295a3e90b
5 changed files with 22 additions and 12 deletions

View File

@ -43,7 +43,11 @@ class PublicGitRepository extends Component
$this->port = 3000; $this->port = 3000;
} }
$this->parameters = Route::current()->parameters(); $this->parameters = Route::current()->parameters();
$this->servers = session('currentTeam')->load(['servers'])->servers; $this->servers = session('currentTeam')->load(['servers'])->servers->reject(function ($server) {
if ($server->standaloneDockers->count() === 0 && $server->swarmDockers->count() === 0) {
return true;
}
});
} }
public function chooseServer($server_id) public function chooseServer($server_id)
{ {

View File

@ -17,6 +17,7 @@ class FormInput extends Component
public bool $readonly = false, public bool $readonly = false,
public string|null $label = null, public string|null $label = null,
public string|null $type = 'text', public string|null $type = 'text',
public string|null $class = "",
public bool $instantSave = false, public bool $instantSave = false,
public bool $disabled = false, public bool $disabled = false,
public bool $hidden = false public bool $hidden = false

View File

@ -26,12 +26,13 @@
@endif @endif
</label> </label>
@if ($type === 'textarea') @if ($type === 'textarea')
<textarea type={{ $type }} id={{ $id }} wire:model.defer={{ $id }} <textarea class={{ $class }} type={{ $type }} id={{ $id }}
@if ($required) required @endif @if ($disabled) disabled @endif wire:model.defer={{ $id }} @if ($required) required @endif
@if ($readonly) readOnly disabled @endif></textarea> @if ($disabled) disabled @endif @if ($readonly) readOnly disabled @endif></textarea>
@else @else
<input type={{ $type }} id={{ $id }} wire:model.defer={{ $id }} <input class={{ $class }} type={{ $type }} id={{ $id }}
@if ($required) required @endif @if ($disabled) disabled @endif wire:model.defer={{ $id }} @if ($required) required @endif
@if ($disabled) disabled @endif
@if ($readonly) readOnly disabled @endif /> @if ($readonly) readOnly disabled @endif />
@endif @endif

View File

@ -1,11 +1,17 @@
<div> <div>
@if ($servers->count() > 0)
<h1>Choose a server</h1>
@endif
@forelse ($servers as $server) @forelse ($servers as $server)
<button @if ($chosenServer == $server->id) class="bg-blue-500" @endif <button @if ($chosenServer == $server->id) class="bg-blue-500" @endif
wire:click="chooseServer({{ $server->id }})">{{ $server->name }}</button> wire:click="chooseServer({{ $server->id }})">{{ $server->name }}</button>
@empty @empty
No servers No servers found.
<p>Did you forget to add a destination on the server?</p>
@endforelse @endforelse
@isset($chosenServer) @isset($chosenServer)
<h1>Choose a destination</h1>
<div> <div>
@foreach ($standalone_docker as $standalone) @foreach ($standalone_docker as $standalone)
<button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif <button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif
@ -19,8 +25,9 @@
@endisset @endisset
@isset($chosenDestination) @isset($chosenDestination)
<form wire:submit.prevent='submit'> <h1>Choose a repository</h1>
<x-form-input id="public_repository_url" label="Repository URL" /> <form class="flex flex-col gap-2 w-96" wire:submit.prevent='submit'>
<x-form-input class="w-96" id="public_repository_url" label="Repository URL" />
<x-form-input instantSave type="checkbox" id="is_static" label="Static Site?" /> <x-form-input instantSave type="checkbox" id="is_static" label="Static Site?" />
@if ($is_static) @if ($is_static)
<x-form-input id="publish_directory" label="Publish Directory" /> <x-form-input id="publish_directory" label="Publish Directory" />

View File

@ -19,8 +19,5 @@
<div x-cloak x-show="activeTab === 'github-private-repo'"> <div x-cloak x-show="activeTab === 'github-private-repo'">
github-private-repo github-private-repo
</div> </div>
<div x-cloak x-show="activeTab === 'choose'">
Choose any option
</div>
</div> </div>
</x-layout> </x-layout>