lots of updates + refactoring

This commit is contained in:
Andras Bacsai
2023-08-07 22:14:21 +02:00
parent bfc20ef219
commit 971d7f703d
51 changed files with 532 additions and 324 deletions

View File

@@ -8,17 +8,6 @@
{{-- <x-applications.advanced :application="$application" /> --}}
@if ($database->status === 'running')
<button wire:click='start' class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-warning" viewBox="0 0 24 24" stroke-width="2"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path
d="M10.09 4.01l.496 -.495a2 2 0 0 1 2.828 0l7.071 7.07a2 2 0 0 1 0 2.83l-7.07 7.07a2 2 0 0 1 -2.83 0l-7.07 -7.07a2 2 0 0 1 0 -2.83l3.535 -3.535h-3.988">
</path>
<path d="M7.05 11.038v-3.988"></path>
</svg>
Restart
</button>
<button wire:click='stop' class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">

View File

@@ -1,26 +0,0 @@
<div class="flex flex-col gap-2">
<div>
<div class="flex items-center gap-2">
<h2>Environment Variables</h2>
<x-forms.button class="btn" onclick="newVariable.showModal()">+ Add</x-forms.button>
<livewire:project.application.environment-variable.add />
</div>
<div class="">Environment (secrets) variables for normal deployments.</div>
</div>
@forelse ($application->environment_variables as $env)
<livewire:project.application.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" />
@empty
<div class="text-neutral-500">No environment variables found.</div>
@endforelse
@if ($application->environment_variables_preview->count() > 0)
<div>
<h3>Preview Deployments</h3>
<div class="">Environment (secrets) variables for Preview Deployments.</div>
</div>
@foreach ($application->environment_variables_preview as $env)
<livewire:project.application.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" />
@endforeach
@endif
</div>

View File

@@ -1,21 +0,0 @@
<div>
<x-modal yesOrNo modalId="{{ $modalId }}" modalTitle="Delete Storage">
<x-slot:modalBody>
<p>This storage will be deleted <span class="font-bold text-warning">({{ $storage->name }})</span>. It is not
reversible. <br>Please think again.</p>
</x-slot:modalBody>
</x-modal>
<form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
<x-forms.input id="storage.name" label="Name" required />
<x-forms.input id="storage.host_path" label="Source Path" />
<x-forms.input id="storage.mount_path" label="Destination Path" required />
<div class="flex gap-2">
<x-forms.button type="submit">
Update
</x-forms.button>
<x-forms.button isError isModal modalId="{{ $modalId }}">
Delete
</x-forms.button>
</div>
</form>
</div>

View File

@@ -1,4 +1,4 @@
<nav>
<nav x-init="$wire.check_status" wire:poll.10000ms="check_status">
<x-resources.breadcrumbs :resource="$database" :parameters="$parameters" />
<x-databases.navbar :database="$database" :parameters="$parameters" />
</nav>

View File

@@ -1,17 +1,33 @@
<div>
<form wire:submit.prevent="submit">
<form wire:submit.prevent="submit" class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<h2>General</h2>
<x-forms.button type="submit">
Save
</x-forms.button>
</div>
<x-forms.input label="Name" id="database.name" />
<x-forms.input label="Description" id="database.description" />
<x-forms.input label="Username" id="database.postgres_username" placeholder="If empty, use postgres." />
<x-forms.input label="Password" id="database.postgres_password" type="password" />
<x-forms.input label="Database" id="database.postgres_db" placeholder="If empty, use $USERNAME." />
<x-forms.input label="Init Args" id="database.postgres_initdb_args" placeholder="If empty, use default." />
<div class="flex gap-2">
<x-forms.input label="Name" id="database.name" />
<x-forms.input label="Description" id="database.description" />
<x-forms.input label="Image" id="database.image" required
helper="For all available images, check here:<br><br><a target='_blank' href='https://hub.docker.com/_/postgres'>https://hub.docker.com/_/postgres</a>" />
</div>
<div class="flex gap-2">
@if ($database->started_at)
<x-forms.input label="Username" id="database.postgres_username" placeholder="If empty, use postgres."
readonly />
<x-forms.input label="Password" id="database.postgres_password" type="password" required readonly />
<x-forms.input label="Database" id="database.postgres_db" placeholder="If empty, use $USERNAME."
readonly />
@else
<x-forms.input label="Username" id="database.postgres_username" placeholder="If empty, use postgres." />
<x-forms.input label="Password" id="database.postgres_password" type="password" required />
<x-forms.input label="Database" id="database.postgres_db" placeholder="If empty, use $USERNAME." />
@endif
</div>
<x-forms.input label="Initial Arguments" id="database.postgres_initdb_args"
placeholder="If empty, use default." />
<x-forms.input label="Host Auth Method" id="database.postgres_host_auth_method"
placeholder="If empty, use default." />
</form>

