2024-02-22 11:31:13 +01:00
|
|
|
From 98fcec984025deeb3a93cdd1618e3d47abb0d0cd Mon Sep 17 00:00:00 2001
|
2023-12-23 20:20:04 +01:00
|
|
|
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
|
|
|
|
Date: Wed, 22 Nov 2023 23:16:13 +0000
|
2024-02-22 11:31:13 +01:00
|
|
|
Subject: [PATCH 5/6] Remove Canonical image servers
|
2023-12-23 20:20:04 +01:00
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
|
|
|
|
---
|
2024-02-22 11:31:13 +01:00
|
|
|
src/pages/images/ImageSelector.tsx | 34 +++++++++---------------------
|
|
|
|
1 file changed, 10 insertions(+), 24 deletions(-)
|
2023-12-23 20:20:04 +01:00
|
|
|
|
|
|
|
diff --git a/src/pages/images/ImageSelector.tsx b/src/pages/images/ImageSelector.tsx
|
2024-02-22 11:31:13 +01:00
|
|
|
index f026ec3..91333be 100644
|
2023-12-23 20:20:04 +01:00
|
|
|
--- a/src/pages/images/ImageSelector.tsx
|
|
|
|
+++ b/src/pages/images/ImageSelector.tsx
|
2024-02-22 11:31:13 +01:00
|
|
|
@@ -33,13 +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 linuxContainersJson =
|
|
|
|
+ "https://images.linuxcontainers.org/streams/v1/images.json";
|
|
|
|
+const linuxContainersServer = "https://images.linuxcontainers.org";
|
|
|
|
|
|
|
|
const ANY = "any";
|
|
|
|
const CONTAINER = "container";
|
|
|
|
@@ -72,14 +68,9 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
|
|
|
|
|
|
|
|
const { data: settings, isLoading: isSettingsLoading } = useSettings();
|
2023-12-23 20:20:04 +01:00
|
|
|
|
|
|
|
- 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),
|
2024-02-22 11:31:13 +01:00
|
|
|
+ const { data: linuxContainerImages = [], isLoading: isLciLoading } = useQuery({
|
|
|
|
+ queryKey: [queryKeys.images, linuxContainersServer],
|
|
|
|
+ queryFn: () => loadImages(linuxContainersJson, linuxContainersServer),
|
|
|
|
});
|
|
|
|
|
2023-12-23 20:20:04 +01:00
|
|
|
const { data: localImages = [], isLoading: isLocalImageLoading } = useQuery({
|
2024-02-22 11:31:13 +01:00
|
|
|
@@ -87,8 +78,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
|
2023-12-23 20:20:04 +01:00
|
|
|
queryFn: () => fetchImageList(project ?? ""),
|
|
|
|
});
|
|
|
|
|
2024-02-22 11:31:13 +01:00
|
|
|
- const isLoading =
|
|
|
|
- isCiLoading || isMinimalLoading || isLocalImageLoading || isSettingsLoading;
|
|
|
|
+ const isLoading = isLciLoading || isLocalImageLoading || isSettingsLoading;
|
2023-12-23 20:20:04 +01:00
|
|
|
const archSupported = getArchitectureAliases(
|
2024-02-22 11:31:13 +01:00
|
|
|
settings?.environment?.architectures ?? [],
|
|
|
|
);
|
|
|
|
@@ -97,8 +87,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
|
2023-12-23 20:20:04 +01:00
|
|
|
: localImages
|
|
|
|
.filter((image) => !image.cached)
|
|
|
|
.map(localLxdToRemoteImage)
|
|
|
|
- .concat([...minimalImages].reverse().sort(byLtsFirst))
|
|
|
|
- .concat([...canonicalImages].reverse().sort(byLtsFirst))
|
2024-02-22 11:31:13 +01:00
|
|
|
+ .concat(linuxContainerImages)
|
2023-12-23 20:20:04 +01:00
|
|
|
.filter((image) => archSupported.includes(image.arch));
|
|
|
|
|
2024-02-22 11:31:13 +01:00
|
|
|
const archAll = [...new Set(images.map((item) => item.arch))]
|
|
|
|
@@ -199,11 +188,8 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
|
|
|
|
if (item.created_at) {
|
|
|
|
return "Local";
|
|
|
|
}
|
|
|
|
- if (item.server === canonicalServer) {
|
|
|
|
- return "Ubuntu";
|
|
|
|
- }
|
|
|
|
- if (item.server === minimalServer) {
|
|
|
|
- return "Ubuntu Minimal";
|
|
|
|
+ if (item.server === linuxContainersServer) {
|
|
|
|
+ return "Linux Containers";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-12-23 20:20:04 +01:00
|
|
|
--
|
2024-02-22 11:31:13 +01:00
|
|
|
2.34.1
|
2023-12-23 20:20:04 +01:00
|
|
|
|