fix: move restart button to settings
This commit is contained in:
parent
ea594dcbc6
commit
20ce356296
@ -20,13 +20,12 @@
|
|||||||
let usageInterval: any;
|
let usageInterval: any;
|
||||||
let loading = {
|
let loading = {
|
||||||
usage: false,
|
usage: false,
|
||||||
cleanup: false,
|
cleanup: false
|
||||||
restart: false
|
|
||||||
};
|
};
|
||||||
import { addToast, appSession } from '$lib/store';
|
import { addToast, appSession } from '$lib/store';
|
||||||
import { onDestroy, onMount } from 'svelte';
|
import { onDestroy, onMount } from 'svelte';
|
||||||
import { get, post } from '$lib/api';
|
import { get, post } from '$lib/api';
|
||||||
import { asyncSleep, errorNotification } from '$lib/common';
|
import { errorNotification } from '$lib/common';
|
||||||
async function getStatus() {
|
async function getStatus() {
|
||||||
if (loading.usage) return;
|
if (loading.usage) return;
|
||||||
loading.usage = true;
|
loading.usage = true;
|
||||||
@ -34,45 +33,7 @@
|
|||||||
usage = data.usage;
|
usage = data.usage;
|
||||||
loading.usage = false;
|
loading.usage = false;
|
||||||
}
|
}
|
||||||
async function restartCoolify() {
|
|
||||||
const sure = confirm(
|
|
||||||
'Are you sure you would like to restart Coolify? Currently running deployments will be stopped and restarted.'
|
|
||||||
);
|
|
||||||
if (sure) {
|
|
||||||
loading.restart = true;
|
|
||||||
try {
|
|
||||||
await post(`/internal/restart`, {});
|
|
||||||
await asyncSleep(10000);
|
|
||||||
let reachable = false;
|
|
||||||
let tries = 0;
|
|
||||||
do {
|
|
||||||
await asyncSleep(4000);
|
|
||||||
try {
|
|
||||||
await get(`/undead`);
|
|
||||||
reachable = true;
|
|
||||||
} catch (error) {
|
|
||||||
reachable = false;
|
|
||||||
}
|
|
||||||
if (reachable) break;
|
|
||||||
tries++;
|
|
||||||
} while (!reachable || tries < 120);
|
|
||||||
addToast({
|
|
||||||
message: 'New version reachable. Reloading...',
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
await asyncSleep(3000);
|
|
||||||
return window.location.reload();
|
|
||||||
addToast({
|
|
||||||
type: 'success',
|
|
||||||
message: 'Coolify restarted successfully. It will take a moment.'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
return errorNotification(error);
|
|
||||||
} finally {
|
|
||||||
loading.restart = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
clearInterval(usageInterval);
|
clearInterval(usageInterval);
|
||||||
});
|
});
|
||||||
@ -112,11 +73,6 @@
|
|||||||
<button on:click={manuallyCleanupStorage} class:loading={loading.cleanup} class="btn btn-sm"
|
<button on:click={manuallyCleanupStorage} class:loading={loading.cleanup} class="btn btn-sm"
|
||||||
>Cleanup Storage</button
|
>Cleanup Storage</button
|
||||||
>
|
>
|
||||||
<button
|
|
||||||
on:click={restartCoolify}
|
|
||||||
class:loading={loading.restart}
|
|
||||||
class="btn btn-sm bg-red-600 hover:bg-red-500">Restart Coolify</button
|
|
||||||
>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
import { browser } from '$app/env';
|
import { browser } from '$app/env';
|
||||||
import { t } from '$lib/translations';
|
import { t } from '$lib/translations';
|
||||||
import { addToast, appSession, features } from '$lib/store';
|
import { addToast, appSession, features } from '$lib/store';
|
||||||
import { errorNotification, getDomain } from '$lib/common';
|
import { asyncSleep, errorNotification, getDomain } from '$lib/common';
|
||||||
import Menu from './_Menu.svelte';
|
import Menu from './_Menu.svelte';
|
||||||
import Explainer from '$lib/components/Explainer.svelte';
|
import Explainer from '$lib/components/Explainer.svelte';
|
||||||
|
|
||||||
@ -45,7 +45,8 @@
|
|||||||
let loading = {
|
let loading = {
|
||||||
save: false,
|
save: false,
|
||||||
remove: false,
|
remove: false,
|
||||||
proxyMigration: false
|
proxyMigration: false,
|
||||||
|
restart: false
|
||||||
};
|
};
|
||||||
|
|
||||||
async function removeFqdn() {
|
async function removeFqdn() {
|
||||||
@ -156,6 +157,41 @@
|
|||||||
function resetView() {
|
function resetView() {
|
||||||
forceSave = false;
|
forceSave = false;
|
||||||
}
|
}
|
||||||
|
async function restartCoolify() {
|
||||||
|
const sure = confirm(
|
||||||
|
'Are you sure you would like to restart Coolify? Currently running deployments will be stopped and restarted.'
|
||||||
|
);
|
||||||
|
if (sure) {
|
||||||
|
loading.restart = true;
|
||||||
|
try {
|
||||||
|
await post(`/internal/restart`, {});
|
||||||
|
await asyncSleep(10000);
|
||||||
|
let reachable = false;
|
||||||
|
let tries = 0;
|
||||||
|
do {
|
||||||
|
await asyncSleep(4000);
|
||||||
|
try {
|
||||||
|
await get(`/undead`);
|
||||||
|
reachable = true;
|
||||||
|
} catch (error) {
|
||||||
|
reachable = false;
|
||||||
|
}
|
||||||
|
if (reachable) break;
|
||||||
|
tries++;
|
||||||
|
} while (!reachable || tries < 120);
|
||||||
|
addToast({
|
||||||
|
message: 'New version reachable. Reloading...',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
await asyncSleep(3000);
|
||||||
|
return window.location.reload();
|
||||||
|
} catch (error) {
|
||||||
|
return errorNotification(error);
|
||||||
|
} finally {
|
||||||
|
loading.restart = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex space-x-1 p-6 font-bold">
|
<div class="flex space-x-1 p-6 font-bold">
|
||||||
@ -186,11 +222,14 @@
|
|||||||
on:click|preventDefault={removeFqdn}
|
on:click|preventDefault={removeFqdn}
|
||||||
disabled={loading.remove}
|
disabled={loading.remove}
|
||||||
class="btn btn-sm"
|
class="btn btn-sm"
|
||||||
class:bg-red-600={!loading.remove}
|
|
||||||
class:hover:bg-red-500={!loading.remove}
|
|
||||||
>{loading.remove ? $t('forms.removing') : $t('forms.remove_domain')}</button
|
>{loading.remove ? $t('forms.removing') : $t('forms.remove_domain')}</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
|
<button
|
||||||
|
on:click={restartCoolify}
|
||||||
|
class:loading={loading.restart}
|
||||||
|
class="btn btn-sm bg-red-600 hover:bg-red-500">Restart Coolify</button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-flow-row gap-2 px-10">
|
<div class="grid grid-flow-row gap-2 px-10">
|
||||||
<!-- <Language /> -->
|
<!-- <Language /> -->
|
||||||
@ -319,7 +358,7 @@
|
|||||||
id="isAPIDebuggingEnabled"
|
id="isAPIDebuggingEnabled"
|
||||||
bind:setting={isAPIDebuggingEnabled}
|
bind:setting={isAPIDebuggingEnabled}
|
||||||
title="API Debugging"
|
title="API Debugging"
|
||||||
description="Enable API debugging. This will log all API requests and responses.<br><br>You need to restart the Coolify (button on dashboard) for this to take effect."
|
description="Enable API debugging. This will log all API requests and responses.<br><br>You need to restart the Coolify for this to take effect."
|
||||||
on:click={() => changeSettings('isAPIDebuggingEnabled')}
|
on:click={() => changeSettings('isAPIDebuggingEnabled')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user