From e36304b2f02f3bb6bb9bc80482afc9b36df2d3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 22 Nov 2023 23:16:13 +0000 Subject: [PATCH 5/8] Remove Canonical image servers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- src/pages/images/ImageSelector.tsx | 51 ++++++------------------------ 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/src/pages/images/ImageSelector.tsx b/src/pages/images/ImageSelector.tsx index ca10169..2123eb4 100644 --- a/src/pages/images/ImageSelector.tsx +++ b/src/pages/images/ImageSelector.tsx @@ -33,16 +33,9 @@ interface Props { onClose: () => void; } -const canonicalJson = - "https://cloud-images.ubuntu.com/releases/streams/v1/com.ubuntu.cloud:released:download.json"; -const canonicalServer = "https://cloud-images.ubuntu.com/releases"; - -const minimalJson = - "https://cloud-images.ubuntu.com/minimal/releases/streams/v1/com.ubuntu.cloud:released:download.json"; -const minimalServer = "https://cloud-images.ubuntu.com/minimal/releases/"; - -const imagesLxdJson = "https://images.lxd.canonical.com/streams/v1/images.json"; -const imagesLxdServer = "https://images.lxd.canonical.com/"; +const linuxContainersJson = + "https://images.linuxcontainers.org/streams/v1/images.json"; +const linuxContainersServer = "https://images.linuxcontainers.org"; const ANY = "any"; const CONTAINER = "container"; @@ -75,33 +68,17 @@ const ImageSelector: FC = ({ onSelect, onClose }) => { const { data: settings, isLoading: isSettingsLoading } = useSettings(); - const { data: canonicalImages = [], isLoading: isCiLoading } = useQuery({ - queryKey: [queryKeys.images, canonicalServer], - queryFn: () => loadImages(canonicalJson, canonicalServer), - }); - - const { data: minimalImages = [], isLoading: isMinimalLoading } = useQuery({ - queryKey: [queryKeys.images, minimalServer], - queryFn: () => loadImages(minimalJson, minimalServer), + const { data: linuxContainerImages = [], isLoading: isLciLoading } = useQuery({ + queryKey: [queryKeys.images, linuxContainersServer], + queryFn: () => loadImages(linuxContainersJson, linuxContainersServer), }); - const { data: imagesLxdImages = [], isLoading: isImagesLxdLoading } = - useQuery({ - queryKey: [queryKeys.images, imagesLxdServer], - queryFn: () => loadImages(imagesLxdJson, imagesLxdServer), - }); - const { data: localImages = [], isLoading: isLocalImageLoading } = useQuery({ queryKey: [queryKeys.images, project], queryFn: () => fetchImageList(project ?? ""), }); - const isLoading = - isCiLoading || - isMinimalLoading || - isImagesLxdLoading || - isLocalImageLoading || - isSettingsLoading; + const isLoading = isLciLoading || isLocalImageLoading || isSettingsLoading; const archSupported = getArchitectureAliases( settings?.environment?.architectures ?? [], ); @@ -110,9 +87,7 @@ const ImageSelector: FC = ({ onSelect, onClose }) => { : localImages .filter((image) => !image.cached) .map(localLxdToRemoteImage) - .concat([...canonicalImages].reverse().sort(byLtsFirst)) - .concat([...minimalImages].reverse().sort(byLtsFirst)) - .concat([...imagesLxdImages]) + .concat(linuxContainerImages) .filter((image) => archSupported.includes(image.arch)); const archAll = [...new Set(images.map((item) => item.arch))] @@ -213,14 +188,8 @@ const ImageSelector: FC = ({ onSelect, onClose }) => { if (item.created_at) { return "Local"; } - if (item.server === canonicalServer) { - return "Ubuntu"; - } - if (item.server === minimalServer) { - return "Ubuntu Minimal"; - } - if (item.server === imagesLxdServer) { - return "LXD Images"; + if (item.server === linuxContainersServer) { + return "Linux Containers"; } return "Custom"; }; -- 2.34.1