Debian Codegraph @

pkg/storaged/block/other.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 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 const _ = cockpit.gettext;
21
22 export function make_other_page(parent, block) {
23 if (should_ignore(client, block.path))
24 return;
25
26 const other_card = new_card({
27 title: _("Block device"),
28 next: null,
29 page_block: block,
30 page_icon: OtherIcon,
31 for_summary: true,
32 job_path: block.path,
33 component: OtherCard,
34 props: { block },
35 actions: partitionable_block_actions(block),
36 });
37
38 make_block_page(parent, block, other_card, { partitionable: true });
39 }
40
41 const OtherCard = ({ card, block }) => {
42 return (
43 <StorageCard card={card}>
44 <CardBody>
45 <DescriptionList className="pf-m-horizontal-on-sm">
46 <StorageDescription title={_("Device number")}
47 value={(block.DeviceNumber >> 8) + ":" + (block.DeviceNumber & 0xFF)} />
48 <StorageDescription title={_("Device file")} value={block_name(block)} />
49 </DescriptionList>
50 </CardBody>
51 </StorageCard>
52 );
53 };