diff --git a/app/Actions/Application/StopApplication.php b/app/Actions/Application/StopApplication.php index 5f5846f55..3ed435049 100644 --- a/app/Actions/Application/StopApplication.php +++ b/app/Actions/Application/StopApplication.php @@ -10,7 +10,7 @@ class StopApplication { use AsAction; - public function handle(Application $application, bool $previewDeployments = false) + public function handle(Application $application, bool $previewDeployments = false, bool $dockerCleanup = true) { try { $server = $application->destination->server; @@ -29,6 +29,9 @@ class StopApplication if ($application->build_pack === 'dockercompose') { $application->delete_connected_networks($application->uuid); + } + + if ($dockerCleanup) { CleanupDocker::run($server, true); } } catch (\Exception $e) { diff --git a/app/Livewire/Project/Application/Heading.php b/app/Livewire/Project/Application/Heading.php index c02949e17..4677ff7a2 100644 --- a/app/Livewire/Project/Application/Heading.php +++ b/app/Livewire/Project/Application/Heading.php @@ -21,6 +21,8 @@ class Heading extends Component protected string $deploymentUuid; + public bool $docker_cleanup = true; + public function getListeners() { $teamId = auth()->user()->currentTeam()->id; @@ -102,7 +104,7 @@ class Heading extends Component public function stop() { - StopApplication::run($this->application); + StopApplication::run($this->application, false, $this->docker_cleanup); $this->application->status = 'exited'; $this->application->save(); if ($this->application->additional_servers->count() > 0) { @@ -135,4 +137,13 @@ class Heading extends Component 'environment_name' => $this->parameters['environment_name'], ]); } + + public function render() + { + return view('livewire.project.application.heading', [ + 'checkboxes' => [ + ['id' => 'docker_cleanup', 'label' => 'Docker cleanup will be run on the server which removes builder cache and unused images (the next deployment will take longer as the images have to be pulled again)'], + ] + ]); + } } diff --git a/resources/views/livewire/project/application/heading.blade.php b/resources/views/livewire/project/application/heading.blade.php index 2704cc1f4..a49860371 100644 --- a/resources/views/livewire/project/application/heading.blade.php +++ b/resources/views/livewire/project/application/heading.blade.php @@ -72,7 +72,19 @@ @endif @endif - + Stop - This application will be stopped.
Please think again.
@else diff --git a/resources/views/livewire/project/service/navbar.blade.php b/resources/views/livewire/project/service/navbar.blade.php index 09f218c84..d2ba2e385 100644 --- a/resources/views/livewire/project/service/navbar.blade.php +++ b/resources/views/livewire/project/service/navbar.blade.php @@ -34,6 +34,7 @@ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']" :confirmWithText="false" :confirmWithPassword="false" + step1ButtonText="Continue Stopping Service" step2ButtonText="Stop Service" :dispatchEvent="true" dispatchEventType="stopEvent" @@ -67,6 +68,7 @@ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']" :confirmWithText="false" :confirmWithPassword="false" + step1ButtonText="Continue Stopping Service" step2ButtonText="Stop Service" :dispatchEvent="true" dispatchEventType="stopEvent" @@ -106,6 +108,7 @@ :actions="['This service will be stopped.', 'If the service is currently in use data could be lost.', 'All non-persistent data of this service (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the service again).']" :confirmWithText="false" :confirmWithPassword="false" + step1ButtonText="Continue Stopping Service" step2ButtonText="Stop Service" :dispatchEvent="true" dispatchEventType="stopEvent"