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
1 change: 1 addition & 0 deletions web/src/assets/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ label.pf-m-disabled + .pf-v6-c-check__description {

.pf-v6-c-check {
row-gap: var(--pf-t--global--spacer--xs);
align-content: baseline;

input[type="checkbox"] {
align-self: center;
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/storage/ConfigEditorMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ beforeEach(() => {

async function openMenu() {
const { user } = plainRender(<ConfigEditorMenu />);
const button = screen.getByRole("button", { name: "More options toggle" });
const button = screen.getByRole("button", { name: "Other options toggle" });
await user.click(button);
const menu = screen.getByRole("menu");
return { user, menu };
}

it("renders the menu", () => {
plainRender(<ConfigEditorMenu />);
expect(screen.queryByText("More options")).toBeInTheDocument();
expect(screen.queryByText("Other options")).toBeInTheDocument();
});

it("allows users to change the boot options", async () => {
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/storage/ConfigEditorMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export default function ConfigEditorMenu() {
<MenuToggle
ref={toggleRef}
onClick={toggle}
aria-label={_("More options toggle")}
aria-label={_("Other options toggle")}
isExpanded={isOpen}
>
{_("More options")}
{_("Other options")}
</MenuToggle>
)}
>
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/storage/ConfigureDeviceMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("ConfigureDeviceMenu", () => {

it("renders an initially closed menu ", async () => {
const { user } = plainRender(<ConfigureDeviceMenu />);
const toggler = screen.getByRole("button", { name: "Configure a device", expanded: false });
const toggler = screen.getByRole("button", { name: "More devices", expanded: false });
expect(screen.queryAllByRole("menu").length).toBe(0);
await user.click(toggler);
expect(toggler).toHaveAttribute("aria-expanded", "true");
Expand All @@ -96,7 +96,7 @@ describe("ConfigureDeviceMenu", () => {

it("allows users to add a new LVM volume group", async () => {
const { user } = plainRender(<ConfigureDeviceMenu />);
const toggler = screen.getByRole("button", { name: "Configure a device", expanded: false });
const toggler = screen.getByRole("button", { name: "More devices", expanded: false });
await user.click(toggler);
const lvmMenuItem = screen.getByRole("menuitem", { name: /LVM/ });
await user.click(lvmMenuItem);
Expand All @@ -107,7 +107,7 @@ describe("ConfigureDeviceMenu", () => {
describe("and no disks have been configured yet", () => {
it("allows users to add a new drive", async () => {
const { user } = plainRender(<ConfigureDeviceMenu />);
const toggler = screen.getByRole("button", { name: /Configure a device/ });
const toggler = screen.getByRole("button", { name: /More devices/ });
await user.click(toggler);
const disksMenuItem = screen.getByRole("menuitem", { name: /disk to define/ });
await user.click(disksMenuItem);
Expand All @@ -124,7 +124,7 @@ describe("ConfigureDeviceMenu", () => {

it("allows users to add a new drive to an unused disk", async () => {
const { user } = plainRender(<ConfigureDeviceMenu />);
const toggler = screen.getByRole("button", { name: /Configure a device/ });
const toggler = screen.getByRole("button", { name: /More devices/ });
await user.click(toggler);
const disksMenuItem = screen.getByRole("menuitem", { name: /disk to define/ });
await user.click(disksMenuItem);
Expand All @@ -143,7 +143,7 @@ describe("ConfigureDeviceMenu", () => {

it("renders the disks menu as disabled with an informative label", async () => {
const { user } = plainRender(<ConfigureDeviceMenu />);
const toggler = screen.getByRole("button", { name: /Configure a device/ });
const toggler = screen.getByRole("button", { name: /More devices/ });
await user.click(toggler);
const disksMenuItem = screen.getByRole("menuitem", { name: /disk to define/ });
expect(disksMenuItem).toBeDisabled();
Expand Down
25 changes: 14 additions & 11 deletions web/src/components/storage/ConfigureDeviceMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ const DisksDrillDownMenuItem = ({
}: DisksDrillDownMenuItemProps) => {
const isDisabled = !devices.length;

const disabledDescription = _("Already using all availalbe disks.");
const disabledDescription = _("Already using all available disks");
const enabledDescription = drivesCount
? sprintf(
n_(
"Extends the installation beyond the currently selected disk",
"Extends the installation beyond the current %d disks",
"Extend the installation beyond the currently selected disk",
"Extend the installation beyond the current %d disks",
drivesCount,
),
drivesCount,
)
: _("Extends the installation using a disk");
: _("Start configuring a basic installation");
const title = drivesCount
? _("Select another disk to define partitions")
: _("Select a disk to define partitions");

return (
<MenuItem
Expand Down Expand Up @@ -109,11 +112,7 @@ const DisksDrillDownMenuItem = ({
</DrilldownMenu>
}
>
{n_(
"Select another disk to define partitions",
"Select a disk to define partitions",
drivesCount,
)}
{title}
</MenuItem>
);
};
Expand Down Expand Up @@ -194,14 +193,18 @@ export default function ConfigureDeviceMenu() {
}
};

const lvmDescription = allDevices.length
? _("Define a new LVM on top of one or several disks")
: _("Define a new LVM on the disk");

return (
<MenuContainer
isOpen={isOpen}
onOpenChange={toggle}
toggleRef={toggleRef}
toggle={
<MenuToggle ref={toggleRef} onClick={toggle} isExpanded={isOpen}>
{_("Configure a device")}
{_("More devices")}
</MenuToggle>
}
menuRef={menuRef}
Expand All @@ -228,7 +231,7 @@ export default function ConfigureDeviceMenu() {
<MenuItem
key="lvm-link"
onClick={() => navigate(PATHS.volumeGroup.add)}
description={_("Extend the installation using LVM")}
description={lvmDescription}
>
{_("Add LVM volume group")}
</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/DriveEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ const DriveHeader = ({ drive, driveDevice }: DriveEditorProps) => {

if (isBoot) {
// TRANSLATORS: %s will be replaced by the device name and its size - "/dev/sda, 20 GiB"
return _("Use %s to boot");
return _("Use %s to configure boot partitions");
}
// TRANSLATORS: %s will be replaced by the device name and its size - "/dev/sda, 20 GiB"
return _("Use %s");
Expand Down
39 changes: 26 additions & 13 deletions web/src/components/storage/ProposalFailedInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { IssueSeverity } from "~/types/issues";
import * as partitionUtils from "~/components/storage/utils/partition";
import { sprintf } from "sprintf-js";

function Description({ partitions }) {
function Description({ partitions, booting }) {
const newPartitions = partitions.filter((p) => !p.name);

if (!newPartitions.length) {
Expand All @@ -43,17 +43,29 @@ function Description({ partitions }) {
}

const mountPaths = newPartitions.map((p) => partitionUtils.pathWithSize(p));
const msg1 = sprintf(
// TRANSLATORS: %s is a list of formatted mount points with a partition size like
// '"/" (at least 10 GiB), "/var" (20 GiB) and "swap" (2 GiB)'
// (or a single mount point in the singular case).
n_(
"It is not possible to allocate the requested partition for %s.",
"It is not possible to allocate the requested partitions for %s.",
mountPaths.length,
),
formatList(mountPaths),
);
const msg1 = booting
? sprintf(
// TRANSLATORS: %s is a list of formatted mount points with a partition size like
// '"/" (at least 10 GiB), "/var" (20 GiB) and "swap" (2 GiB)'
// (or a single mount point in the singular case).
n_(
"It is not possible to allocate the requested partitions for booting and for %s.",
"It is not possible to allocate the requested partitions for booting, %s.",
mountPaths.length,
),
formatList(mountPaths),
)
: sprintf(
// TRANSLATORS: %s is a list of formatted mount points with a partition size like
// '"/" (at least 10 GiB), "/var" (20 GiB) and "swap" (2 GiB)'
// (or a single mount point in the singular case).
n_(
"It is not possible to allocate the requested partition for %s.",
"It is not possible to allocate the requested partitions for %s.",
mountPaths.length,
),
formatList(mountPaths),
);

return (
<>
Expand All @@ -78,10 +90,11 @@ export default function ProposalFailedInfo() {
if (!errors.length) return;

const modelPartitions = model.drives.flatMap((d) => d.partitions || []);
const booting = !!model.boot?.configure;

return (
<Alert variant="warning" title={_("Failed to calculate a storage layout")}>
<Description partitions={modelPartitions} />
<Description partitions={modelPartitions} booting={booting} />
</Alert>
);
}
2 changes: 1 addition & 1 deletion web/src/components/storage/ProposalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export default function ProposalPage(): React.ReactNode {
if (isDeprecated) reprobe().catch(console.log);
}, [isDeprecated, reprobe]);

const fixable = ["no_root", "required_filesystems"];
const fixable = ["no_root", "required_filesystems", "vg_target_devices"];
const unfixableErrors = configErrors.filter((e) => !fixable.includes(e.kind));
const isModelEditable = model && !unfixableErrors.length;
const hasDevices = !!availableDevices.length;
Expand Down