diff --git a/apps/ui/src/routes/settings/coolify.svelte b/apps/ui/src/routes/settings/coolify.svelte index 2c421751b..857a4aa63 100644 --- a/apps/ui/src/routes/settings/coolify.svelte +++ b/apps/ui/src/routes/settings/coolify.svelte @@ -51,44 +51,46 @@ let rollbackVersion = localStorage.getItem('lastVersion'); async function rollback() { - const sure = confirm(`Are you sure you want rollback Coolify to ${rollbackVersion}?`); - if (sure) { - try { - if (dev) { - console.log('rolling back to', rollbackVersion); - await asyncSleep(4000); - return window.location.reload(); - } else { - await post(`/update`, { type: 'update', latestVersion: rollbackVersion }); - addToast({ - message: 'Update completed.

Waiting for the new version to start...', - type: 'success' - }); - - let reachable = false; - let tries = 0; - do { + if (rollbackVersion) { + const sure = confirm(`Are you sure you want rollback Coolify to ${rollbackVersion}?`); + if (sure) { + try { + if (dev) { + console.log('rolling back to', rollbackVersion); 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(); + return window.location.reload(); + } else { + await post(`/update`, { type: 'update', latestVersion: rollbackVersion }); + addToast({ + message: 'Update completed.

Waiting for the new version to start...', + type: 'success' + }); + + 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.remove = false; } - } catch (error) { - return errorNotification(error); - } finally { - loading.remove = false; } } } @@ -361,7 +363,7 @@ Rollback to a specific version - +