UI stuffs

This commit is contained in:
Andras Bacsai
2023-07-13 13:16:24 +02:00
parent 3cc1731c12
commit a0b2868e95
43 changed files with 618 additions and 427 deletions

View File

@@ -4,14 +4,17 @@ namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Danger extends Component
{
public Application $application;
public array $parameters;
public string|null $modalId = null;
public function mount()
{
$this->modalId = new Cuid2(7);
$this->parameters = getRouteParameters();
}
public function delete()

View File

@@ -29,6 +29,7 @@ class Add extends Component
}
public function submit()
{
ray('submitting');
$this->validate();
$this->emitUp('submit', [
'key' => $this->key,
@@ -36,6 +37,7 @@ class Add extends Component
'is_build_time' => $this->is_build_time,
'is_preview' => $this->is_preview,
]);
$this->clear();
}
public function clear()
{

View File

@@ -5,11 +5,17 @@ namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
use App\Models\Application;
use App\Models\EnvironmentVariable;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class All extends Component
{
public Application $application;
public string|null $modalId = null;
protected $listeners = ['refreshEnvs', 'submit'];
public function mount()
{
$this->modalId = new Cuid2(7);
}
public function refreshEnvs()
{
$this->application->refresh();
@@ -17,6 +23,11 @@ class All extends Component
public function submit($data)
{
try {
$found = $this->application->environment_variables()->where('key', $data['key'])->first();
if ($found) {
$this->emit('error', 'Environment variable already exists.');
return;
}
EnvironmentVariable::create([
'key' => $data['key'],
'value' => $data['value'],
@@ -27,7 +38,6 @@ class All extends Component
$this->application->refresh();
$this->emit('success', 'Environment variable added successfully.');
$this->emit('clearAddEnv');
} catch (\Exception $e) {
return general_error_handler(err: $e, that: $this);
}

View File

@@ -4,12 +4,13 @@ namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
use App\Models\EnvironmentVariable as ModelsEnvironmentVariable;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $parameters;
public ModelsEnvironmentVariable $env;
public string|null $modalId = null;
protected $rules = [
'env.key' => 'required|string',
'env.value' => 'required|string',
@@ -22,6 +23,7 @@ class Show extends Component
];
public function mount()
{
$this->modalId = new Cuid2(7);
$this->parameters = getRouteParameters();
}
public function submit()

View File

@@ -3,10 +3,12 @@
namespace App\Http\Livewire\Project\Application\Storages;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $storage;
public string|null $modalId = null;
protected $rules = [
'storage.name' => 'required|string',
'storage.mount_path' => 'required|string',
@@ -17,6 +19,10 @@ class Show extends Component
'mount_path' => 'mount',
'host_path' => 'host',
];
public function mount()
{
$this->modalId = new Cuid2(7);
}
public function submit()
{
$this->validate();

View File

@@ -5,6 +5,7 @@ namespace App\Http\Livewire\Server;
use App\Actions\Server\InstallDocker;
use App\Models\Server;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Form extends Component
{
@@ -13,6 +14,7 @@ class Form extends Component
public $dockerVersion;
public string|null $wildcard_domain = null;
public int $cleanup_after_percentage;
public string|null $modalId = null;
protected $rules = [
'server.name' => 'required|min:6',
@@ -35,6 +37,7 @@ class Form extends Component
];
public function mount()
{
$this->modalId = new Cuid2(7);
$this->wildcard_domain = $this->server->settings->wildcard_domain;
$this->cleanup_after_percentage = $this->server->settings->cleanup_after_percentage;
}
@@ -98,4 +101,4 @@ class Form extends Component
$this->server->save();
$this->emit('success', 'Server updated successfully.');
}
}
}