notifications: rename alert to pin and unpin

This commit is contained in:
Girish Ramakrishnan
2024-12-11 15:47:41 +01:00
parent ead419003b
commit 746e694d7e
7 changed files with 112 additions and 71 deletions

View File

@@ -198,9 +198,9 @@ async function checkDiskSpace() {
if (markdownMessage) {
const finalMessage = `One or more file systems are running out of space. Please increase the disk size at the earliest.\n\n${markdownMessage}`;
await notifications.alert(notifications.TYPE_DISK_SPACE, 'Server is running out of disk space', finalMessage, { persist: true });
await notifications.pin(notifications.TYPE_DISK_SPACE, 'Server is running out of disk space', finalMessage, {});
} else {
await notifications.clearAlert(notifications.TYPE_DISK_SPACE, 'Server is running out of disk space');
await notifications.unpin(notifications.TYPE_DISK_SPACE);
}
}
@@ -275,7 +275,7 @@ async function updateDiskUsage(progressCallback) {
}
async function reboot() {
await notifications.clearAlert(notifications.TYPE_REBOOT, 'Reboot Required');
await notifications.unpin(notifications.TYPE_REBOOT, {});
const [error] = await safe(shell.promises.sudo([ REBOOT_CMD ], {}));
if (error) debug('reboot: could not reboot. %o', error);
@@ -349,9 +349,9 @@ async function getBlockDevices() {
async function checkRebootRequired() {
const { rebootRequired } = await getInfo();
if (rebootRequired) {
await notifications.alert(notifications.TYPE_REBOOT, 'Reboot Required', 'To finish ubuntu security updates, a reboot is necessary.', { persist: true });
await notifications.pin(notifications.TYPE_REBOOT, 'Reboot Required', 'To finish ubuntu security updates, a reboot is necessary.', {});
} else {
await notifications.clearAlert(notifications.TYPE_REBOOT, 'Reboot Required');
await notifications.unpin(notifications.TYPE_REBOOT, {});
}
}
@@ -365,7 +365,7 @@ async function checkUbuntuVersion() {
const isBionic = fs.readFileSync('/etc/lsb-release', 'utf-8').includes('18.04');
if (!isBionic) return;
await notifications.alert(notifications.TYPE_UPDATE_UBUNTU, 'Ubuntu upgrade required', 'Ubuntu 18.04 has reached end of life and will not receive security and maintenance updates. Please follow https://docs.cloudron.io/guides/upgrade-ubuntu-20/ to upgrade to Ubuntu 20 at the earliest.', { persist: true });
await notifications.pin(notifications.TYPE_UPDATE_UBUNTU, 'Ubuntu upgrade required', 'Ubuntu 18.04 has reached end of life and will not receive security and maintenance updates. Please follow https://docs.cloudron.io/guides/upgrade-ubuntu-20/ to upgrade to Ubuntu 20 at the earliest.', {});
}
async function runSystemChecks() {