This commit is contained in:
Andras Bacsai
2023-04-28 11:54:01 +02:00
parent 2fb8d928e5
commit 321087cb6d
4 changed files with 31 additions and 9 deletions

View File

@@ -25,6 +25,25 @@
<x-confirm-modal />
@livewireScripts
@auth
<script>
Livewire.on('updateInitiated', () => {
let checkStatus = null;
console.log('Update initiated')
setInterval(async () => {
const res = await fetch('/api/health');
if (res.ok) {
console.log('Server is back online')
clearInterval(checkStatus);
window.location.reload();
} else {
console.log('Waiting for server to come back online...');
}
return;
}, 2000);
})
</script>
@endauth
</body>
</html>

View File

@@ -3,14 +3,12 @@
<div wire:loading wire:target="checkUpdate">
Checking for updates...
</div>
@env('production')
@if (auth()->user()->teams->contains(0))
<button wire:click='forceUpgrade'>Force Upgrade</button>
<div wire:loading wire:target="forceUpgrade">
Updating Coolify...
</div>
@endif
@endenv
@if ($updateAvailable)
Update available
@endif