Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 24 14:17:34 UTC 2025 - Ancor Gonzalez Sosa <ancor@suse.com>

- 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 <dgonzalez@suse.com>

Expand Down
33 changes: 32 additions & 1 deletion web/src/components/core/InstallButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("InstallButton", () => {
description: "Fake Issue",
kind: "generic",
source: 0,
severity: 0,
severity: 1,
details: "Fake Issue details",
},
],
Expand Down Expand Up @@ -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(<InstallButton />);
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", () => {
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/core/InstallButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down
31 changes: 26 additions & 5 deletions web/src/components/core/IssuesDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -65,7 +86,7 @@ describe("IssuesDrawer", () => {
description: "Registration Fake Issue",
kind: "generic",
source: 0,
severity: 0,
severity: 1,
details: "Registration Fake Issue details",
},
],
Expand All @@ -74,7 +95,7 @@ describe("IssuesDrawer", () => {
description: "Software Fake Issue",
kind: "generic",
source: 0,
severity: 0,
severity: 1,
details: "Software Fake Issue details",
},
],
Expand All @@ -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",
},
],
Expand All @@ -99,7 +120,7 @@ describe("IssuesDrawer", () => {
description: "Users Fake Issue",
kind: "generic",
source: 0,
severity: 0,
severity: 1,
details: "Users Fake Issue details",
},
],
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/IssuesDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 12 additions & 0 deletions web/src/types/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
}

/**
Expand Down