Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Feat: delete volume confirmation

ayntk-ai08df81440878
diff --git a/app/Livewire/Project/Shared/Storages/Show.php b/app/Livewire/Project/Shared/Storages/Show.php
index 08f51ce08f..d350df212f 100644
--- a/app/Livewire/Project/Shared/Storages/Show.php
+++ b/app/Livewire/Project/Shared/Storages/Show.php
@@ -3,6 +3,8 @@
namespace App\Livewire\Project\Shared\Storages;
use App\Models\LocalPersistentVolume;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class Show extends Component
@@ -36,8 +38,14 @@ class Show extends Component
$this->dispatch('success', 'Storage updated successfully');
}
- public function delete()
+ public function delete($password)
{
+ if (!Hash::check($password, Auth::user()->password)) {
+ $this->addError('password', 'The provided password is incorrect.');
+ return;
+ }
+
+ // Test deletion in more detail
$this->storage->delete();
$this->dispatch('refreshStorages');
}
diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php
index d6ee66ab75..2e43861ab8 100644
--- a/resources/views/livewire/project/shared/storages/show.blade.php
+++ b/resources/views/livewire/project/shared/storages/show.blade.php
@@ -46,13 +46,17 @@
<x-forms.button type="submit">
Update
</x-forms.button>
- <x-modal-confirmation isErrorButton buttonTitle="Delete">
- This storage will be deleted <span class="font-bold dark:text-warning">{{ $storage->name }}</span>.
- It
- is
- not
- reversible. <br>Please think again.
- </x-modal-confirmation>
+ <x-modal-confirmation
+ title="Confirm persistent storage deletion?"
+ isErrorButton
+ buttonTitle="Delete"
+ submitAction="delete"
+ :actions="['The selected persistent storage/volume will be permanently deleted.', 'If the persistent storage/volume is actvily used by a resource data will be lost.']"
+ confirmationText="{{ $storage->name }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Storage Name below"
+ shortConfirmationLabel="Storage Name"
+ step3ButtonText="Permanently Delete Persistent Storage/Volume"
+ />
</div>
@endif
</form>