Skip to content

Commit 6a3a790

Browse files
committed
Add zFCP issues to ProposalPage
- And allow configuring zFCP in the empty state.
1 parent 3c36bd6 commit 6a3a790

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

web/src/components/storage/ProposalPage.test.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const mockUseConfigModel = jest.fn();
6565
const mockUseProposal = jest.fn();
6666
const mockUseIssues = jest.fn();
6767
const mockUseDASDSystem = jest.fn();
68+
const mockUseZFCPSystem = jest.fn();
6869

6970
jest.mock("~/hooks/model/system/storage", () => ({
7071
...jest.requireActual("~/hooks/model/system/storage"),
@@ -96,6 +97,11 @@ jest.mock("~/hooks/model/system/dasd", () => ({
9697
useSystem: () => mockUseDASDSystem(),
9798
}));
9899

100+
jest.mock("~/hooks/model/system/zfcp", () => ({
101+
...jest.requireActual("~/hooks/model/system/zfcp"),
102+
useSystem: () => mockUseZFCPSystem(),
103+
}));
104+
99105
jest.mock("./ProposalFailedInfo", () => () => <div>proposal failed info</div>);
100106
jest.mock("./UnsupportedModelInfo", () => () => <div>unsupported model info</div>);
101107
jest.mock("./FixableConfigInfo", () => () => <div>fixable config info</div>);
@@ -133,9 +139,9 @@ describe("if there are no devices", () => {
133139
});
134140

135141
describe("if zFCP is not supported", () => {
136-
// beforeEach(() => {
137-
// mockUseZFCPSupported.mockReturnValue(false);
138-
// });
142+
beforeEach(() => {
143+
mockUseZFCPSystem.mockReturnValue(null);
144+
});
139145

140146
it("does not render an option for activating zFCP", () => {
141147
installerRender(<ProposalPage />);
@@ -145,7 +151,7 @@ describe("if there are no devices", () => {
145151

146152
describe("if DASD is not supported", () => {
147153
beforeEach(() => {
148-
mockUseDASDSystem.mockReturnValue(undefined);
154+
mockUseDASDSystem.mockReturnValue(null);
149155
});
150156

151157
it("does not render an option for activating DASD", () => {
@@ -154,10 +160,10 @@ describe("if there are no devices", () => {
154160
});
155161
});
156162

157-
describe.skip("if zFCP is supported", () => {
158-
// beforeEach(() => {
159-
// mockUseZFCPSupported.mockReturnValue(true);
160-
// });
163+
describe("if zFCP is supported", () => {
164+
beforeEach(() => {
165+
mockUseZFCPSystem.mockReturnValue({});
166+
});
161167

162168
it("renders an option for activating zFCP", () => {
163169
installerRender(<ProposalPage />);

web/src/components/storage/ProposalPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ import { _, n_ } from "~/i18n";
6161
import { useLocation } from "react-router";
6262
import { useStorageUiState } from "~/context/storage-ui-state";
6363
import { useSystem as useDASDSystem } from "~/hooks/model/system/dasd";
64-
65-
import type { Issue } from "~/model/issue";
66-
64+
import { useSystem as useZFCPSystem } from "~/hooks/model/system/zfcp";
6765
import spacingStyles from "@patternfly/react-styles/css/utilities/Spacing/spacing";
66+
import IssuesAlert from "~/components/core/IssuesAlert";
67+
import type { Issue } from "~/model/issue";
6868

6969
type InvalidConfigEmptyStateProps = {
7070
issues: Issue[];
@@ -136,8 +136,8 @@ function UnknownConfigEmptyState(): React.ReactNode {
136136
}
137137

138138
function UnavailableDevicesEmptyState(): React.ReactNode {
139-
const isZFCPSupported = false;
140139
const dasdSystem = useDASDSystem();
140+
const zfcpSystem = useZFCPSystem();
141141

142142
const description = _(
143143
"There are not disks available for the installation. You may need to configure some device.",
@@ -157,7 +157,7 @@ function UnavailableDevicesEmptyState(): React.ReactNode {
157157
{_("Connect to iSCSI targets")}
158158
</Link>
159159
</SplitItem>
160-
{isZFCPSupported && (
160+
{zfcpSystem && (
161161
<SplitItem>
162162
<Link to={PATHS.zfcp.root} variant="link">
163163
{_("Activate zFCP disks")}
@@ -307,6 +307,7 @@ export default function ProposalPage(): React.ReactNode {
307307
// Hopefully this could be removed in the future. See rationale at UseStorageUiState
308308
const [resetNeeded, setResetNeeded] = useState(location.state?.resetStorageUiState);
309309
const { setUiState } = useStorageUiState();
310+
const zfcpIssues = useIssues("zfcp");
310311

311312
React.useEffect(() => {
312313
if (resetNeeded) {
@@ -324,6 +325,7 @@ export default function ProposalPage(): React.ReactNode {
324325
progress={{ scope: "storage", ensureRefetched: STORAGE_MODEL_KEY }}
325326
>
326327
<Page.Content>
328+
<IssuesAlert issues={zfcpIssues} />
327329
<ProposalPageContent />
328330
</Page.Content>
329331
</Page>

0 commit comments

Comments
 (0)