nixos-config/pkgs/incus-ui/ui-canonical-0005-Remove-Canonical-image-servers.patch

107 lines
4 KiB
Diff
Raw Normal View History

2024-04-26 12:19:50 +02:00
From e36304b2f02f3bb6bb9bc80482afc9b36df2d3c1 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-04-26 12:19:50 +02:00
Subject: [PATCH 5/8] 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-04-26 12:19:50 +02:00
src/pages/images/ImageSelector.tsx | 51 ++++++------------------------
1 file changed, 10 insertions(+), 41 deletions(-)
2023-12-23 20:20:04 +01:00
diff --git a/src/pages/images/ImageSelector.tsx b/src/pages/images/ImageSelector.tsx
2024-04-26 12:19:50 +02:00
index ca10169..2123eb4 100644
2023-12-23 20:20:04 +01:00
--- a/src/pages/images/ImageSelector.tsx
+++ b/src/pages/images/ImageSelector.tsx
2024-04-26 12:19:50 +02:00
@@ -33,16 +33,9 @@ interface Props {
2024-02-22 11:31:13 +01:00
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/";
2024-04-26 12:19:50 +02:00
-
-const imagesLxdJson = "https://images.lxd.canonical.com/streams/v1/images.json";
-const imagesLxdServer = "https://images.lxd.canonical.com/";
2024-02-22 11:31:13 +01:00
+const linuxContainersJson =
+ "https://images.linuxcontainers.org/streams/v1/images.json";
+const linuxContainersServer = "https://images.linuxcontainers.org";
const ANY = "any";
const CONTAINER = "container";
2024-04-26 12:19:50 +02:00
@@ -75,33 +68,17 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
2024-02-22 11:31:13 +01:00
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),
});
2024-04-26 12:19:50 +02:00
- const { data: imagesLxdImages = [], isLoading: isImagesLxdLoading } =
- useQuery({
- queryKey: [queryKeys.images, imagesLxdServer],
- queryFn: () => loadImages(imagesLxdJson, imagesLxdServer),
- });
-
2023-12-23 20:20:04 +01:00
const { data: localImages = [], isLoading: isLocalImageLoading } = useQuery({
2024-04-26 12:19:50 +02:00
queryKey: [queryKeys.images, project],
2023-12-23 20:20:04 +01:00
queryFn: () => fetchImageList(project ?? ""),
});
2024-02-22 11:31:13 +01:00
- const isLoading =
2024-04-26 12:19:50 +02:00
- isCiLoading ||
- isMinimalLoading ||
- isImagesLxdLoading ||
- isLocalImageLoading ||
- isSettingsLoading;
2024-02-22 11:31:13 +01:00
+ 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 ?? [],
);
2024-04-26 12:19:50 +02:00
@@ -110,9 +87,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
2023-12-23 20:20:04 +01:00
: localImages
.filter((image) => !image.cached)
.map(localLxdToRemoteImage)
- .concat([...canonicalImages].reverse().sort(byLtsFirst))
2024-04-26 12:19:50 +02:00
- .concat([...minimalImages].reverse().sort(byLtsFirst))
- .concat([...imagesLxdImages])
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))]
2024-04-26 12:19:50 +02:00
@@ -213,14 +188,8 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
2024-02-22 11:31:13 +01:00
if (item.created_at) {
return "Local";
}
- if (item.server === canonicalServer) {
- return "Ubuntu";
- }
- if (item.server === minimalServer) {
- return "Ubuntu Minimal";
2024-04-26 12:19:50 +02:00
- }
- if (item.server === imagesLxdServer) {
- return "LXD Images";
2024-02-22 11:31:13 +01:00
+ if (item.server === linuxContainersServer) {
+ return "Linux Containers";
}
2024-04-26 12:19:50 +02:00
return "Custom";
2024-02-22 11:31:13 +01:00
};
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