From ee515ff940eb990c2cb41aa2920051695d6fa663 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 23 May 2023 09:53:24 +0200 Subject: [PATCH] wip --- .../Project/Application/PollDeployment.php | 5 ++-- app/Jobs/ContainerStatusJob.php | 7 +++++- app/Jobs/DeployApplicationJob.php | 15 ++++++++---- resources/css/app.css | 4 +++- .../components/inputs/checkbox.blade.php | 2 +- .../views/components/inputs/input.blade.php | 2 +- resources/views/components/navbar.blade.php | 2 +- .../views/livewire/activity-monitor.blade.php | 2 +- .../application/get-deployments.blade.php | 24 ++++++++++++++----- .../application/poll-deployment.blade.php | 2 +- .../views/livewire/server/proxy.blade.php | 2 +- .../application/configuration.blade.php | 4 ++-- .../project/application/deployments.blade.php | 2 +- resources/views/project/resources.blade.php | 11 +++++---- resources/views/project/show.blade.php | 7 +++++- resources/views/server/show.blade.php | 10 +++++--- 16 files changed, 69 insertions(+), 32 deletions(-) diff --git a/app/Http/Livewire/Project/Application/PollDeployment.php b/app/Http/Livewire/Project/Application/PollDeployment.php index c09106afb..2e38ab292 100644 --- a/app/Http/Livewire/Project/Application/PollDeployment.php +++ b/app/Http/Livewire/Project/Application/PollDeployment.php @@ -3,6 +3,7 @@ namespace App\Http\Livewire\Project\Application; use App\Enums\ActivityTypes; +use Illuminate\Support\Facades\Redis; use Livewire\Component; use Spatie\Activitylog\Models\Activity; @@ -14,7 +15,7 @@ class PollDeployment extends Component public function polling() { - if ( is_null($this->activity) && isset($this->deployment_uuid)) { + if (is_null($this->activity) && isset($this->deployment_uuid)) { $this->activity = Activity::query() ->where('properties->type', '=', ActivityTypes::DEPLOYMENT->value) ->where('properties->type_uuid', '=', $this->deployment_uuid) @@ -23,7 +24,7 @@ public function polling() $this->activity?->refresh(); } - if (data_get($this->activity, 'properties.status') == 'finished' || data_get($this->activity, 'properties.status') == 'failed' ) { + if (data_get($this->activity, 'properties.status') == 'finished' || data_get($this->activity, 'properties.status') == 'failed') { $this->isKeepAliveOn = false; } } diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index de3660de4..85be298c9 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -5,13 +5,14 @@ use App\Models\Application; use App\Models\Server; use Illuminate\Bus\Queueable; +use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; -class ContainerStatusJob implements ShouldQueue +class ContainerStatusJob implements ShouldQueue, ShouldBeUnique { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; @@ -19,6 +20,10 @@ public function __construct( public string|null $container_id = null, ) { } + public function uniqueId(): string + { + return $this->container_id; + } public function handle(): void { try { diff --git a/app/Jobs/DeployApplicationJob.php b/app/Jobs/DeployApplicationJob.php index a18e8ae22..e6b84ae93 100644 --- a/app/Jobs/DeployApplicationJob.php +++ b/app/Jobs/DeployApplicationJob.php @@ -6,19 +6,18 @@ use App\Data\CoolifyTaskArgs; use App\Enums\ActivityTypes; use App\Models\Application; -use App\Models\InstanceSettings; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Spatie\Activitylog\Models\Activity; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Str; use Spatie\Url\Url; +use Illuminate\Queue\Middleware\WithoutOverlapping; class DeployApplicationJob implements ShouldQueue { @@ -35,9 +34,15 @@ class DeployApplicationJob implements ShouldQueue protected $env_args; public static int $batch_counter = 0; public $timeout = 3600; - /** - * Create a new job instance. - */ + + public function middleware(): array + { + return [new WithoutOverlapping($this->application_uuid)]; + } + public function uniqueId(): string + { + return $this->application_uuid; + } public function __construct( public string $deployment_uuid, public string $application_uuid, diff --git a/resources/css/app.css b/resources/css/app.css index 1503638de..a55c30aba 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -31,7 +31,9 @@ textarea { select { @apply select select-sm disabled:opacity-40 font-normal placeholder:text-neutral-700 text-white rounded-none; } - +.breadcrumbs > ul > li::before { + @apply text-warning opacity-100; +} button[type="button"] { @apply btn btn-xs bg-coolgray-200 no-animation normal-case text-white rounded-none; } diff --git a/resources/views/components/inputs/checkbox.blade.php b/resources/views/components/inputs/checkbox.blade.php index a1f927ba1..db81c2283 100644 --- a/resources/views/components/inputs/checkbox.blade.php +++ b/resources/views/components/inputs/checkbox.blade.php @@ -25,7 +25,7 @@ class="w-4 h-4 stroke-current">