From b5775ff9d2a4c3d5edc47ded2cde602be467e5f5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 21 Mar 2024 12:44:32 +0100 Subject: [PATCH] ui ui ui ui ui ui ux ux ux ux ux ux --- app/Livewire/Project/Database/BackupEdit.php | 28 ++-- app/Livewire/Project/Service/Database.php | 8 +- .../Service}/EditCompose.php | 18 +-- app/Livewire/Project/Service/Modal.php | 13 -- app/Livewire/Project/Service/Navbar.php | 13 +- app/Livewire/Project/Service/StackForm.php | 3 +- app/Livewire/Security/PrivateKey/Show.php | 1 + app/Livewire/Server/Proxy/Deploy.php | 3 +- app/View/Components/Forms/Checkbox.php | 2 +- bootstrap/helpers/services.php | 2 +- resources/css/app.css | 9 +- .../components/applications/links.blade.php | 8 +- .../components/databases/navbar.blade.php | 46 ------ .../views/components/forms/checkbox.blade.php | 2 +- resources/views/components/loading.blade.php | 4 +- .../components/modal-confirmation.blade.php | 50 +++++-- resources/views/components/navbar.blade.php | 2 +- .../views/components/resource-view.blade.php | 2 +- .../views/components/services/links.blade.php | 57 ++++---- .../components/services/navbar.blade.php | 94 ------------- .../views/components/slide-over.blade.php | 9 +- resources/views/components/toast.blade.php | 2 +- resources/views/layouts/base.blade.php | 42 +++++- resources/views/layouts/boarding.blade.php | 21 ++- .../views/livewire/activity-monitor.blade.php | 9 +- resources/views/livewire/dashboard.blade.php | 2 +- .../views/livewire/layout-popups.blade.php | 4 +- .../livewire/modal/edit-compose.blade.php | 32 ----- .../project/database/backup-edit.blade.php | 9 +- .../database/backup-executions.blade.php | 18 ++- .../project/database/backup/index.blade.php | 11 +- .../create-scheduled-backup.blade.php | 39 +++-- .../project/database/heading.blade.php | 71 +++++++++- .../project/database/import.blade.php | 4 +- .../database/scheduled-backups.blade.php | 6 +- .../views/livewire/project/edit.blade.php | 2 +- .../project/environment-edit.blade.php | 2 +- ...ub-private-repository-deploy-key.blade.php | 2 +- .../project/service/database.blade.php | 6 +- .../project/service/edit-compose.blade.php | 29 ++++ .../livewire/project/service/index.blade.php | 10 +- .../livewire/project/service/modal.blade.php | 12 -- .../livewire/project/service/navbar.blade.php | 133 +++++++++++++++++- .../service-application-view.blade.php | 7 +- .../project/service/stack-form.blade.php | 21 +-- .../project/shared/destination.blade.php | 2 +- .../shared/environment-variable/all.blade.php | 2 +- .../project/shared/get-logs.blade.php | 4 +- .../shared/scheduled-task/all.blade.php | 2 +- .../livewire/realtime-connection.blade.php | 2 +- .../livewire/security/api-tokens.blade.php | 7 +- .../livewire/server/proxy/deploy.blade.php | 101 ++++++------- .../views/livewire/server/resources.blade.php | 6 +- .../livewire/source/github/change.blade.php | 2 +- .../livewire/source/github/create.blade.php | 6 +- .../livewire/subscription/index.blade.php | 2 +- .../team-shared-variables-index.blade.php | 2 +- .../views/livewire/team/invitations.blade.php | 2 +- .../views/livewire/team/member.blade.php | 2 +- .../livewire/team/member/index.blade.php | 2 +- resources/views/source/all.blade.php | 15 +- 61 files changed, 597 insertions(+), 430 deletions(-) rename app/Livewire/{Modal => Project/Service}/EditCompose.php (69%) delete mode 100644 app/Livewire/Project/Service/Modal.php delete mode 100644 resources/views/components/databases/navbar.blade.php delete mode 100644 resources/views/components/services/navbar.blade.php delete mode 100644 resources/views/livewire/modal/edit-compose.blade.php create mode 100644 resources/views/livewire/project/service/edit-compose.blade.php delete mode 100644 resources/views/livewire/project/service/modal.blade.php diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.php index 86aec0f6a..f5f476257 100644 --- a/app/Livewire/Project/Database/BackupEdit.php +++ b/app/Livewire/Project/Database/BackupEdit.php @@ -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()); } diff --git a/app/Livewire/Project/Service/Database.php b/app/Livewire/Project/Service/Database.php index 8dec97852..a2d8f29a6 100644 --- a/app/Livewire/Project/Service/Database.php +++ b/app/Livewire/Project/Service/Database.php @@ -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); diff --git a/app/Livewire/Modal/EditCompose.php b/app/Livewire/Project/Service/EditCompose.php similarity index 69% rename from app/Livewire/Modal/EditCompose.php rename to app/Livewire/Project/Service/EditCompose.php index f2804e5ac..cc385315e 100644 --- a/app/Livewire/Modal/EditCompose.php +++ b/app/Livewire/Project/Service/EditCompose.php @@ -1,11 +1,11 @@ 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'); } } diff --git a/app/Livewire/Project/Service/Modal.php b/app/Livewire/Project/Service/Modal.php deleted file mode 100644 index 653425835..000000000 --- a/app/Livewire/Project/Service/Modal.php +++ /dev/null @@ -1,13 +0,0 @@ -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); } diff --git a/app/Livewire/Project/Service/StackForm.php b/app/Livewire/Project/Service/StackForm.php index 650dde792..1bfb70c5e 100644 --- a/app/Livewire/Project/Service/StackForm.php +++ b/app/Livewire/Project/Service/StackForm.php @@ -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 = [ diff --git a/app/Livewire/Security/PrivateKey/Show.php b/app/Livewire/Security/PrivateKey/Show.php index a4fbaef52..0540b2e29 100644 --- a/app/Livewire/Security/PrivateKey/Show.php +++ b/app/Livewire/Security/PrivateKey/Show.php @@ -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); } diff --git a/app/Livewire/Server/Proxy/Deploy.php b/app/Livewire/Server/Proxy/Deploy.php index 72d0b3884..8a029e6a1 100644 --- a/app/Livewire/Server/Proxy/Deploy.php +++ b/app/Livewire/Server/Proxy/Deploy.php @@ -49,7 +49,8 @@ class Deploy extends Component { $this->server->refresh(); } - public function restart() { + public function restart() + { try { $this->stop(); $this->dispatch('checkProxy'); diff --git a/app/View/Components/Forms/Checkbox.php b/app/View/Components/Forms/Checkbox.php index 36b561eda..0047e7a4d 100644 --- a/app/View/Components/Forms/Checkbox.php +++ b/app/View/Components/Forms/Checkbox.php @@ -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", ) { // } diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.php index dd05c67eb..7cb8595db 100644 --- a/bootstrap/helpers/services.php +++ b/bootstrap/helpers/services.php @@ -94,7 +94,7 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource) $resource->service->docker_compose_raw = $dockerComposeRaw; $resource->service->save(); - if (!str($resource->fqdn)->contains(',')) { + if ($resource->fqdn && !str($resource->fqdn)->contains(',')) { // Update FQDN $variableName = "SERVICE_FQDN_" . Str::of($resource->name)->upper(); $generatedEnv = EnvironmentVariable::where('service_id', $resource->service_id)->where('key', $variableName)->first(); diff --git a/resources/css/app.css b/resources/css/app.css index ce97eebf7..f76067b51 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -4,7 +4,7 @@ html, body { - @apply text-black bg-white dark:bg-base dark:text-neutral-400; + @apply bg-white text-neutral-600 dark:bg-base dark:text-neutral-400; } body { @@ -12,7 +12,7 @@ body { } .button { - @apply px-3 py-1.5 text-sm font-normal normal-case rounded bg-neutral-200 hover:bg-neutral-300 dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100 dark:disabled:bg-coolgray-100/40 dark:disabled:text-neutral-800 min-w-fit flex items-center justify-center; + @apply flex items-center justify-center px-3 py-1 text-sm font-normal normal-case rounded bg-neutral-200 hover:bg-neutral-300 dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100 dark:disabled:bg-coolgray-100/40 dark:disabled:text-neutral-800 min-w-fit; } button[isError]:not(:disabled) { @apply bg-red-600 hover:bg-red-700; @@ -23,7 +23,6 @@ button[isHighlighted]:not(:disabled) { } - h1 { @apply text-2xl font-bold dark:text-white text-neutral-800; } @@ -41,7 +40,7 @@ h4 { } a { - @apply dark:hover:text-white dark:text-neutral-400 text-neutral-600; + @apply hover:text-black dark:hover:text-white; } label { @@ -101,7 +100,7 @@ option { } .dropdown-item { - @apply relative flex cursor-pointer select-none dark:hover:text-white dark:hover:bg-coollabs items-center px-2 py-1.5 text-xs justify-center outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 gap-2 + @apply relative flex cursor-pointer select-none dark:hover:text-white dark:hover:bg-coollabs items-center pr-4 pl-2 py-1 text-xs justify-center outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 gap-2 w-full; } .badge { diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php index d6a0d15d5..dc067dfe6 100644 --- a/resources/views/components/applications/links.blade.php +++ b/resources/views/components/applications/links.blade.php @@ -11,15 +11,13 @@ stroke-width="1.5" stroke="currentColor"> - +
-
- {{--
Domains
--}} - {{--
--}} + class="absolute top-0 z-50 mt-6 min-w-max" x-cloak> +
@if ( (data_get($application, 'fqdn') || collect(json_decode($this->application->docker_compose_domains))->count() > 0 || diff --git a/resources/views/components/databases/navbar.blade.php b/resources/views/components/databases/navbar.blade.php deleted file mode 100644 index 962c3d22e..000000000 --- a/resources/views/components/databases/navbar.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - diff --git a/resources/views/components/forms/checkbox.blade.php b/resources/views/components/forms/checkbox.blade.php index cd0b397be..749c7a21a 100644 --- a/resources/views/components/forms/checkbox.blade.php +++ b/resources/views/components/forms/checkbox.blade.php @@ -1,4 +1,4 @@ -
+