diff --git a/app/Http/Livewire/Destination/Form.php b/app/Http/Livewire/Destination/Form.php new file mode 100644 index 000000000..437df49c6 --- /dev/null +++ b/app/Http/Livewire/Destination/Form.php @@ -0,0 +1,39 @@ + 'required', + 'destination.network' => 'required', + 'destination.server.ip' => 'required', + ]; + public function mount() + { + $standalone = StandaloneDocker::where('uuid', $this->destination_uuid)->first(); + $swarm = SwarmDocker::where('uuid', $this->destination_uuid)->first(); + if (!$standalone && !$swarm) { + abort(404); + } + $this->destination = $standalone ? $standalone->load(['server']) : $swarm->load(['server']); + } + public function submit() + { + $this->validate(); + $this->destination->save(); + } + public function delete() + { + instantRemoteProcess(['docker network rm -f ' . $this->destination->network], $this->destination->server); + $this->destination->delete(); + return redirect()->route('dashboard'); + } +} diff --git a/app/Http/Livewire/Destination/New/StandaloneDocker.php b/app/Http/Livewire/Destination/New/StandaloneDocker.php index 7b1c1089b..bb555bf4b 100644 --- a/app/Http/Livewire/Destination/New/StandaloneDocker.php +++ b/app/Http/Livewire/Destination/New/StandaloneDocker.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire\Destination\New; use App\Models\Server; use App\Models\StandaloneDocker as ModelsStandaloneDocker; use Livewire\Component; +use Visus\Cuid2\Cuid2; class StandaloneDocker extends Component { @@ -12,7 +13,7 @@ class StandaloneDocker extends Component public string $network; public $servers; - public int|null $server_id = null; + public int $server_id; protected $rules = [ 'name' => 'required|string', @@ -21,13 +22,11 @@ class StandaloneDocker extends Component ]; public function mount() { - $this->name = generateRandomName(); $this->servers = Server::where('team_id', session('currentTeam')->id)->get(); + $this->network = new Cuid2(7); + $this->name = generateRandomName(); } - public function setServerId($server_id) - { - $this->server_id = $server_id; - } + public function submit() { $this->validate(); diff --git a/resources/css/app.css b/resources/css/app.css index 93d5c4896..d500237ff 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -8,9 +8,13 @@ body { a, a:visited { @apply text-neutral-300 hover:text-purple-500; } -input, select, textarea { - @apply border-none p-2 bg-neutral-800 text-white disabled:text-neutral-600; +input, textarea { + @apply border-none p-2 bg-neutral-800 text-white disabled:text-neutral-600 read-only:text-neutral-600 read-only:select-none } +select { + @apply border-none p-2 bg-neutral-800 text-white disabled:text-neutral-600 read-only:select-none +} + button { @apply border-none px-2 p-1 cursor-pointer; } diff --git a/resources/views/components/inputs/button.blade.php b/resources/views/components/inputs/button.blade.php index 74388b531..23e0e0f11 100644 --- a/resources/views/components/inputs/button.blade.php +++ b/resources/views/components/inputs/button.blade.php @@ -1,7 +1,7 @@ @props([ 'isWarning' => null, - 'defaultClass' => 'text-white bg-neutral-800 hover:bg-violet-600', - 'defaultWarningClass' => 'text-white bg-red-500 hover:bg-red-600', + 'defaultClass' => 'text-white bg-neutral-800 hover:bg-violet-600 w-28', + 'defaultWarningClass' => 'text-white bg-red-500 hover:bg-red-600 w-28', 'loadingClass' => 'text-black bg-green-500', 'confirm' => null, 'confirmAction' => null, diff --git a/resources/views/components/inputs/input.blade.php b/resources/views/components/inputs/input.blade.php index a09af0496..eba849e9d 100644 --- a/resources/views/components/inputs/input.blade.php +++ b/resources/views/components/inputs/input.blade.php @@ -2,7 +2,6 @@ 'id' => null, 'type' => 'text', 'required' => false, - 'readonly' => false, 'label' => null, 'instantSave' => false, 'disabled' => false, diff --git a/resources/views/components/inputs/select.blade.php b/resources/views/components/inputs/select.blade.php new file mode 100644 index 000000000..722039a77 --- /dev/null +++ b/resources/views/components/inputs/select.blade.php @@ -0,0 +1,25 @@ +@props([ + 'id' => null, + 'label' => null, + 'required' => false, +]) + + + + + + @error($id) +
{{ $message }}
+ @enderror +
diff --git a/resources/views/destination/show.blade.php b/resources/views/destination/show.blade.php index 51379c451..34bea294e 100644 --- a/resources/views/destination/show.blade.php +++ b/resources/views/destination/show.blade.php @@ -1,11 +1,4 @@

Destination

-

Name: {{ data_get($destination, 'name') }}

-

Server:{{ data_get($destination, 'server.ip') }}:{{ data_get($destination, 'server.port') }}

- @if ($destination->getMorphClass() === 'App\Models\StandaloneDocker') -

Network: {{ data_get($destination, 'network') }}

- @endif - @if ($destination->getMorphClass() === 'App\Models\SwarmDocker') -

Uuid: {{ data_get($destination, 'uuid') }}

- @endif +
diff --git a/resources/views/livewire/check-update.blade.php b/resources/views/livewire/check-update.blade.php index 577b4e931..7e8c93f23 100644 --- a/resources/views/livewire/check-update.blade.php +++ b/resources/views/livewire/check-update.blade.php @@ -1,5 +1,6 @@
- Check for updates + + Check for updates @if ($updateAvailable) Update available @endif diff --git a/resources/views/livewire/destination/form.blade.php b/resources/views/livewire/destination/form.blade.php new file mode 100644 index 000000000..e74656eef --- /dev/null +++ b/resources/views/livewire/destination/form.blade.php @@ -0,0 +1,18 @@ +
+
+ + + @if ($destination->getMorphClass() === 'App\Models\StandaloneDocker') + + @endif +
+ + Submit + + + Delete + +
+ +
diff --git a/resources/views/livewire/destination/new/standalone-docker.blade.php b/resources/views/livewire/destination/new/standalone-docker.blade.php index 2c8cee3c4..023d7d4ba 100644 --- a/resources/views/livewire/destination/new/standalone-docker.blade.php +++ b/resources/views/livewire/destination/new/standalone-docker.blade.php @@ -1,21 +1,14 @@
-
+ - - @foreach ($servers as $key) - @if ($server_id == $key->id) - - {{ $key->name }} - - @else - {{ $key->name }} - - @endif - @endforeach - + + @foreach ($servers as $server) + + @endforeach + + Submit -
diff --git a/resources/views/livewire/project/application/destination.blade.php b/resources/views/livewire/project/application/destination.blade.php index a141c6c4b..feabe4862 100644 --- a/resources/views/livewire/project/application/destination.blade.php +++ b/resources/views/livewire/project/application/destination.blade.php @@ -1,5 +1,7 @@
-

IP: {{ $destination->server->ip }}

-

Description: {{ $destination->server->description }}

+

Server Name: {{ data_get($destination, 'server.name') }}

+ @if (data_get($destination, 'server.description')) +

Description: {{ data_get($destination, 'server.description') }}

+ @endif

Docker Network: {{ $destination->network }}

diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 36186c3fd..635134564 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -15,18 +15,16 @@ @endif
- @if ($application->settings->is_static) @else @endif -
@if ($application->settings->is_static) - + @else @endif @@ -34,7 +32,7 @@
- + Submit diff --git a/resources/views/livewire/project/application/storages.blade.php b/resources/views/livewire/project/application/storages.blade.php index 0f7a5bc9c..75d49bc78 100644 --- a/resources/views/livewire/project/application/storages.blade.php +++ b/resources/views/livewire/project/application/storages.blade.php @@ -5,6 +5,6 @@

HostPath:{{ data_get($storage, 'host_path') }}

ContainerId:{{ data_get($storage, 'container_id') }}

@empty -

No storage found.

+

There are no storages added for this application.

@endforelse diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.php index ae36b76de..bd9cb6bcd 100644 --- a/resources/views/livewire/project/new/public-git-repository.blade.php +++ b/resources/views/livewire/project/new/public-git-repository.blade.php @@ -61,7 +61,7 @@ @if ($is_static) @else - + @endif Submit diff --git a/routes/web.php b/routes/web.php index e47acfaf1..a22dc59b2 100644 --- a/routes/web.php +++ b/routes/web.php @@ -93,7 +93,7 @@ Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () { Route::get('/destination/new', function () { $query_params = request()->query(); - $server_id = null; + $server_id = 1; if (isset($query_params['server_id'])) { $server_id = $query_params['server_id']; } @@ -109,7 +109,7 @@ Route::middleware(['auth'])->group(function () { } $destination = $standalone_dockers ? $standalone_dockers : $swarm_dockers; return view('destination.show', [ - 'destination' => $destination, + 'destination_uuid' => $destination->uuid, ]); })->name('destination.show'); });