fix: for rollback
This commit is contained in:
parent
bd4ce3ac45
commit
fba305020b
@ -51,44 +51,46 @@
|
|||||||
let rollbackVersion = localStorage.getItem('lastVersion');
|
let rollbackVersion = localStorage.getItem('lastVersion');
|
||||||
|
|
||||||
async function rollback() {
|
async function rollback() {
|
||||||
const sure = confirm(`Are you sure you want rollback Coolify to ${rollbackVersion}?`);
|
if (rollbackVersion) {
|
||||||
if (sure) {
|
const sure = confirm(`Are you sure you want rollback Coolify to ${rollbackVersion}?`);
|
||||||
try {
|
if (sure) {
|
||||||
if (dev) {
|
try {
|
||||||
console.log('rolling back to', rollbackVersion);
|
if (dev) {
|
||||||
await asyncSleep(4000);
|
console.log('rolling back to', rollbackVersion);
|
||||||
return window.location.reload();
|
|
||||||
} else {
|
|
||||||
await post(`/update`, { type: 'update', latestVersion: rollbackVersion });
|
|
||||||
addToast({
|
|
||||||
message: 'Update completed.<br><br>Waiting for the new version to start...',
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
|
|
||||||
let reachable = false;
|
|
||||||
let tries = 0;
|
|
||||||
do {
|
|
||||||
await asyncSleep(4000);
|
await asyncSleep(4000);
|
||||||
try {
|
return window.location.reload();
|
||||||
await get(`/undead`);
|
} else {
|
||||||
reachable = true;
|
await post(`/update`, { type: 'update', latestVersion: rollbackVersion });
|
||||||
} catch (error) {
|
addToast({
|
||||||
reachable = false;
|
message: 'Update completed.<br><br>Waiting for the new version to start...',
|
||||||
}
|
type: 'success'
|
||||||
if (reachable) break;
|
});
|
||||||
tries++;
|
|
||||||
} while (!reachable || tries < 120);
|
let reachable = false;
|
||||||
addToast({
|
let tries = 0;
|
||||||
message: 'New version reachable. Reloading...',
|
do {
|
||||||
type: 'success'
|
await asyncSleep(4000);
|
||||||
});
|
try {
|
||||||
await asyncSleep(3000);
|
await get(`/undead`);
|
||||||
return window.location.reload();
|
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
|
Rollback to a specific version
|
||||||
<Explainer
|
<Explainer
|
||||||
position="dropdown-bottom"
|
position="dropdown-bottom"
|
||||||
explanation="You can rollback to a specific version of your application. This will not affect your current running resources. <a href='https://github.com/coollabsio/coolify/releases' target='_blank'>See available versions</a>"
|
explanation="You can rollback to a specific version of Coolify. This will not affect your current running resources.<br><br><a href='https://github.com/coollabsio/coolify/releases' target='_blank'>See available versions</a>"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
@ -369,10 +371,12 @@
|
|||||||
bind:value={rollbackVersion}
|
bind:value={rollbackVersion}
|
||||||
readonly={!$appSession.isAdmin}
|
readonly={!$appSession.isAdmin}
|
||||||
disabled={!$appSession.isAdmin}
|
disabled={!$appSession.isAdmin}
|
||||||
name="lastVersion"
|
name="rollbackVersion"
|
||||||
id="lastVersion"
|
id="rollbackVersion"
|
||||||
/>
|
/>
|
||||||
<button class="btn btn-primary ml-2" on:click|preventDefault|stopPropagation={rollback}>Rollback</button>
|
<button class="btn btn-primary ml-2" disabled={!rollbackVersion} on:click|preventDefault|stopPropagation={rollback}
|
||||||
|
>Rollback</button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-2 items-center">
|
<div class="grid grid-cols-2 items-center">
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user