lasthourcloud/resources/views/components/layout.blade.php

108 lines
3.8 KiB
PHP
Raw Normal View History

2023-03-20 12:04:22 +00:00
<!DOCTYPE html>
2023-05-17 13:46:20 +00:00
<html data-theme="coollabs" lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full bg-coolgray-100">
2023-03-20 12:04:22 +00:00
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
2023-05-12 13:39:07 +00:00
<link rel="preconnect" href="https://api.fonts.coollabs.io" crossorigin>
<link href="https://api.fonts.coollabs.io/css2?family=Inter&display=swap" rel="stylesheet">
2023-05-04 06:33:06 +00:00
@env('local')
<title>Coolify - localhost</title>
2023-05-17 07:08:32 +00:00
<link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" />
2023-05-04 06:33:06 +00:00
@endenv
@env('production')
2023-05-17 07:08:32 +00:00
<link rel="icon" href="{{ asset('favicon.png') }}" type="image/x-icon" />
2023-03-20 12:04:22 +00:00
<title>{{ $title ?? 'Coolify' }}</title>
2023-05-04 06:33:06 +00:00
@endenv
2023-03-20 12:04:22 +00:00
<meta name="csrf-token" content="{{ csrf_token() }}">
@vite(['resources/js/app.js', 'resources/css/app.css'])
2023-04-25 08:06:45 +00:00
<style>
[x-cloak] {
display: none !important;
}
</style>
2023-03-20 12:04:22 +00:00
@livewireStyles
</head>
2023-05-16 18:47:59 +00:00
<body class="antialiased">
2023-05-16 07:05:38 +00:00
2023-05-08 19:56:44 +00:00
@livewireScripts
2023-04-27 09:29:02 +00:00
@auth
<x-navbar />
@endauth
2023-05-17 10:00:28 +00:00
<main class="max-w-6xl px-8 pt-10 mx-auto">
2023-03-20 12:04:22 +00:00
{{ $slot }}
</main>
2023-05-16 07:05:38 +00:00
<a
class="fixed text-xs cursor-pointer left-2 bottom-1 opacity-20 hover:opacity-100 hover:text-white">v{{ config('version') }}</a>
2023-04-28 09:54:01 +00:00
@auth
<script>
2023-05-12 09:17:56 +00:00
window.addEventListener("keydown", function(event) {
if (event.target.nodeName === 'BODY') {
if (event.key === '/') {
event.preventDefault();
window.dispatchEvent(new CustomEvent('slash'));
}
}
})
2023-04-28 13:08:48 +00:00
function checkIfIamDead() {
2023-04-28 13:37:09 +00:00
console.log('Checking server\'s pulse...')
2023-04-28 13:08:48 +00:00
checkIfIamDeadInterval = setInterval(async () => {
2023-04-28 13:37:09 +00:00
try {
const res = await fetch('/api/health');
if (res.ok) {
console.log('I\'m alive. Waiting for server to be dead...');
}
} catch (error) {
2023-04-28 13:08:48 +00:00
console.log('I\'m dead. Charging... Standby... Bzz... Bzz...')
checkHealth();
if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
}
return;
}, 2000);
}
function checkHealth() {
2023-04-28 13:37:09 +00:00
console.log('Checking server\'s health...')
2023-04-28 13:08:48 +00:00
checkHealthInterval = setInterval(async () => {
2023-04-28 13:37:09 +00:00
try {
const res = await fetch('/api/health');
if (res.ok) {
console.log('Server is back online. Reloading...')
if (checkHealthInterval) clearInterval(checkHealthInterval);
window.location.reload();
}
} catch (error) {
2023-04-28 13:08:48 +00:00
console.log('Waiting for server to come back from dead...');
2023-04-28 09:54:01 +00:00
}
2023-04-28 13:37:09 +00:00
2023-04-28 09:54:01 +00:00
return;
}, 2000);
2023-04-28 13:08:48 +00:00
}
Livewire.on('updateInitiated', () => {
let checkHealthInterval = null;
let checkIfIamDeadInterval = null;
console.log('Update initiated. Waiting for server to be dead...')
checkIfIamDead();
2023-04-28 09:54:01 +00:00
})
2023-05-04 13:45:53 +00:00
Livewire.on('reloadWindow', () => {
window.location.reload();
})
2023-05-04 20:29:14 +00:00
Livewire.on('error', (message) => {
2023-05-08 11:36:49 +00:00
console.log(message);
2023-05-10 09:02:59 +00:00
alert(message);
2023-05-04 20:29:14 +00:00
})
2023-05-09 07:54:43 +00:00
Livewire.on('saved', (message) => {
if (message) console.log(message);
else console.log('saved');
})
2023-04-28 09:54:01 +00:00
</script>
@endauth
2023-05-08 19:56:44 +00:00
2023-03-20 12:04:22 +00:00
</body>
</html>