From 43dacd83c9f1afa9bbddad9211d223b72b3572d6 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:13:35 +0100 Subject: [PATCH] chore: use the new job dispatch --- app/Livewire/Project/CloneMe.php | 22 +++++++++++-------- .../Project/Shared/ResourceOperations.php | 22 +++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/Livewire/Project/CloneMe.php b/app/Livewire/Project/CloneMe.php index e794ff2ea..c71f6db64 100644 --- a/app/Livewire/Project/CloneMe.php +++ b/app/Livewire/Project/CloneMe.php @@ -218,14 +218,15 @@ class CloneMe extends Component StopApplication::dispatch($application, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $application->destination->server; + $sourceServer = $application->destination->server; + $targetServer = $newApplication->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); queue_application_deployment( deployment_uuid: (string) new Cuid2, application: $application, - server: $server, + server: $sourceServer, destination: $application->destination, no_questions_asked: true ); @@ -325,9 +326,10 @@ class CloneMe extends Component StopDatabase::dispatch($database); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $database->destination->server; + $sourceServer = $database->destination->server; + $targetServer = $newDatabase->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartDatabase::dispatch($database); } catch (\Exception $e) { @@ -452,9 +454,10 @@ class CloneMe extends Component StopService::dispatch($application, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $application->service->destination->server; + $sourceServer = $application->service->destination->server; + $targetServer = $newService->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartService::dispatch($application); } catch (\Exception $e) { @@ -505,9 +508,10 @@ class CloneMe extends Component StopService::dispatch($database->service, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $database->service->destination->server; + $sourceServer = $database->service->destination->server; + $targetServer = $newService->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartService::dispatch($database->service); } catch (\Exception $e) { diff --git a/app/Livewire/Project/Shared/ResourceOperations.php b/app/Livewire/Project/Shared/ResourceOperations.php index 705a8b49a..e19f1272d 100644 --- a/app/Livewire/Project/Shared/ResourceOperations.php +++ b/app/Livewire/Project/Shared/ResourceOperations.php @@ -153,14 +153,15 @@ class ResourceOperations extends Component StopApplication::dispatch($this->resource, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $this->resource->destination->server; + $sourceServer = $this->resource->destination->server; + $targetServer = $new_resource->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); queue_application_deployment( deployment_uuid: (string) new Cuid2, application: $this->resource, - server: $server, + server: $sourceServer, destination: $this->resource->destination, no_questions_asked: true ); @@ -276,9 +277,10 @@ class ResourceOperations extends Component StopDatabase::dispatch($this->resource); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $this->resource->destination->server; + $sourceServer = $this->resource->destination->server; + $targetServer = $new_resource->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartDatabase::dispatch($this->resource); } catch (\Exception $e) { @@ -413,9 +415,10 @@ class ResourceOperations extends Component StopService::dispatch($application, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $application->service->destination->server; + $sourceServer = $application->service->destination->server; + $targetServer = $new_resource->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartService::dispatch($application); } catch (\Exception $e) { @@ -454,9 +457,10 @@ class ResourceOperations extends Component StopService::dispatch($database->service, false, false); $sourceVolume = $volume->name; $targetVolume = $newPersistentVolume->name; - $server = $database->service->destination->server; + $sourceServer = $database->service->destination->server; + $targetServer = $new_resource->destination->server; - VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $server, $newPersistentVolume); + VolumeCloneJob::dispatch($sourceVolume, $targetVolume, $sourceServer, $targetServer, $newPersistentVolume); StartService::dispatch($database->service); } catch (\Exception $e) {