This commit is contained in:
Andras Bacsai
2023-05-04 15:45:53 +02:00
parent ec0e560bac
commit d5b332fc59
16 changed files with 149 additions and 43 deletions

View File

@@ -19,9 +19,9 @@ class Change extends Component
{
$this->private_key = PrivateKey::where('uuid', $this->private_key_uuid)->first();
}
public function delete($private_key_uuid)
public function delete()
{
PrivateKey::where('uuid', $private_key_uuid)->delete();
PrivateKey::where('uuid', $this->private_key_uuid)->delete();
session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
redirect()->route('dashboard');
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class EnvironmentVariable extends Component
{
public $parameters;
public $env;
public string|null $keyName = null;
public string|null $value = null;
public bool $isBuildOnly = false;
public bool $isNewEnv = false;
public function mount()
{
$this->parameters = Route::current()->parameters();
if (data_get($this->env, 'value') !== null) {
$this->value = $this->env['value'];
$this->isBuildOnly = $this->env['isBuildOnly'];
} else {
$this->isNewEnv = true;
}
}
public function updateEnv()
{
$application = Application::where('uuid', $this->parameters['application_uuid'])->first();
$application->environment_variables->set("{$this->keyName}.value", $this->value);
$application->environment_variables->set("{$this->keyName}.isBuildOnly", $this->isBuildOnly);
$application->save();
}
public function submit()
{
$this->updateEnv();
$this->emit('reloadWindow');
}
public function delete()
{
$application = Application::where('uuid', $this->parameters['application_uuid'])->first();
$application->environment_variables->forget($this->keyName);
$application->save();
$this->emit('reloadWindow');
}
}

View File

@@ -1,10 +0,0 @@
<?php
namespace App\Http\Livewire\Project\Application;
use Livewire\Component;
class EnvironmentVariables extends Component
{
public array $envs = [];
}