diff --git a/web/src/components/overview/StorageSection.tsx b/web/src/components/overview/StorageSection.tsx
index 37ad6215fd..3a3e2413a7 100644
--- a/web/src/components/overview/StorageSection.tsx
+++ b/web/src/components/overview/StorageSection.tsx
@@ -89,9 +89,11 @@ export default function StorageSection() {
return _("Install using several devices with a custom strategy to find the needed space.");
};
- if (drives.length === 0) return {_("No device selected yet")};
- if (!drives.find((dr) => devices.map((d) => d.name).includes(dr.name)))
- return {_("No device selected yet")};
+ const existDevice = (name) => devices.some((d) => d.name === name);
+ const noDrive = drives.length === 0 || drives.some((d) => !existDevice(d));
+
+ if (noDrive) return {_("No device selected yet")};
+
if (drives.length > 1) {
return (
diff --git a/web/src/components/storage/DriveEditor.tsx b/web/src/components/storage/DriveEditor.tsx
index 0c5d93e53f..cbcbcae82d 100644
--- a/web/src/components/storage/DriveEditor.tsx
+++ b/web/src/components/storage/DriveEditor.tsx
@@ -21,13 +21,15 @@
*/
import React, { useRef, useState } from "react";
-import { useNavigate } from "react-router-dom";
+import { useNavigate, generatePath } from "react-router-dom";
import { _, formatList } from "~/i18n";
import { sprintf } from "sprintf-js";
import { baseName, deviceLabel, formattedPath, SPACE_POLICIES } from "~/components/storage/utils";
import { useAvailableDevices } from "~/queries/storage";
import { configModel } from "~/api/storage/types";
import { StorageDevice } from "~/types/storage";
+import { STORAGE as PATHS } from "~/routes/paths";
+import { useChangeDrive, useSetSpacePolicy } from "~/queries/storage";
import * as driveUtils from "~/components/storage/utils/drive";
import { typeDescription, contentDescription } from "~/components/storage/utils/device";
import { Icon } from "../layout";
@@ -50,9 +52,6 @@ import {
MenuToggle,
} from "@patternfly/react-core";
-import { useChangeDrive, useSetSpacePolicy } from "~/queries/storage";
-import { Drive } from "~/api/storage/types/config-model";
-
type DriveEditorProps = { drive: configModel.Drive; driveDevice: StorageDevice };
// FIXME: Presentation is quite poor
@@ -92,9 +91,9 @@ const SpacePolicySelector = ({ drive, driveDevice }: DriveEditorProps) => {
const navigate = useNavigate();
const setSpacePolicy = useSetSpacePolicy();
const onToggle = () => setIsOpen(!isOpen);
- const onSpacePolicyChange = (spacePolicy: "keep" | "delete" | "resize" | "custom") => {
+ const onSpacePolicyChange = (spacePolicy: configModel.SpacePolicy) => {
if (spacePolicy === "custom") {
- return navigate("/storage/space-policy/" + baseName(drive.name));
+ return navigate(generatePath(PATHS.spacePolicy, { id: baseName(drive.name) }));
} else {
setSpacePolicy(drive.name, spacePolicy);
setIsOpen(false);
@@ -157,7 +156,7 @@ const SpacePolicySelector = ({ drive, driveDevice }: DriveEditorProps) => {
};
const SearchSelectorIntro = ({ drive }) => {
- const mainText = (drive: Drive): string => {
+ const mainText = (drive: configModel.Drive): string => {
if (driveUtils.hasReuse(drive)) {
// The current device will be the only option to choose from
return _("This uses existing partitions at the device");
@@ -213,7 +212,7 @@ const SearchSelectorIntro = ({ drive }) => {
);
};
- const extraText = (drive: Drive): string => {
+ const extraText = (drive: configModel.Drive): string => {
// Nothing to add in these cases
if (driveUtils.hasReuse(drive)) return;
if (!driveUtils.hasFilesystem(drive)) return;
@@ -314,7 +313,7 @@ const SearchSelectorMultipleOptions = ({ selected, withNewVg = false, onChange }
return (