Debian Codegraph @

pkg/storaged/lvm2/unsupported-logical-volume.jsx

raw
1 /*
2 * Copyright (C) 2023 Red Hat, Inc.
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6 import cockpit from "cockpit";
7 import React from "react";
8
9 import { CardBody } from "@patternfly/react-core/dist/esm/components/Card/index.js";
10
11 import {
12 StorageCard, new_page, new_card
13 } from "../pages.jsx";
14
15 import { lvol_delete } from "./block-logical-volume.jsx";
16
17 const _ = cockpit.gettext;
18
19 export function make_unsupported_logical_volume_page(parent, vgroup, lvol, next_card) {
20 const unsupported_card = new_card({
21 title: _("Unsupported logical volume"),
22 next: next_card,
23 page_location: ["vg", vgroup.Name, lvol.Name],
24 page_name: lvol.Name,
25 page_size: lvol.Size,
26 component: LVM2UnsupportedLogicalVolumeCard,
27 props: { vgroup, lvol },
28 actions: [
29 { title: _("Deactivate"), action: () => lvol.Deactivate({}) },
30 { title: _("Delete"), action: () => lvol_delete(lvol, unsupported_card), danger: true },
31 ]
32 });
33
34 // FIXME: it would be nice to log unsupported volumes with
35 // "console.error" so that our tests will detect them more
36 // readily. Unfortunately, when a logical volume gets activated,
37 // its block device will only appear on D-Bus a little while
38 // later, and the logical volume is thus considered unsupported
39 // for the little while.
40 //
41 // This also leads to potential flicker in the UI, so it would be
42 // nice to remove this intermediate state also for that reason.
43
44 new_page(parent, unsupported_card);
45 }
46
47 const LVM2UnsupportedLogicalVolumeCard = ({ card, vgroup, lvol }) => {
48 return (
49 <StorageCard card={card}>
50 <CardBody>
51 <p>{_("INTERNAL ERROR - This logical volume is marked as active and should have an associated block device. However, no such block device could be found.")}</p>
52 </CardBody>
53 </StorageCard>);
54 };