incus-ui: Update to 0.8

This commit is contained in:
Erwin Boskma 2024-04-26 12:19:50 +02:00
parent 8d4f5cdb2d
commit 0d6d10f5ec
Signed by: erwin
SSH key fingerprint: SHA256:OCinH/khuGY1LA9RG8YLM8GNH6C1DDXBdy3SNE+I5Hw
8 changed files with 144 additions and 65 deletions

View file

@ -5,6 +5,7 @@
fetchYarnDeps,
nodejs,
prefetch-yarn-deps,
fixup-yarn-lock,
yarn,
gnused,
rsync,
@ -12,19 +13,18 @@
stdenv.mkDerivation (finalAttrs: {
pname = "incus-ui";
version = "0.6";
version = "0.8";
src = fetchFromGitHub {
owner = "canonical";
repo = "lxd-ui";
rev = finalAttrs.version;
# hash = "sha256-52MRf7bk8Un9wqz00+JjDmuJgPKYhgAhIbMbcAuf8W8=";
hash = "sha256-3Ts6lKyzpMDVATCKD1fFIGTskWzWpQUT9S8cPFnlEOs=";
hash = "sha256-oD/GPm84oFXHcZ8vTUzNgQinrHwNuvpeVjsrp8ibIZY=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-0pyxwMGGqogEe1w3sail8NUDHtxLQZU9Wg8E6rQNy4o=";
hash = "sha256-hRZ0vbksxnUv4XMrbhP2PI94UYYzwrydJHSx+uf+MbI=";
};
patches = [
@ -39,17 +39,18 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
nodejs
prefetch-yarn-deps
fixup-yarn-lock
yarn
];
configurePhase = ''
runHook preConfigure
${gnused}/bin/sed -i "s/LXD/Incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
${gnused}/bin/sed -i "s/devlxd/guestapi/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
${gnused}/bin/sed -i "s/dev\/lxd/dev\/incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
${gnused}/bin/sed -i "s/lxd_/incus_/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
${gnused}/bin/sed -i "s/\"lxd\"/\"incus\"/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
${gnused}/bin/sed -e "s/devlxd/guestapi/g" \
-e "s/dev\/lxd/dev\/incus/g" \
-e "s/LXD/Incus/g" \
-e "s/Lxd/Incus_/g" \
-e "s/lxd/incus/g" -i src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror "$offlineCache"

View file

@ -1,7 +1,7 @@
From 530478927deddecbcc49efd01cad10ed49f0ca26 Mon Sep 17 00:00:00 2001
From a8ffa74e0da8a565020fb1ebebd58f23235f19ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 22:59:56 +0000
Subject: [PATCH 1/6] Branding
Subject: [PATCH 1/8] Branding
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -9,14 +9,16 @@ Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
index.html | 2 +-
public/assets/img/favicon-32x32.png | Bin 1361 -> 2506 bytes
public/assets/img/incus-logo.svg | 129 ++++++++++++++++++++++++++++
public/assets/img/lxd-logo.svg | 34 --------
src/components/Logo.tsx | 6 +-
src/pages/login/Login.tsx | 1 -
src/sass/_pattern_icon.scss | 11 ---
src/sass/_pattern_navigation.scss | 8 +-
src/sass/styles.scss | 4 -
src/sass/styles.scss | 5 --
src/util/title.tsx | 2 +-
9 files changed, 138 insertions(+), 48 deletions(-)
10 files changed, 138 insertions(+), 60 deletions(-)
create mode 100644 public/assets/img/incus-logo.svg
delete mode 100644 public/assets/img/lxd-logo.svg
@ -210,7 +212,7 @@ index 272ef59..0000000
-</svg>
\ No newline at end of file
diff --git a/src/components/Logo.tsx b/src/components/Logo.tsx
index bcaf07e..92a0a5a 100644
index cf7faa8..b1b06d2 100644
--- a/src/components/Logo.tsx
+++ b/src/components/Logo.tsx
@@ -15,11 +15,11 @@ const Logo: FC = () => {
@ -229,17 +231,36 @@ index bcaf07e..92a0a5a 100644
);
};
diff --git a/src/pages/login/Login.tsx b/src/pages/login/Login.tsx
index 608f7a0..130198e 100644
index c283cd5..9307844 100644
--- a/src/pages/login/Login.tsx
+++ b/src/pages/login/Login.tsx
@@ -24,7 +24,6 @@ const Login: FC = () => {
@@ -23,7 +23,6 @@ const Login: FC = () => {
return (
<CustomLayout>
<Row className="empty-state">
<Col size={6} className="col-start-large-4">
- <Icon name="containers" className="empty-state-icon lxd-icon" />
<h1 className="p-heading--4 u-sv-2">Login</h1>
{hasOidc && (
<>
<div className="empty-state login">
- <Icon name="containers" className="empty-state-icon lxd-icon" />
<h1 className="p-heading--4 u-sv-2">Login</h1>
{hasOidc && (
<>
diff --git a/src/sass/_pattern_icon.scss b/src/sass/_pattern_icon.scss
index 21254c8..f6da7f9 100644
--- a/src/sass/_pattern_icon.scss
+++ b/src/sass/_pattern_icon.scss
@@ -1,14 +1,3 @@
-@mixin lxdui-icon-sidebar-collapse() {
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' width='16px' height='16px' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M 0 7.743 L 6.742 14.485 L 7.899 13.329 L 2.311 7.743 L 7.899 2.157 L 6.742 1 L 0 7.743 Z M 7.899 7.743 L 14.642 14.485 L 15.797 13.329 L 10.21 7.743 L 15.797 2.157 L 14.642 1 L 7.899 7.743 Z' fill='%23FFF' style=''/%3E%3C/svg%3E");
-}
-
-@mixin lxdui-p-icon {
- .p-icon--sidebar-toggle {
- @extend %icon;
- @include lxdui-icon-sidebar-collapse;
- }
-}
-
.p-icon--info--notification {
@extend %icon;
@include vf-icon-info-coloured-themed;
diff --git a/src/sass/_pattern_navigation.scss b/src/sass/_pattern_navigation.scss
index 92236ef..1373ab0 100644
--- a/src/sass/_pattern_navigation.scss
@ -278,10 +299,18 @@ index 92236ef..1373ab0 100644
}
}
diff --git a/src/sass/styles.scss b/src/sass/styles.scss
index 43f63ae..7aa17ac 100644
index 34d155d..1f37774 100644
--- a/src/sass/styles.scss
+++ b/src/sass/styles.scss
@@ -146,10 +146,6 @@ body {
@@ -4,7 +4,6 @@
@import "vanilla-framework/scss/build";
@import "./breakpoints";
@import "pattern_icon";
-@include lxdui-p-icon;
@include vf-p-icon-add-canvas;
@include vf-p-icon-applications;
@include vf-p-icon-begin-downloading;
@@ -148,10 +147,6 @@ body {
@include vf-icon-external-link($color-link);
}
@ -293,10 +322,10 @@ index 43f63ae..7aa17ac 100644
display: inline-block;
min-width: 8.5rem;
diff --git a/src/util/title.tsx b/src/util/title.tsx
index 8a80a11..6b69387 100644
index 3ef659b..879efb9 100644
--- a/src/util/title.tsx
+++ b/src/util/title.tsx
@@ -6,6 +6,6 @@ export const setTitle = () => {
@@ -6,6 +6,6 @@ export const setTitle = (): void => {
useEffect(() => {
const host = settings?.config?.["user.ui_title"] ?? location.hostname;

View file

@ -1,7 +1,7 @@
From 9f44a025b61024f47c8eabcf9a0f25af0d2585da Mon Sep 17 00:00:00 2001
From 4a477c328eada5d3b3dfee39b6949dc97c36f813 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 23:02:27 +0000
Subject: [PATCH 2/6] Update navigation
Subject: [PATCH 2/8] Update navigation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -14,29 +14,29 @@ Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx
index d2321da..f79deeb 100644
index 147676a..64a97d3 100644
--- a/src/components/Navigation.tsx
+++ b/src/components/Navigation.tsx
@@ -286,7 +286,7 @@ const Navigation: FC = () => {
@@ -261,7 +261,7 @@ const Navigation: FC = () => {
<li className="p-side-navigation__item">
<a
className="p-side-navigation__link"
- href="https://discourse.ubuntu.com/c/lxd/126"
+ href="https://discuss.linuxcontainers.org"
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
title="Discussion"
@@ -301,7 +301,7 @@ const Navigation: FC = () => {
@@ -276,7 +276,7 @@ const Navigation: FC = () => {
<li className="p-side-navigation__item">
<a
className="p-side-navigation__link"
- href="https://github.com/canonical/lxd-ui/issues/new"
+ href="https://github.com/zabbly/incus/issues/new"
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
title="Report a bug"
diff --git a/src/components/NoMatch.tsx b/src/components/NoMatch.tsx
index 8d5270c..bd9e515 100644
index a088c54..65216fa 100644
--- a/src/components/NoMatch.tsx
+++ b/src/components/NoMatch.tsx
@@ -13,7 +13,7 @@ const NoMatch: FC = () => {
@ -46,21 +46,21 @@ index 8d5270c..bd9e515 100644
- href="https://github.com/canonical/lxd-ui/issues/new"
+ href="https://github.com/zabbly/incus/issues/new"
target="_blank"
rel="noreferrer"
rel="noopener noreferrer"
title="Report a bug"
diff --git a/src/context/useDocs.tsx b/src/context/useDocs.tsx
index 454d98c..90a0de9 100644
index 900688f..be3e593 100644
--- a/src/context/useDocs.tsx
+++ b/src/context/useDocs.tsx
@@ -1,7 +1,7 @@
import { useSettings } from "context/useSettings";
import { useSupportedFeatures } from "./useSupportedFeatures";
export const useDocs = (): string => {
- const remoteBase = "https://documentation.ubuntu.com/lxd/en/latest";
+ const remoteBase = "/documentation";
const localBase = "/documentation";
const { data: settings } = useSettings();
const { hasLocalDocumentation } = useSupportedFeatures();
--
2.34.1

View file

@ -1,7 +1,7 @@
From fc42d29bfc591a2f3a31cb7355ac5a6fb2f64614 Mon Sep 17 00:00:00 2001
From 767dff6c01f0c8195f4044beb3059533a814212a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 23:03:33 +0000
Subject: [PATCH 3/6] Update certificate generation
Subject: [PATCH 3/8] Update certificate generation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -15,7 +15,7 @@ Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/pages/login/BrowserImport.tsx b/src/pages/login/BrowserImport.tsx
index f3cbcae..5d11d80 100644
index cc9c87a..d8ff1a4 100644
--- a/src/pages/login/BrowserImport.tsx
+++ b/src/pages/login/BrowserImport.tsx
@@ -25,7 +25,7 @@ const BrowserImport: FC<Props> = ({ sendPfx }) => {
@ -92,7 +92,7 @@ index f3cbcae..5d11d80 100644
</li>
</ul>
diff --git a/src/pages/login/CertificateAdd.tsx b/src/pages/login/CertificateAdd.tsx
index e539588..05ed677 100644
index 0e86797..9d227e5 100644
--- a/src/pages/login/CertificateAdd.tsx
+++ b/src/pages/login/CertificateAdd.tsx
@@ -52,7 +52,7 @@ const CertificateAdd: FC = () => {
@ -114,7 +114,7 @@ index e539588..05ed677 100644
</Col>
</Row>
diff --git a/src/pages/login/CertificateGenerate.tsx b/src/pages/login/CertificateGenerate.tsx
index e8ce222..3c23645 100644
index 2ea99de..39dce9f 100644
--- a/src/pages/login/CertificateGenerate.tsx
+++ b/src/pages/login/CertificateGenerate.tsx
@@ -82,7 +82,7 @@ const CertificateGenerate: FC = () => {
@ -146,7 +146,7 @@ index e8ce222..3c23645 100644
onClick={() =>
downloadText(
- `lxd-ui-${location.hostname}.crt`,
+ `incus-ui-${location.hostname}.crt`,
+ `incus-ui.crt`,
certs.crt,
)
}
@ -155,7 +155,7 @@ index e8ce222..3c23645 100644
? () =>
downloadBase64(
- `lxd-ui-${location.hostname}.pfx`,
+ `incus-ui-${location.hostname}.pfx`,
+ `incus-ui.pfx`,
certs.pfx,
)
: undefined

View file

@ -1,7 +1,7 @@
From 7d9a5b8d9bbf2408dc8334e34db9f487a691c0b3 Mon Sep 17 00:00:00 2001
From 5e04b21d7e49cc36115687ba8806cacf2fb03512 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 23:12:29 +0000
Subject: [PATCH 4/6] Remove external links
Subject: [PATCH 4/8] Remove external links
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -12,7 +12,7 @@ Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
1 file changed, 11 deletions(-)
diff --git a/src/pages/storage/UploadCustomImageHint.tsx b/src/pages/storage/UploadCustomImageHint.tsx
index 128c658..22c9a1f 100644
index dcad010..eedb1a3 100644
--- a/src/pages/storage/UploadCustomImageHint.tsx
+++ b/src/pages/storage/UploadCustomImageHint.tsx
@@ -9,17 +9,6 @@ const UploadCustomImageHint: FC = () => {
@ -24,7 +24,7 @@ index 128c658..22c9a1f 100644
- className="p-notification__action"
- href="https://ubuntu.com/tutorials/how-to-install-a-windows-11-vm-using-lxd#1-overview"
- target="_blank"
- rel="noreferrer"
- rel="noopener noreferrer"
- >
- Windows ISO images
- <Icon className="external-link-icon" name="external-link" />

View file

@ -1,21 +1,21 @@
From 98fcec984025deeb3a93cdd1618e3d47abb0d0cd Mon Sep 17 00:00:00 2001
From e36304b2f02f3bb6bb9bc80482afc9b36df2d3c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 22 Nov 2023 23:16:13 +0000
Subject: [PATCH 5/6] Remove Canonical image servers
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 <stgraber@stgraber.org>
---
src/pages/images/ImageSelector.tsx | 34 +++++++++---------------------
1 file changed, 10 insertions(+), 24 deletions(-)
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 f026ec3..91333be 100644
index ca10169..2123eb4 100644
--- a/src/pages/images/ImageSelector.tsx
+++ b/src/pages/images/ImageSelector.tsx
@@ -33,13 +33,9 @@ interface Props {
@@ -33,16 +33,9 @@ interface Props {
onClose: () => void;
}
@ -26,13 +26,16 @@ index f026ec3..91333be 100644
-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";
@@ -72,14 +68,9 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
@@ -75,33 +68,17 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
const { data: settings, isLoading: isSettingsLoading } = useSettings();
@ -49,28 +52,39 @@ index f026ec3..91333be 100644
+ queryFn: () => loadImages(linuxContainersJson, linuxContainersServer),
});
- const { data: imagesLxdImages = [], isLoading: isImagesLxdLoading } =
- useQuery({
- queryKey: [queryKeys.images, imagesLxdServer],
- queryFn: () => loadImages(imagesLxdJson, imagesLxdServer),
- });
-
const { data: localImages = [], isLoading: isLocalImageLoading } = useQuery({
@@ -87,8 +78,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
queryKey: [queryKeys.images, project],
queryFn: () => fetchImageList(project ?? ""),
});
- const isLoading =
- isCiLoading || isMinimalLoading || isLocalImageLoading || isSettingsLoading;
- isCiLoading ||
- isMinimalLoading ||
- isImagesLxdLoading ||
- isLocalImageLoading ||
- isSettingsLoading;
+ const isLoading = isLciLoading || isLocalImageLoading || isSettingsLoading;
const archSupported = getArchitectureAliases(
settings?.environment?.architectures ?? [],
);
@@ -97,8 +87,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
@@ -110,9 +87,7 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
: localImages
.filter((image) => !image.cached)
.map(localLxdToRemoteImage)
- .concat([...minimalImages].reverse().sort(byLtsFirst))
- .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))]
@@ -199,11 +188,8 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
@@ -213,14 +188,8 @@ const ImageSelector: FC<Props> = ({ onSelect, onClose }) => {
if (item.created_at) {
return "Local";
}
@ -79,11 +93,14 @@ index f026ec3..91333be 100644
- }
- 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

View file

@ -1,7 +1,7 @@
From 02a3fdbde4c5bb60ca12f99f2141f0754f665b1e Mon Sep 17 00:00:00 2001
From 9929fa50a7631de81f1d16895f67612555b6c9af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Fri, 16 Feb 2024 17:32:51 +0000
Subject: [PATCH 6/6] Remove version check
Subject: [PATCH 6/8] Remove version check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -12,7 +12,7 @@ Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/components/Version.tsx b/src/components/Version.tsx
index acb4c59..9c1d968 100644
index a9b0741..24bd540 100644
--- a/src/components/Version.tsx
+++ b/src/components/Version.tsx
@@ -14,9 +14,7 @@ const Version: FC = () => {

View file

@ -0,0 +1,32 @@
From 22fc5a8ae2726d0f3dfdbef2f1e228f7dcd3162f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Thu, 28 Mar 2024 15:54:43 +0000
Subject: [PATCH 7/8] Improve OpenFGA support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This makes a few changes to better work with OpenFGA:
- Don't expect a clear 404 on a non-existing object
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
src/util/helpers.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/helpers.tsx b/src/util/helpers.tsx
index 2825a67..a5e8680 100644
--- a/src/util/helpers.tsx
+++ b/src/util/helpers.tsx
@@ -171,7 +171,7 @@ export const checkDuplicateName = (
const signal = deduplicateController.signal;
return fetch(`/1.0/${target}/${candidate}?project=${project}`, {
signal,
- }).then((response) => response.status === 404);
+ }).then((response) => response.status === 404 || response.status === 403);
};
export const getUrlParam = (paramName: string, url?: string): string | null => {
--
2.34.1