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
27 changes: 27 additions & 0 deletions web/src/api/product/config.ts
Original file line number Diff line number Diff line change
@@ -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 };
30 changes: 30 additions & 0 deletions web/src/api/software/proposal.ts
Original file line number Diff line number Diff line change
@@ -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 };
3 changes: 2 additions & 1 deletion web/src/api/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
16 changes: 8 additions & 8 deletions web/src/components/overview/SoftwareSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,35 @@

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 });
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")} <b>{proposal.size}</b>
{_("The installation will take")} <b>{proposed.size}</b>
</>
);
};

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 selectedPatterns = available.patterns.filter((p) => selectedPatternsIds.includes(p.name));

return (
<>
<Content>
{msg1}
<b>{proposal.size}</b>
<b>{proposed.size}</b>
{msg2}
</Content>
<List>
Expand All @@ -65,7 +65,7 @@ export default function SoftwareSection(): React.ReactNode {
return (
<Content>
<Content component="h3">{_("Software")}</Content>
{patterns.length ? <TextWithList /> : <TextWithoutList />}
{selectedPatternsIds.length ? <TextWithList /> : <TextWithoutList />}
</Content>
);
}
Loading