This commit is contained in:
Andras Bacsai 2023-05-16 13:11:05 +02:00
parent dedcc80501
commit 9bbf25b9f4
10 changed files with 80 additions and 66 deletions

View File

@ -61,7 +61,6 @@ public function instantSave()
} }
public function mount() public function mount()
{ {
$this->application = Application::where('id', $this->applicationId)->with('destination', 'settings')->firstOrFail();
$this->is_static = $this->application->settings->is_static; $this->is_static = $this->application->settings->is_static;
$this->is_git_submodules_allowed = $this->application->settings->is_git_submodules_allowed; $this->is_git_submodules_allowed = $this->application->settings->is_git_submodules_allowed;
$this->is_git_lfs_allowed = $this->application->settings->is_git_lfs_allowed; $this->is_git_lfs_allowed = $this->application->settings->is_git_lfs_allowed;

View File

@ -0,0 +1,15 @@
<?php
namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use Livewire\Component;
class Previews extends Component
{
public Application $application;
public function render()
{
return view('livewire.project.application.previews');
}
}

View File

@ -15,10 +15,7 @@ class Source extends Component
'application.git_branch' => 'required', 'application.git_branch' => 'required',
'application.git_commit_sha' => 'nullable', 'application.git_commit_sha' => 'nullable',
]; ];
public function mount()
{
$this->application = Application::where('id', $this->applicationId)->first();
}
public function submit() public function submit()
{ {
$this->validate(); $this->validate();

View File

@ -37,13 +37,13 @@ .magic-item-focused {
@apply bg-neutral-700 text-white; @apply bg-neutral-700 text-white;
} }
h1 { h1 {
@apply text-3xl font-bold py-4; @apply text-3xl font-bold pb-4;
} }
h2 { h2 {
@apply text-xl font-bold py-4; @apply text-xl font-bold pb-4;
} }
h3 { h3 {
@apply text-lg font-bold py-4; @apply text-lg font-bold pb-4;
} }
.box { .box {
@apply flex items-center justify-center text-sm rounded cursor-pointer h-14 bg-coolgray-200 hover:bg-coollabs-100 p-2; @apply flex items-center justify-center text-sm rounded cursor-pointer h-14 bg-coolgray-200 hover:bg-coollabs-100 p-2;

View File

@ -1,4 +1,5 @@
<div> <div>
<h3>Destination</h3>
<p>Server Name: {{ data_get($destination, 'server.name') }}</p> <p>Server Name: {{ data_get($destination, 'server.name') }}</p>
@if (data_get($destination, 'server.description')) @if (data_get($destination, 'server.description'))
<p>Description: {{ data_get($destination, 'server.description') }}</p> <p>Description: {{ data_get($destination, 'server.description') }}</p>

View File

@ -1,43 +1,36 @@
<div> <div>
<h3>General</h3>
<form wire:submit.prevent='submit' class="flex flex-col"> <form wire:submit.prevent='submit' class="flex flex-col">
<div class="flex flex-col gap-2 xl:flex-row"> <div class="flex flex-col gap-2">
<div class="flex flex-col w-96"> <x-inputs.input id="application.name" label="Name" required />
<x-inputs.input id="application.name" label="Name" required /> <x-inputs.input id="application.fqdn" label="FQDN" />
<x-inputs.input id="application.fqdn" label="FQDN" /> <x-inputs.input id="application.install_command" label="Install Command" />
</div> <x-inputs.input id="application.build_command" label="Build Command" />
<div class="flex flex-col w-96"> <x-inputs.input id="application.start_command" label="Start Command" />
<x-inputs.input id="application.install_command" label="Install Command" /> <x-inputs.select id="application.build_pack" label="Build Pack" required>
<x-inputs.input id="application.build_command" label="Build Command" /> <option value="nixpacks">Nixpacks</option>
<x-inputs.input id="application.start_command" label="Start Command" /> <option disabled value="docker">Docker</option>
<x-inputs.select id="application.build_pack" label="Build Pack" required> <option disabled value="compose">Compose</option>
<option value="nixpacks">Nixpacks</option> </x-inputs.select>
<option disabled value="docker">Docker</option> @if ($application->settings->is_static)
<option disabled value="compose">Compose</option> <x-inputs.select id="application.static_image" label="Static Image" required>
<option value="nginx:alpine">nginx:alpine</option>
<option disabled value="apache:alpine">apache:alpine</option>
</x-inputs.select> </x-inputs.select>
@if ($application->settings->is_static) @endif
<x-inputs.select id="application.static_image" label="Static Image" required> <x-inputs.input id="application.base_directory" label="Base Directory" />
<option value="nginx:alpine">nginx:alpine</option> @if ($application->settings->is_static)
<option disabled value="apache:alpine">apache:alpine</option> <x-inputs.input id="application.publish_directory" label="Publish Directory" required />
</x-inputs.select> @else
@endif <x-inputs.input id="application.publish_directory" label="Publish Directory" />
</div> @endif
<div class="flex flex-col w-96"> @if ($application->settings->is_static)
<x-inputs.input id="application.base_directory" label="Base Directory" /> <x-inputs.input id="application.ports_exposes" label="Ports Exposes" readonly />
@if ($application->settings->is_static) @else
<x-inputs.input id="application.publish_directory" label="Publish Directory" required /> <x-inputs.input id="application.ports_exposes" label="Ports Exposes" required />
@else @endif
<x-inputs.input id="application.publish_directory" label="Publish Directory" />
@endif
</div>
<div class="flex flex-col w-96">
@if ($application->settings->is_static)
<x-inputs.input id="application.ports_exposes" label="Ports Exposes" readonly />
@else
<x-inputs.input id="application.ports_exposes" label="Ports Exposes" required />
@endif
<x-inputs.input id="application.ports_mappings" label="Ports Mappings" /> <x-inputs.input id="application.ports_mappings" label="Ports Mappings" />
</div>
</div> </div>
<x-inputs.button class="mx-auto mt-4 text-white bg-neutral-800 hover:bg-violet-600" type="submit"> <x-inputs.button class="mx-auto mt-4 text-white bg-neutral-800 hover:bg-violet-600" type="submit">
Submit Submit
@ -50,8 +43,8 @@
<x-inputs.input noDirty instantSave type="checkbox" id="is_git_lfs_allowed" label="Git LFS Allowed?" /> <x-inputs.input noDirty instantSave type="checkbox" id="is_git_lfs_allowed" label="Git LFS Allowed?" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_debug" label="Debug" /> <x-inputs.input noDirty instantSave type="checkbox" id="is_debug" label="Debug" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_auto_deploy" label="Auto Deploy?" /> <x-inputs.input noDirty instantSave type="checkbox" id="is_auto_deploy" label="Auto Deploy?" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_previews" label="Previews?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_dual_cert" label="Dual Certs?" /> <x-inputs.input disabled instantSave type="checkbox" id="is_dual_cert" label="Dual Certs?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_previews" label="Previews?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_custom_ssl" label="Is Custom SSL?" /> <x-inputs.input disabled instantSave type="checkbox" id="is_custom_ssl" label="Is Custom SSL?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_http2" label="Is Http2?" /> <x-inputs.input disabled instantSave type="checkbox" id="is_http2" label="Is Http2?" />

View File

@ -0,0 +1,3 @@
<div>
<h2>Previews</h2>
</div>

View File

@ -1,4 +1,5 @@
<div> <div>
<h3>Source</h3>
<p>Source Name: {{ data_get($application, 'source.name') }}</p> <p>Source Name: {{ data_get($application, 'source.name') }}</p>
<p>Is Public Source: {{ data_get($application, 'source.is_public') }}</p> <p>Is Public Source: {{ data_get($application, 'source.is_public') }}</p>
<div class="flex flex-col w-96"> <div class="flex flex-col w-96">

View File

@ -1,5 +1,5 @@
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<h3>Persistent Storages</h3> <h3>Storages</h3>
@forelse ($application->persistentStorages as $storage) @forelse ($application->persistentStorages as $storage)
<livewire:project.application.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" /> <livewire:project.application.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
@empty @empty

View File

@ -1,8 +1,8 @@
<x-layout> <x-layout>
<h1>Configuration</h1> <h1>Configuration</h1>
<x-applications.navbar :applicationId="$application->id" :gitBranchLocation="$application->gitBranchLocation" /> <x-applications.navbar :applicationId="$application->id" :gitBranchLocation="$application->gitBranchLocation" />
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }"> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }" class="flex pt-6">
<div class="flex gap-4"> <div class="flex flex-col gap-4 min-w-fit">
<a :class="activeTab === 'general' && 'text-purple-500'" <a :class="activeTab === 'general' && 'text-purple-500'"
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a> @click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
<a :class="activeTab === 'environment-variables' && 'text-purple-500'" <a :class="activeTab === 'environment-variables' && 'text-purple-500'"
@ -16,26 +16,31 @@
href="#">Destination href="#">Destination
</a> </a>
<a :class="activeTab === 'storages' && 'text-purple-500'" <a :class="activeTab === 'storages' && 'text-purple-500'"
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storage @click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
</a>
<a :class="activeTab === 'previews' && 'text-purple-500'"
@click.prevent="activeTab = 'previews'; window.location.hash = 'previews'" href="#">Previews
</a> </a>
</div> </div>
<div x-cloak x-show="activeTab === 'general'"> <div class="w-full pl-8">
<h3>General Configurations</h3> <div x-cloak x-show="activeTab === 'general'">
<livewire:project.application.general :applicationId="$application->id" /> <livewire:project.application.general :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'environment-variables'"> <div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.application.environment-variable.all :application="$application" /> <livewire:project.application.environment-variable.all :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'source'"> <div x-cloak x-show="activeTab === 'source'">
<h3>Source</h3> <livewire:project.application.source :application="$application" />
<livewire:project.application.source :applicationId="$application->id" /> </div>
</div> <div x-cloak x-show="activeTab === 'destination'">
<div x-cloak x-show="activeTab === 'destination'"> <livewire:project.application.destination :destination="$application->destination" />
<h3>Destination</h3> </div>
<livewire:project.application.destination :destination="$application->destination" /> <div x-cloak x-show="activeTab === 'storages'">
</div> <livewire:project.application.storages.all :application="$application" />
<div x-cloak x-show="activeTab === 'storages'"> </div>
<livewire:project.application.storages.all :application="$application" /> <div x-cloak x-show="activeTab === 'previews'">
<livewire:project.application.previews :application="$application" />
</div>
</div> </div>
</div> </div>
</x-layout> </x-layout>