View File

@@ -1,12 +1,12 @@
<div>
<x-modal yesOrNo modalId="{{ $modalId }}" modalTitle="Delete Application">
<x-modal yesOrNo modalId="{{ $modalId }}" modalTitle="Delete Resource">
<x-slot:modalBody>
<p>This application will be deleted. It is not reversible. <br>Please think again.</p>
<p>This resource will be deleted. It is not reversible. <br>Please think again.</p>
</x-slot:modalBody>
</x-modal>
<h3>Danger Zone</h3>
<div class="">Woah. I hope you know what are you doing.</div>
<h4 class="pt-4">Delete Application</h4>
<h4 class="pt-4">Delete Resource</h4>
<div class="pb-4">This will stop your containers, delete all related data, etc. Beware! There is no coming
back!
</div>

View File

@@ -0,0 +1,8 @@
<div>
<h2>Destination</h2>
<div class="">The destination server / network where your application will be deployed to.</div>
<div class="py-4 ">
<p>Server: {{ data_get($destination, 'server.name') }}</p>
<p>Destination Network: {{ $destination->network }}</p>
</div>
</div>

View File

@@ -3,7 +3,9 @@
<h3 class="text-lg font-bold">Add Environment Variable</h3>
<x-forms.input placeholder="NODE_ENV" id="key" label="Name" required />
<x-forms.input placeholder="production" id="value" label="Value" required />
<x-forms.checkbox id="is_build_time" label="Build Variable?" />
@if (data_get($parameters, 'application_uuid'))
<x-forms.checkbox id="is_build_time" label="Build Variable?" />
@endif
<x-forms.button onclick="newVariable.close()" type="submit">
Save
</x-forms.button>

View File

