fix: channels

feat: database backup is realtime now
This commit is contained in:
Andras Bacsai
2023-12-11 10:23:10 +01:00
parent 63dff5961e
commit 3ffd3fc819
15 changed files with 81 additions and 26 deletions

View File

@@ -22,9 +22,9 @@
if (window.Echo) {
if (window.Echo.connector.pusher.connection.state !== 'connected') {
checkNumber++;
if (checkNumber > 5) {
if (checkNumber > 2) {
clearInterval(checkPusherInterval);
Livewire.emit('error', errorMessage);
window.Livewire.dispatch('error', errorMessage);
}
} else {
console.log('Coolify is now connected to the new realtime service introduced in beta.154.');
@@ -32,7 +32,7 @@
}
} else {
clearInterval(checkPusherInterval);
Livewire.emit('error', errorMessage);
window.Livewire.dispatch('error', errorMessage);
}
}, 2000);
}

View File

@@ -121,7 +121,7 @@
}
function copyToClipboard(text) {
navigator?.clipboard?.writeText(text) && window.Livewire.emit('success', 'Copied to clipboard.');
navigator?.clipboard?.writeText(text) && window.Livewire.dispatch('success', 'Copied to clipboard.');
}
document.addEventListener('livewire:init', () => {
window.Livewire.on('reloadWindow', (timeout) => {

View File

@@ -1,10 +1,15 @@
<div class="flex flex-col-reverse gap-2">
@forelse($executions as $execution)
<form wire:key="{{ data_get($execution, 'id') }}" class="flex flex-col p-2 border-dotted border-1 bg-coolgray-300"
<form wire:key="{{ data_get($execution, 'id') }}" class="relative flex flex-col p-4 border-dotted border-1 bg-coolgray-100"
@class([
'border-green-500' => data_get($execution, 'status') === 'success',
'border-red-500' => data_get($execution, 'status') === 'failed',
])>
@if (data_get($execution, 'status') === 'running')
<div class="absolute top-2 right-2">
<x-loading />
</div>
@endif
<div>Database: {{ data_get($execution, 'database_name', 'N/A') }}</div>
<div>Status: {{ data_get($execution, 'status') }}</div>
<div>Started At: {{ data_get($execution, 'created_at') }}</div>
@@ -21,18 +26,11 @@
<x-forms.button class=" hover:bg-coolgray-400"
wire:click="download({{ data_get($execution, 'id') }})">Download</x-forms.button>
@endif
<x-forms.button isError onclick="sure({{ data_get($execution, 'id') }})">Delete</x-forms.button>
<x-forms.button isError wire:click="deleteBackup({{ data_get($execution, 'id') }})"
wire:confirm.prompt="Are you sure?\n\nType DELETE to confirm|DELETE">Delete</x-forms.button>
</div>
</form>
@empty
<div>No executions found.</div>
@endforelse
<script>
function sure($id) {
const sure = confirm('Are you sure you want to delete this backup?');
if (sure) {
Livewire.emit('deleteBackup', $id);
}
}
</script>
</div>

View File

@@ -45,11 +45,11 @@
@endif
<script>
function checkProxy() {
Livewire.emit('checkProxy')
window.Livewire.dispatch('checkProxy')
}
Livewire.on('proxyChecked', () => {
startProxy.showModal();
Livewire.emit('startProxy');
window.Livewire.dispatch('startProxy');
})
</script>
</div>