This commit is contained in:
Andras Bacsai
2023-05-05 09:28:00 +02:00
parent 23f58b8c13
commit 539f82eb08
9 changed files with 66 additions and 34 deletions

View File

@@ -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) {

View File

@@ -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();
}
}

View File

@@ -30,6 +30,6 @@ class Show extends Component
public function delete()
{
$this->env->delete();
$this->emit('reloadWindow');
$this->emit('refreshEnvs');
}
}

View File

@@ -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;