From b33dd69e56f4d7b76a15cbaad9562869c7b26437 Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 24 Feb 2025 14:10:06 +0000 Subject: [PATCH 1/2] web: Only severe issues prevent installation --- .../components/core/InstallButton.test.tsx | 33 ++++++++++++++++++- web/src/components/core/InstallButton.tsx | 3 +- web/src/components/core/IssuesDrawer.test.tsx | 31 ++++++++++++++--- web/src/components/core/IssuesDrawer.tsx | 2 +- web/src/types/issues.ts | 12 +++++++ 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/web/src/components/core/InstallButton.test.tsx b/web/src/components/core/InstallButton.test.tsx index 1f26aa781e..1983dc3134 100644 --- a/web/src/components/core/InstallButton.test.tsx +++ b/web/src/components/core/InstallButton.test.tsx @@ -58,7 +58,7 @@ describe("InstallButton", () => { description: "Fake Issue", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Fake Issue details", }, ], @@ -131,6 +131,37 @@ describe("InstallButton", () => { }); }); }); + + describe("when there are only non-critical issues", () => { + beforeEach(() => { + mockIssuesList = new IssuesList( + [ + { + description: "Fake warning", + kind: "generic", + source: 0, + severity: 0, + details: "Fake Issue details", + }, + ], + [], + [], + [], + ); + }); + + it("renders the button without any additional information", async () => { + const { user, container } = installerRender(); + const button = screen.getByRole("button", { name: "Install" }); + // Renders nothing else + const icon = container.querySelector("svg"); + expect(icon).toBeNull(); + await user.hover(button); + expect( + screen.queryByRole("tooltip", { name: /Not possible with the current setup/ }), + ).toBeNull(); + }); + }); }); describe("InstallConfirmationPopup", () => { diff --git a/web/src/components/core/InstallButton.tsx b/web/src/components/core/InstallButton.tsx index 074d8ba99b..e87be31dfd 100644 --- a/web/src/components/core/InstallButton.tsx +++ b/web/src/components/core/InstallButton.tsx @@ -25,6 +25,7 @@ import { Button, ButtonProps, Stack, Tooltip, TooltipProps } from "@patternfly/r import { Popup } from "~/components/core"; import { startInstallation } from "~/api/manager"; import { useAllIssues } from "~/queries/issues"; +import { IssueSeverity } from "~/types/issues"; import { useLocation } from "react-router-dom"; import { SIDE_PATHS } from "~/routes/paths"; import { _ } from "~/i18n"; @@ -77,7 +78,7 @@ const InstallButton = ( ) => { const labelId = useId(); const tooltipId = useId(); - const issues = useAllIssues(); + const issues = useAllIssues().filter((i) => i.severity === IssueSeverity.Error); const [isOpen, setIsOpen] = useState(false); const location = useLocation(); const hasIssues = !issues.isEmpty; diff --git a/web/src/components/core/IssuesDrawer.test.tsx b/web/src/components/core/IssuesDrawer.test.tsx index bdd78e0577..2e3610d8ae 100644 --- a/web/src/components/core/IssuesDrawer.test.tsx +++ b/web/src/components/core/IssuesDrawer.test.tsx @@ -57,6 +57,27 @@ describe("IssuesDrawer", () => { itRendersNothing(); }); + describe("when there are non-critical issues", () => { + beforeEach(() => { + mockIssuesList = new IssuesList( + [ + { + description: "Registration Fake Warning", + kind: "generic", + source: 0, + severity: 0, + details: "Registration Fake Issue details", + }, + ], + [], + [], + [], + ); + }); + + itRendersNothing(); + }); + describe("when there are installation issues", () => { beforeEach(() => { mockIssuesList = new IssuesList( @@ -65,7 +86,7 @@ describe("IssuesDrawer", () => { description: "Registration Fake Issue", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Registration Fake Issue details", }, ], @@ -74,7 +95,7 @@ describe("IssuesDrawer", () => { description: "Software Fake Issue", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Software Fake Issue details", }, ], @@ -83,14 +104,14 @@ describe("IssuesDrawer", () => { description: "Storage Fake Issue 1", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Storage Fake Issue 1 details", }, { description: "Storage Fake Issue 2", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Storage Fake Issue 2 details", }, ], @@ -99,7 +120,7 @@ describe("IssuesDrawer", () => { description: "Users Fake Issue", kind: "generic", source: 0, - severity: 0, + severity: 1, details: "Users Fake Issue details", }, ], diff --git a/web/src/components/core/IssuesDrawer.tsx b/web/src/components/core/IssuesDrawer.tsx index a92528e3ae..663534cd12 100644 --- a/web/src/components/core/IssuesDrawer.tsx +++ b/web/src/components/core/IssuesDrawer.tsx @@ -40,7 +40,7 @@ import { _ } from "~/i18n"; * Drawer for displaying installation issues */ const IssuesDrawer = forwardRef(({ onClose }: { onClose: () => void }, ref) => { - const issues = useAllIssues(); + const issues = useAllIssues().filter((i) => i.severity === IssueSeverity.Error); const { phase } = useInstallerStatus({ suspense: true }); const { issues: issuesByScope } = issues; diff --git a/web/src/types/issues.ts b/web/src/types/issues.ts index e34031c8e3..891780c392 100644 --- a/web/src/types/issues.ts +++ b/web/src/types/issues.ts @@ -85,6 +85,18 @@ class IssuesList { }; this.isEmpty = !Object.values(this.issues).some((v) => v.length > 0); } + + /** + * Creates a new list only with the issues that match the given function + */ + filter(fn) { + return new IssuesList( + this.issues["product"].filter(fn), + this.issues["software"].filter(fn), + this.issues["storage"].filter(fn), + this.issues["users"].filter(fn), + ); + } } /** From cfda8ecd7b5d3d04b39e49880f2bf9431d1ca85a Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 24 Feb 2025 14:28:55 +0000 Subject: [PATCH 2/2] web: Changelog --- web/package/agama-web-ui.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index c4f191b405..557ea6a707 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 24 14:17:34 UTC 2025 - Ancor Gonzalez Sosa + +- Ignore non-critical issues to avoid preventing the installation + in valid scenarios (gh#agama-project/agama#2061). + ------------------------------------------------------------------- Mon Feb 24 12:44:15 UTC 2025 - David Diaz