Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

ui fixes

Andras Bacsai539f82eb08fa
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
index c6bd504f53..3e1635a658 100644
--- a/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
@@ -15,13 +15,20 @@ class Add extends Component
public string $value;
public bool $is_build_time = false;
+ protected $rules = [
+ 'key' => 'required|string',
+ 'value' => 'required|string',
+ 'is_build_time' => 'required|boolean',
+ ];
public function mount()
{
$this->parameters = Route::current()->parameters();
}
public function submit()
{
+ $this->validate();
try {
+
$application_id = Application::where('uuid', $this->parameters['application_uuid'])->firstOrFail()->id;
EnvironmentVariable::create([
'key' => $this->key,
@@ -29,7 +36,9 @@ class Add extends Component
'is_build_time' => $this->is_build_time,
'application_id' => $application_id,
]);
- $this->emit('reloadWindow');
+ $this->emit('refreshEnvs');
+ $this->key = '';
+ $this->value = '';
} catch (mixed $e) {
dd('asdf');
if ($e instanceof QueryException) {
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php
new file mode 100644
index 0000000000..37c2bd7eca
--- /dev/null
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
+
+use App\Models\Application;
+use Livewire\Component;
+
+class All extends Component
+{
+ public Application $application;
+ protected $listeners = ['refreshEnvs' => 'refreshEnvs'];
+ public function refreshEnvs()
+ {
+ $this->application->refresh();
+ }
+}
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
index f32260ca02..8c855e8f41 100644
--- a/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
@@ -30,6 +30,6 @@ class Show extends Component
public function delete()
{
$this->env->delete();
- $this->emit('reloadWindow');
+ $this->emit('refreshEnvs');
}
}
diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.php
index ec55e5f99e..9b40b4be3a 100644
--- a/app/Http/Livewire/Project/Application/General.php
+++ b/app/Http/Livewire/Project/Application/General.php
@@ -45,7 +45,7 @@ class General extends Component
];
public function instantSave()
{
- // @TODO: find another way
+ // @TODO: find another way - if possible
$this->application->settings->is_static = $this->is_static;
$this->application->settings->is_git_submodules_allowed = $this->is_git_submodules_allowed;
$this->application->settings->is_git_lfs_allowed = $this->is_git_lfs_allowed;
diff --git a/resources/views/components/inputs/input.blade.php b/resources/views/components/inputs/input.blade.php
index 975e59f8d8..10c61ba507 100644
--- a/resources/views/components/inputs/input.blade.php
+++ b/resources/views/components/inputs/input.blade.php
@@ -1,36 +1,40 @@
@props([
'id' => null,
'type' => 'text',
- 'required' => false,
+ 'required' => $attributes->has('required'),
'label' => null,
'instantSave' => false,
'disabled' => false,
'hidden' => false,
+ 'noLabel' => false,
+ 'noDirty' => false,
])
-
<span @class([
'flex justify-end' => $type === 'checkbox',
'flex flex-col' => $type !== 'checkbox',
])>
- <label for={{ $id }}>
- @if ($label)
- {{ $label }}
- @else
- {{ $id }}
- @endif
- @if ($required)
- *
- @endif
- </label>
+ @if (!$noLabel)
+ <label for={{ $id }}>
+ @if ($label)
+ {{ $label }}
+ @else
+ {{ $id }}
+ @endif
+ @if ($required)
+ *
+ @endif
+ </label>
+ @endif
@if ($type === 'textarea')
- <textarea {{ $attributes }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
+ <textarea @if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif {{ $attributes }}
+ required={{ $required }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
@else
- <input wire:dirty.class="text-black bg-amber-300" {{ $attributes }} type={{ $type }}
- id={{ $id }}
+ <input {{ $attributes }} required={{ $required }}
+ @if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif
+ type={{ $type }} id={{ $id }}
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
@endif
-
@error($id)
<div class="text-red-500">{{ $message }}</div>
@enderror
diff --git a/resources/views/livewire/project/application/environment-variable/add.blade.php b/resources/views/livewire/project/application/environment-variable/add.blade.php
index d7dbeadff2..4ad26a2f0e 100644
--- a/resources/views/livewire/project/application/environment-variable/add.blade.php
+++ b/resources/views/livewire/project/application/environment-variable/add.blade.php
@@ -1,10 +1,10 @@
-<form wire:submit.prevent='submit' class="flex gap-2 p-4">
- <input type="text" wire:model.defer="key" wire:dirty.class="text-black bg-amber-300" />
- <input type="text" wire:model.defer="value" wire:dirty.class="text-black bg-amber-300" />
+<form wire:submit.prevent='submit' class="flex gap-2 px-2">
+ <x-inputs.input noLabel noDirty id="key" required />
+ <x-inputs.input noLabel noDirty id="value" required />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="is_build_time" />
- <label>Used during build?</label>
+ <label>Build Variable?</label>
</div>
</div>
<x-inputs.button type="submit">
diff --git a/resources/views/livewire/project/application/environment-variable/all.blade.php b/resources/views/livewire/project/application/environment-variable/all.blade.php
new file mode 100644
index 0000000000..b68741be80
--- /dev/null
+++ b/resources/views/livewire/project/application/environment-variable/all.blade.php
@@ -0,0 +1,10 @@
+<div class="flex flex-col gap-2">
+ <h3>Environment Variables</h3>
+ @forelse ($application->environment_variables as $env)
+ <livewire:project.application.environment-variable.show wire:key="item-{{ $env->id }}" :env="$env" />
+ @empty
+ <p>There are no environment variables for this application.</p>
+ @endforelse
+ <h4>Add new environment variable</h4>
+ <livewire:project.application.environment-variable.add />
+</div>
diff --git a/resources/views/livewire/project/application/environment-variable/show.blade.php b/resources/views/livewire/project/application/environment-variable/show.blade.php
index e0d54759e6..cadff1f8ec 100644
--- a/resources/views/livewire/project/application/environment-variable/show.blade.php
+++ b/resources/views/livewire/project/application/environment-variable/show.blade.php
@@ -1,11 +1,11 @@
<div x-data="{ deleteEnvironment: false }">
- <form wire:submit.prevent='submit' class="flex gap-2 p-4">
+ <form wire:submit.prevent='submit' class="flex gap-2 px-2">
<input type="text" wire:model.defer="env.key" wire:dirty.class="text-black bg-amber-300" />
<input type="text" wire:model.defer="env.value" wire:dirty.class="text-black bg-amber-300" />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="env.is_build_time" />
- <label>Used during build?</label>
+ <label wire:dirty.class="text-amber-300" wire:target="env.is_build_time">Build Variable?</label>
</div>
</div>
<x-inputs.button type="submit">
diff --git a/resources/views/project/application/configuration.blade.php b/resources/views/project/application/configuration.blade.php
index 91775f5dc5..795268f1c5 100644
--- a/resources/views/project/application/configuration.blade.php
+++ b/resources/views/project/application/configuration.blade.php
@@ -23,15 +23,8 @@
<h3>General Configurations</h3>
<livewire:project.application.general :applicationId="$application->id" />
</div>
- <div x-cloak x-show="activeTab === 'environment-variables'" class="flex flex-col gap-2">
- <h3>Environment Variables</h3>
- @forelse ($application->environment_variables as $env)
- <livewire:project.application.environment-variable.show :env="$env" />
- @empty
- <p>There are no environment variables for this application.</p>
- @endforelse
- <h4>Add new environment variable</h4>
- <livewire:project.application.environment-variable.add />
+ <div x-cloak x-show="activeTab === 'environment-variables'">
+ <livewire:project.application.environment-variable.all :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'source'">
<h3>Source</h3>