feat: add browser event dispatch for page refresh after drive detachment
This commit is contained in:
@@ -803,6 +803,9 @@ class Storage extends Component
|
|||||||
$this->notify("Drive {$driveKey} detached successfully.", 'success');
|
$this->notify("Drive {$driveKey} detached successfully.", 'success');
|
||||||
$this->closeDetachModal();
|
$this->closeDetachModal();
|
||||||
$this->loadStorageConfiguration(false);
|
$this->loadStorageConfiguration(false);
|
||||||
|
|
||||||
|
// Dispatch browser event to refresh the page
|
||||||
|
$this->dispatch('refresh-page');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->notify('Failed to detach drive: ' . $e->getMessage(), 'error');
|
$this->notify('Failed to detach drive: ' . $e->getMessage(), 'error');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -864,4 +864,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('livewire:initialized', () => {
|
||||||
|
Livewire.on('refresh-page', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</x-proxmox::layout>
|
</x-proxmox::layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user