Line data Source code
1 : /*
2 : * Copyright (C) 2023 Red Hat, Inc.
3 : * SPDX-License-Identifier: LGPL-2.1-or-later
4 : */
5 :
6 113 : import cockpit from "cockpit";
7 113 : import React from "react";
8 : import client from "../client.js";
9 :
10 : import { DescriptionList } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js";
11 : import { CardBody } from "@patternfly/react-core/dist/esm/components/Card/index.js";
12 :
13 : import { StorageCard, StorageDescription, new_card } from "../pages.jsx";
14 : import { block_name, should_ignore } from "../utils.js";
15 : import { partitionable_block_actions } from "../partitions/actions.jsx";
16 : import { OtherIcon } from "../icons/gnome-icons.jsx";
17 :
18 : import { make_block_page } from "../block/create-pages.jsx";
19 :
20 113 : const _ = cockpit.gettext;
21 :
22 53 : export function make_other_page(parent, block) {
23 53 : if (should_ignore(client, block.path))
24 53 : return;
25 :
26 53 : const other_card = new_card({
27 53 : title: _("Block device"),
28 53 : next: null,
29 53 : page_block: block,
30 53 : page_icon: OtherIcon,
31 53 : for_summary: true,
32 53 : job_path: block.path,
33 53 : component: OtherCard,
34 53 : props: { block },
35 53 : actions: partitionable_block_actions(block),
36 53 : });
37 :
38 53 : make_block_page(parent, block, other_card, { partitionable: true });
39 53 : }
40 :
41 8 : const OtherCard = ({ card, block }) => {
42 8 : return (
43 8 : <StorageCard card={card}>
44 8 : <CardBody>
45 8 : <DescriptionList className="pf-m-horizontal-on-sm">
46 8 : <StorageDescription title={_("Device number")}
47 8 : value={(block.DeviceNumber >> 8) + ":" + (block.DeviceNumber & 0xFF)} />
48 8 : <StorageDescription title={_("Device file")} value={block_name(block)} />
49 8 : </DescriptionList>
50 8 : </CardBody>
51 8 : </StorageCard>
52 : );
53 8 : };
|