From 8fd71ada45654e0bd00d689a4be6ad9a2b867023 Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Thu, 9 Oct 2025 16:06:53 +0200 Subject: [PATCH] frontend/software: nag 22.04 users to upgrade to 24.04 --- .../project/page/software-env-upgrade.tsx | 93 +++++++++++++++---- src/packages/util/compute-images.ts | 8 ++ 2 files changed, 81 insertions(+), 20 deletions(-) diff --git a/src/packages/frontend/project/page/software-env-upgrade.tsx b/src/packages/frontend/project/page/software-env-upgrade.tsx index 253ea251c2e..fb747233920 100644 --- a/src/packages/frontend/project/page/software-env-upgrade.tsx +++ b/src/packages/frontend/project/page/software-env-upgrade.tsx @@ -24,8 +24,11 @@ import { import { DISMISS_IMG_1804, DISMISS_IMG_2004, + DISMISS_IMG_2204, UBUNTU2004_DEPRECATED, UBUNTU2004_DEV, + UBUNTU2204, + UBUNTU2204_DEV, } from "@cocalc/util/compute-images"; import { FALLBACK_COMPUTE_IMAGE } from "@cocalc/util/db-schema/defaults"; import { KUCALC_COCALC_COM } from "@cocalc/util/db-schema/site-defaults"; @@ -41,10 +44,12 @@ const UPGRADE_STYLE: React.CSSProperties = { const DOC_UBUNTU_2004 = "https://doc.cocalc.com/news/ubuntu-2004.html"; const DOC_UBUNTU_2204 = "https://cocalc.com/news/ubuntu-22-04-default-software-environment-9"; +const DOC_UBUNTU_2404 = + "https://cocalc.com/news/ubuntu-24-04-based-environment-is-the-default-78"; const DOC_CHANGE_SOFTWARE_IMAGE = "https://doc.cocalc.com/project-settings.html#software-environment"; -// we only upgrade from not-frozen 18.04 and 20.04 images to the new default. +// we only upgrade from not-frozen 18.04, 20.04, and 22.04 images to the new default. // do not bother about any other names, including ubuntu1804 and old const TO_UPGRADE = [ FALLBACK_COMPUTE_IMAGE, @@ -52,6 +57,8 @@ const TO_UPGRADE = [ "exp", UBUNTU2004_DEPRECATED, UBUNTU2004_DEV, + UBUNTU2204, + UBUNTU2204_DEV, ] as const; function useComputeImage(project_id) { @@ -106,11 +113,13 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { return useMemo(() => { if (hide) return null; if (compute_image == null) return null; - if (TO_UPGRADE.indexOf(compute_image) == -1) return null; + if (!TO_UPGRADE.includes(compute_image)) return null; if (is_student_project) return null; - const only2204 = - [UBUNTU2004_DEPRECATED, UBUNTU2004_DEV].indexOf(compute_image) != -1; + const only2004 = [UBUNTU2004_DEPRECATED, UBUNTU2004_DEV].includes( + compute_image, + ); + const only2204 = [UBUNTU2204, UBUNTU2204_DEV].includes(compute_image); // just a safety measure, before accessing .title if (software_envs == null || default_compute_image == null) return null; @@ -120,6 +129,7 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { for (const key of [ compute_image, UBUNTU2004_DEPRECATED, + UBUNTU2204, default_compute_image, ]) { if (software_envs[key] == null) return null; @@ -127,9 +137,14 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { const oldname = software_envs[compute_image].title; const name2004 = software_envs[UBUNTU2004_DEPRECATED].title; - const name2204 = software_envs[default_compute_image].title; + const name2204 = software_envs[UBUNTU2204].title; + const name2404 = software_envs[default_compute_image].title; - const KEEP_IMAGE = only2204 ? DISMISS_IMG_2004 : DISMISS_IMG_1804; + const KEEP_IMAGE = only2204 + ? DISMISS_IMG_2204 + : only2004 + ? DISMISS_IMG_2004 + : DISMISS_IMG_1804; async function set_image(image: string) { set_updating(true); @@ -154,10 +169,10 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { onClick={() => set_image(default_compute_image)} bsStyle={"primary"} > - Upgrade + Upgrade to {name2404} ); - } else { + } else if (only2004) { return ( <> + + ); + } else { + return ( + <> + + + ); } @@ -191,13 +226,35 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { } } - function render_update_to_2004() { - if (only2204) return null; - return ( - <> - {name2004},{" "} - - ); + function render_upgrade_options() { + if (only2204) { + return ( + <> + + {name2404} + + + ); + } else if (only2004) { + return ( + <> + {name2004},{" "} + + {name2404} + + + ); + } else { + return ( + <> + {name2004},{" "} + {name2204}, or{" "} + + {name2404} + + + ); + } } function render_main(): React.JSX.Element { @@ -213,11 +270,7 @@ const SoftwareEnvUpgradeAlert: React.FC = (props: Props) => { Software Upgrade Available!{" "} Upgrade this project's software environment from {oldname} to{" "} - {render_update_to_2004()} - - {name2204} - - , or keep it as it is. + {render_upgrade_options()}, or keep it as it is.
You can change this any time in{" "} diff --git a/src/packages/util/compute-images.ts b/src/packages/util/compute-images.ts index 371c594f671..3834228bc7e 100644 --- a/src/packages/util/compute-images.ts +++ b/src/packages/util/compute-images.ts @@ -31,6 +31,7 @@ type Group = (typeof GROUPS)[number]; // names of old images, that won't trigger the "upgrade banner", pointing to the most recent end-of-life image of that series export const DISMISS_IMG_1804 = "ubuntu1804"; export const DISMISS_IMG_2004 = "ubuntu2004-eol"; +export const DISMISS_IMG_2204 = "ubuntu2204-eol"; // names of old images triggering the upgrade banner to 22.04 export const UBUNTU2004_DEPRECATED = "ubuntu2004"; export const UBUNTU2004_DEV = "ubuntu2004-dev"; @@ -77,6 +78,13 @@ const COMPUTE_IMAGES: { [key: string]: ComputeImageProd } = { "Ubuntu 22.04-based software stack, superseded by 24.04 in June 2025", group: "Main", }, + [DISMISS_IMG_2204]: { + order: 1, + title: "Ubuntu 22.04 (EndOfLife)", + short: "Ubuntu 22.04 (EndOfLife)", + descr: "Reached end of life in June 2025", + group: "Main", + }, [UBUNTU2404_DEV]: { title: "Ubuntu 24.04 (Testing)", short: "Ubuntu 24.04 (Testing)",