diff --git a/app/Livewire/Upgrade.php b/app/Livewire/Upgrade.php index 36bee2a23..7948ad6a9 100644 --- a/app/Livewire/Upgrade.php +++ b/app/Livewire/Upgrade.php @@ -17,11 +17,14 @@ class Upgrade extends Component public string $currentVersion = ''; + public bool $devMode = false; + protected $listeners = ['updateAvailable' => 'checkUpdate']; public function mount() { $this->currentVersion = config('constants.coolify.version'); + $this->devMode = isDev(); } public function checkUpdate() diff --git a/resources/views/components/upgrade-progress.blade.php b/resources/views/components/upgrade-progress.blade.php index d65273cce..1418ca6c9 100644 --- a/resources/views/components/upgrade-progress.blade.php +++ b/resources/views/components/upgrade-progress.blade.php @@ -9,7 +9,7 @@ The currentStep variable is inherited from parent Alpine component (upgradeModal). --}} -
+
{{-- Step 1: Preparing --}}
diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php index dcc664e84..b37a99095 100644 --- a/resources/views/livewire/upgrade.blade.php +++ b/resources/views/livewire/upgrade.blade.php @@ -1,7 +1,8 @@
@if ($isUpgradeAvailable)
@@ -39,7 +40,7 @@ class="absolute inset-0 w-full h-full bg-black/20 backdrop-blur-xs">
x-transition:leave="ease-in duration-100" x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100" x-transition:leave-end="opacity-0 -translate-y-2 sm:scale-95" - class="relative w-full py-6 border rounded-sm min-w-full lg:min-w-[36rem] max-w-fit bg-neutral-100 border-neutral-400 dark:bg-base px-7 dark:border-coolgray-300"> + class="relative w-[48rem] max-w-[calc(100vw-2rem)] py-6 border rounded-sm bg-neutral-100 border-neutral-400 dark:bg-base px-7 dark:border-coolgray-300"> {{-- Header --}}
@@ -163,6 +164,12 @@ class="font-bold text-warning"> seconds... class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel
+ Upgrade Now @@ -193,6 +200,39 @@ class="w-24 dark:bg-coolgray-200 dark:hover:bg-coolgray-300">Cancel currentVersion: config.currentVersion || '', latestVersion: config.latestVersion || '', serviceDown: false, + devMode: config.devMode || false, + simulationInterval: null, + + simulateUpgrade() { + if (!this.devMode) return; + + this.showProgress = true; + this.currentStep = 1; + this.currentStatus = '[DEV] Starting simulated upgrade...'; + this.startTimer(); + this.upgradeComplete = false; + this.upgradeError = false; + + const steps = [ + { step: 1, status: '[DEV] Preparing upgrade environment...' }, + { step: 2, status: '[DEV] Pulling helper image...' }, + { step: 3, status: '[DEV] Pulling Coolify image...' }, + { step: 4, status: '[DEV] Restarting services...' }, + ]; + + let stepIndex = 0; + this.simulationInterval = setInterval(() => { + if (stepIndex < steps.length) { + this.currentStep = steps[stepIndex].step; + this.currentStatus = steps[stepIndex].status; + stepIndex++; + } else { + clearInterval(this.simulationInterval); + this.simulationInterval = null; + this.showSuccess(); + } + }, 2000); + }, confirmed() { this.showProgress = true;