ui ui ui ui ui ui ux ux ux ux ux ux

This commit is contained in:
Andras Bacsai
2024-03-21 12:44:32 +01:00
parent 8f66a41c09
commit b5775ff9d2
61 changed files with 597 additions and 430 deletions

View File

@@ -42,19 +42,21 @@ class BackupEdit extends Component
public function delete()
{
// TODO: Delete backup from server and add a confirmation modal
$this->backup->delete();
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
$previousUrl = url()->previous();
$url = Url::fromString($previousUrl);
$url = $url->withoutQueryParameter('selectedBackupId');
$url = $url->withFragment('backups');
$url = $url->getPath() . "#{$url->getFragment()}";
return redirect($url);
} else {
return redirect()->route('project.database.backup.index', $this->parameters);
try {
$this->backup->delete();
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
$previousUrl = url()->previous();
$url = Url::fromString($previousUrl);
$url = $url->withoutQueryParameter('selectedBackupId');
$url = $url->withFragment('backups');
$url = $url->getPath() . "#{$url->getFragment()}";
return redirect($url);
} else {
return redirect()->route('project.database.backup.index', $this->parameters);
}
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function instantSave()
@@ -63,7 +65,7 @@ class BackupEdit extends Component
$this->custom_validate();
$this->backup->save();
$this->backup->refresh();
$this->dispatch('success', 'Backup updated successfully');
$this->dispatch('success', 'Backup updated successfully.');
} catch (\Throwable $e) {
$this->dispatch('error', $e->getMessage());
}

View File

@@ -34,7 +34,12 @@ class Database extends Component
}
$this->refreshFileStorages();
}
public function instantSaveAdvanced()
public function instantSaveExclude()
{
$this->submit();
}
public function instantSaveLogDrain()
{
if (!$this->database->service->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
@@ -74,6 +79,7 @@ class Database extends Component
public function submit()
{
try {
ray('asdf');
$this->validate();
$this->database->save();
updateCompose($this->database);

View File

@@ -1,11 +1,11 @@
<?php
namespace App\Livewire\Modal;
namespace App\Livewire\Project\Service;
use App\Models\Service;
use LivewireUI\Modal\ModalComponent;
use Livewire\Component;
class EditCompose extends ModalComponent
class EditCompose extends Component
{
public Service $service;
public $serviceId;
@@ -16,13 +16,13 @@ class EditCompose extends ModalComponent
public function mount() {
$this->service = Service::find($this->serviceId);
}
public function render()
{
return view('livewire.modal.edit-compose');
}
public function submit() {
public function saveEditedCompose() {
$this->dispatch('warning', "Saving new docker compose...");
$this->dispatch('saveCompose', $this->service->docker_compose_raw);
$this->closeModal();
}
public function render()
{
return view('livewire.project.service.edit-compose');
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace App\Livewire\Project\Service;
use Livewire\Component;
class Modal extends Component
{
public function render()
{
return view('livewire.project.service.modal');
}
}

View File

@@ -16,17 +16,24 @@ class Navbar extends Component
public array $parameters;
public array $query;
public $isDeploymentProgress = false;
public function getListeners()
{
$userId = auth()->user()->id;
return [
"echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',
"serviceStatusChanged"
];
}
public function serviceStarted() {
$this->dispatch('success', 'Service started.');
}
public function serviceStatusChanged()
{
$this->dispatch('refresh')->self();
}
public function check_status() {
public function check_status()
{
$this->dispatch('check_status');
$this->dispatch('success', 'Service status updated.');
}
@@ -44,7 +51,7 @@ class Navbar extends Component
$this->isDeploymentProgress = false;
}
}
public function deploy()
public function start()
{
$this->checkDeployments();
if ($this->isDeploymentProgress) {
@@ -73,9 +80,9 @@ class Navbar extends Component
return;
}
PullImage::run($this->service);
$this->dispatch('image-pulled');
StopService::run($this->service);
$this->service->parse();
$this->dispatch('imagePulled');
$activity = StartService::run($this->service);
$this->dispatch('activityMonitor', $activity->id);
}

View File

@@ -2,11 +2,12 @@
namespace App\Livewire\Project\Service;
use App\Models\Service;
use Livewire\Component;
class StackForm extends Component
{
public $service;
public Service $service;
public $fields = [];
protected $listeners = ["saveCompose"];
public $rules = [

View File

@@ -50,6 +50,7 @@ class Show extends Component
$this->private_key->private_key = formatPrivateKey($this->private_key->private_key);
$this->private_key->save();
refresh_server_connection($this->private_key);
$this->dispatch('success', 'Private key updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@@ -49,7 +49,8 @@ class Deploy extends Component
{
$this->server->refresh();
}
public function restart() {
public function restart()
{
try {
$this->stop();
$this->dispatch('checkProxy');

View File

@@ -19,7 +19,7 @@ class Checkbox extends Component
public ?string $helper = null,
public string|bool $instantSave = false,
public bool $disabled = false,
public string $defaultClass = "border-coolgray-500 text-warning focus:ring-warning dark:bg-coolgray-100 rounded cursor-pointer dark:disabled:bg-base dark:disabled:cursor-not-allowed",
public string $defaultClass = "dark:border-neutral-700 text-warning focus:ring-warning dark:bg-coolgray-100 rounded cursor-pointer dark:disabled:bg-base dark:disabled:cursor-not-allowed",
) {
//
}