@@ -0,0 +1,26 @@
<div class="flex flex-col gap-2">
<div>
<div class="flex items-center gap-2">
<h2>Environment Variables</h2>
<x-forms.button class="btn" onclick="newVariable.showModal()">+ Add</x-forms.button>
<livewire:project.shared.environment-variable.add />
</div>
<div>Environment (secrets) variables for this resource.</div>
</div>
@forelse ($resource->environment_variables as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" />
@empty
<div class="text-neutral-500">No environment variables found.</div>
@endforelse
@if ($resource->type() === 'application' && $resource->environment_variables_preview->count() > 0)
<div>
<h3>Preview Deployments</h3>
<div>Environment (secrets) variables for Preview Deployments.</div>
</div>
@foreach ($resource->environment_variables_preview as $env)
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
:env="$env" />
@endforeach
@endif
</div>

View File

@@ -8,7 +8,9 @@
<form wire:submit.prevent='submit' class="flex flex-col items-center gap-2 xl:flex-row">
<x-forms.input id="env.key" />
<x-forms.input type="password" id="env.value" />
<x-forms.checkbox disabled id="env.is_build_time" label="Build Variable?" />
@if (data_get($parameters, 'application_uuid'))
<x-forms.checkbox disabled id="env.is_build_time" label="Build Variable?" />
@endif
<div class="flex gap-2">
<x-forms.button type="submit">
Update

View File

@@ -7,20 +7,20 @@
<div class="">Limit your container resources by CPU & memory.</div>
<h3 class="pt-4">Limit CPUs</h3>
<div class="flex gap-2">
<x-forms.input placeholder="1.5" label="Number of CPUs" id="application.limits_cpus" />
<x-forms.input placeholder="0-2" label="CPU sets to use" id="application.limits_cpuset" />
<x-forms.input placeholder="1024" label="CPU Weight" id="application.limits_cpu_shares" />
<x-forms.input placeholder="1.5" label="Number of CPUs" id="resource.limits_cpus" />
<x-forms.input placeholder="0-2" label="CPU sets to use" id="resource.limits_cpuset" />
<x-forms.input placeholder="1024" label="CPU Weight" id="resource.limits_cpu_shares" />
</div>
<h3 class="pt-4">Limit Memory</h3>
<div class="flex gap-2">
<x-forms.input placeholder="69b or 420k or 1337m or 1g" label="Soft Memory Limit"
id="application.limits_memory_reservation" />
id="resource.limits_memory_reservation" />
<x-forms.input placeholder="69b or 420k or 1337m or 1g" label="Maximum Memory Limit"
id="application.limits_memory" />
id="resource.limits_memory" />
<x-forms.input placeholder="69b or 420k or 1337m or 1g" label="Maximum Swap Limit"
id="application.limits_memory_swap" />
id="resource.limits_memory_swap" />
<x-forms.input placeholder="0-100" type="number" min="0" max="100" label="Swappiness"
id="application.limits_memory_swappiness" />
id="resource.limits_memory_swappiness" />
</div>
</form>
</div>

View File

@@ -1,19 +1,19 @@
<div>
<div>
<div class="flex items-center gap-2">
<h2>Storages </h2>
<h2>Storages</h2>
<x-helper
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
volume
name, example: <span class='text-helper'>-pr-1</span>" />
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
<livewire:project.application.storages.add />
<livewire:project.shared.storages.add />
</div>
<div class="">Persistent storage to preserve data between deployments.</div>
</div>
<div class="flex flex-col gap-2 py-4">
@forelse ($application->persistentStorages as $storage)
<livewire:project.application.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
@forelse ($resource->persistentStorages as $storage)
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
@empty
<div class="text-neutral-500">No storages found.</div>
@endforelse

View File

@@ -0,0 +1,35 @@
<div>
<x-modal yesOrNo modalId="{{ $modalId }}" modalTitle="Delete Storage">
<x-slot:modalBody>
<p>This storage will be deleted <span class="font-bold text-warning">({{ $storage->name }})</span>. It is not
reversible. <br>Please think again.</p>
</x-slot:modalBody>
</x-modal>
<form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
@if ($storage->is_readonly)
<x-forms.input id="storage.name" label="Name" required readonly />
<x-forms.input id="storage.host_path" label="Source Path" readonly />
<x-forms.input id="storage.mount_path" label="Destination Path" required readonly />
<div class="flex gap-2">
<x-forms.button type="submit" disabled>
Update
</x-forms.button>
<x-forms.button isError isModal modalId="{{ $modalId }}" disabled>
Delete
</x-forms.button>
</div>
@else
<x-forms.input id="storage.name" label="Name" required />
<x-forms.input id="storage.host_path" label="Source Path" />
<x-forms.input id="storage.mount_path" label="Destination Path" required />
<div class="flex gap-2">
<x-forms.button type="submit">
Update
</x-forms.button>
<x-forms.button isError isModal modalId="{{ $modalId }}">
Delete
</x-forms.button>
</div>
@endif
</form>
</div>

View File

@@ -38,16 +38,16 @@
<livewire:project.application.general :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.application.environment-variable.all :application="$application" />
<livewire:project.shared.environment-variable.all :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'source'">
<livewire:project.application.source :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'destination'">
<livewire:project.application.destination :destination="$application->destination" />
<livewire:project.shared.destination :destination="$application->destination" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.application.storages.all :application="$application" />
<livewire:project.shared.storages.all :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'previews'">
<livewire:project.application.previews :application="$application" />
@@ -56,10 +56,10 @@
<livewire:project.application.rollback :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'resource-limits'">
<livewire:project.application.resource-limits :application="$application" />
<livewire:project.shared.resource-limits :resource="$application" />
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.application.danger :application="$application" />
<livewire:project.shared.danger :resource="$application" />
</div>
</div>
</div>

View File

@@ -19,8 +19,6 @@
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
href="#">Environment
Variables</a>
<a :class="activeTab === 'source' && 'text-white'"
@click.prevent="activeTab = 'source'; window.location.hash = 'source'" href="#">Source</a>
<a :class="activeTab === 'destination' && 'text-white'"
@click.prevent="activeTab = 'destination'; window.location.hash = 'destination'"
href="#">Destination
@@ -38,27 +36,24 @@
</div>
<div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'general'" class="h-full">
@if ($database->type() === 'postgresql')
@if ($database->type() === 'standalone-postgresql')
<livewire:project.database.postgresql.general :database="$database" />
@endif
</div>
<div x-cloak x-show="activeTab === 'environment-variables'">
{{-- <livewire:project.application.environment-variable.all :application="$application" /> --}}
</div>
<div x-cloak x-show="activeTab === 'source'">
{{-- <livewire:project.application.source :application="$application" /> --}}
<livewire:project.shared.environment-variable.all :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'destination'">
{{-- <livewire:project.application.destination :destination="$application->destination" /> --}}
<livewire:project.shared.destination :destination="$database->destination" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
{{-- <livewire:project.application.storages.all :application="$application" /> --}}
<livewire:project.shared.storages.all :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'resource-limits'">
{{-- <livewire:project.application.resource-limits :application="$application" /> --}}
<livewire:project.shared.resource-limits :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'danger'">
{{-- <livewire:project.application.danger :application="$application" /> --}}
<livewire:project.shared.danger :resource="$database" />
</div>
</div>
</div>