LCOV - code coverage report
Current view: top level - pkg/storaged/block - other.jsx Coverage Total Hit
Test: cockpit Lines: 100.0 % 31 31
Test Date: 2026-07-17 14:32:59

            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           51 : export function make_other_page(parent, block) {
      23           51 :     if (should_ignore(client, block.path))
      24           51 :         return;
      25              : 
      26           51 :     const other_card = new_card({
      27           51 :         title: _("Block device"),
      28           51 :         next: null,
      29           51 :         page_block: block,
      30           51 :         page_icon: OtherIcon,
      31           51 :         for_summary: true,
      32           51 :         job_path: block.path,
      33           51 :         component: OtherCard,
      34           51 :         props: { block },
      35           51 :         actions: partitionable_block_actions(block),
      36           51 :     });
      37              : 
      38           51 :     make_block_page(parent, block, other_card, { partitionable: true });
      39           51 : }
      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 : };
        

Generated by: LCOV version 2.0-1