From c43179d6ef2c01330f9cbcc27191f7727c1ff61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 18 Nov 2025 07:22:41 +0000 Subject: [PATCH 1/4] web: add missing files --- web/src/api/product/config.ts | 27 +++++++++++++++++++++++++++ web/src/api/software/proposal.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 web/src/api/product/config.ts create mode 100644 web/src/api/software/proposal.ts diff --git a/web/src/api/product/config.ts b/web/src/api/product/config.ts new file mode 100644 index 0000000000..383cb9bc0b --- /dev/null +++ b/web/src/api/product/config.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) [2025] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +type Config = { + id?: string; +}; + +export type { Config }; diff --git a/web/src/api/software/proposal.ts b/web/src/api/software/proposal.ts new file mode 100644 index 0000000000..7f0b0e4f22 --- /dev/null +++ b/web/src/api/software/proposal.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) [2025] SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact SUSE LLC. + * + * To contact SUSE LLC about this file by physical or electronic mail, you may + * find current contact information at www.suse.com. + */ + +import { PatternsSelection } from "~/types/software"; + +type Proposal = { + size?: string; + patterns?: PatternsSelection; +}; + +export type { Proposal }; From 61d56f7ed7eb462b02647c9b598b9e913be9110c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 18 Nov 2025 16:04:09 +0000 Subject: [PATCH 2/4] web: fix types --- web/src/api/software/proposal.ts | 4 ++-- web/src/api/system.ts | 3 ++- web/src/components/overview/SoftwareSection.tsx | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/web/src/api/software/proposal.ts b/web/src/api/software/proposal.ts index 7f0b0e4f22..02d92d008b 100644 --- a/web/src/api/software/proposal.ts +++ b/web/src/api/software/proposal.ts @@ -23,8 +23,8 @@ import { PatternsSelection } from "~/types/software"; type Proposal = { - size?: string; - patterns?: PatternsSelection; + size: string; + patterns: PatternsSelection; }; export type { Proposal }; diff --git a/web/src/api/system.ts b/web/src/api/system.ts index 7e9589c538..a90d8f0ab6 100644 --- a/web/src/api/system.ts +++ b/web/src/api/system.ts @@ -22,12 +22,13 @@ import * as l10n from "~/api/l10n/system"; import * as storage from "~/api/storage/system"; -import { Product } from "~/types/software"; +import { AddonInfo, Pattern, Product, Repository } from "~/types/software"; type System = { l10n?: l10n.System; storage?: storage.System; products?: Product[]; + software?: { addons: AddonInfo[]; patterns: Pattern[]; repositories: Repository[] }; }; export { l10n, storage }; diff --git a/web/src/components/overview/SoftwareSection.tsx b/web/src/components/overview/SoftwareSection.tsx index 669951acf4..ad6225dce1 100644 --- a/web/src/components/overview/SoftwareSection.tsx +++ b/web/src/components/overview/SoftwareSection.tsx @@ -22,14 +22,13 @@ import React from "react"; import { Content, List, ListItem } from "@patternfly/react-core"; -import { SelectedBy } from "~/types/software"; import { isEmpty } from "radashi"; import { _ } from "~/i18n"; import { useProposal, useSystem } from "~/hooks/api"; export default function SoftwareSection(): React.ReactNode { const { software: proposal } = useProposal({ suspense: true }); - const { patterns = [] } = useSystem(); + const { software: available } = useSystem({ suspense: true }); if (isEmpty(proposal.patterns)) return; @@ -44,7 +43,8 @@ export default function SoftwareSection(): React.ReactNode { const TextWithList = () => { // TRANSLATORS: %s will be replaced with the installation size, example: "5GiB". const [msg1, msg2] = _("The installation will take %s including:").split("%s"); - const selectedPatterns = patterns.filter((p) => p.selectedBy !== SelectedBy.NONE); + const availablePatterns = Object.keys(proposal.patterns); + const selectedPatterns = available.patterns.filter((p) => availablePatterns.includes(p.name)); return ( <> @@ -65,7 +65,7 @@ export default function SoftwareSection(): React.ReactNode { return ( {_("Software")} - {patterns.length ? : } + {available.patterns.length ? : } ); } From a09657fe02de7bbaff68e91c7113e31c889185c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 18 Nov 2025 16:07:37 +0000 Subject: [PATCH 3/4] web: adapt variable naming --- web/src/components/overview/SoftwareSection.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/components/overview/SoftwareSection.tsx b/web/src/components/overview/SoftwareSection.tsx index ad6225dce1..0ee186aadc 100644 --- a/web/src/components/overview/SoftwareSection.tsx +++ b/web/src/components/overview/SoftwareSection.tsx @@ -43,8 +43,8 @@ export default function SoftwareSection(): React.ReactNode { const TextWithList = () => { // TRANSLATORS: %s will be replaced with the installation size, example: "5GiB". const [msg1, msg2] = _("The installation will take %s including:").split("%s"); - const availablePatterns = Object.keys(proposal.patterns); - const selectedPatterns = available.patterns.filter((p) => availablePatterns.includes(p.name)); + const selectedPatternsIds = Object.keys(proposal.patterns); + const selectedPatterns = available.patterns.filter((p) => selectedPatternsIds.includes(p.name)); return ( <> From dae6e17723f3f6c0be1f742c67aee8c4d7b4666a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Tue, 18 Nov 2025 16:13:49 +0000 Subject: [PATCH 4/4] web: naming refactoring --- web/src/components/overview/SoftwareSection.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/components/overview/SoftwareSection.tsx b/web/src/components/overview/SoftwareSection.tsx index 0ee186aadc..fb7e993371 100644 --- a/web/src/components/overview/SoftwareSection.tsx +++ b/web/src/components/overview/SoftwareSection.tsx @@ -27,15 +27,16 @@ import { _ } from "~/i18n"; import { useProposal, useSystem } from "~/hooks/api"; export default function SoftwareSection(): React.ReactNode { - const { software: proposal } = useProposal({ suspense: true }); const { software: available } = useSystem({ suspense: true }); + const { software: proposed } = useProposal({ suspense: true }); - if (isEmpty(proposal.patterns)) return; + if (isEmpty(proposed.patterns)) return; + const selectedPatternsIds = Object.keys(proposed.patterns); const TextWithoutList = () => { return ( <> - {_("The installation will take")} {proposal.size} + {_("The installation will take")} {proposed.size} ); }; @@ -43,14 +44,13 @@ export default function SoftwareSection(): React.ReactNode { const TextWithList = () => { // TRANSLATORS: %s will be replaced with the installation size, example: "5GiB". const [msg1, msg2] = _("The installation will take %s including:").split("%s"); - const selectedPatternsIds = Object.keys(proposal.patterns); const selectedPatterns = available.patterns.filter((p) => selectedPatternsIds.includes(p.name)); return ( <> {msg1} - {proposal.size} + {proposed.size} {msg2} @@ -65,7 +65,7 @@ export default function SoftwareSection(): React.ReactNode { return ( {_("Software")} - {available.patterns.length ? : } + {selectedPatternsIds.length ? : } ); }