LCOV - code coverage report
Current view: top level - pkg/storaged/lvm2 - unsupported-logical-volume.jsx Coverage Total Hit
Test: cockpit Lines: 63.0 % 27 17
Test Date: 2026-07-17 12:03:54

            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              : 
       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          113 : const _ = cockpit.gettext;
      18              : 
      19           22 : export function make_unsupported_logical_volume_page(parent, vgroup, lvol, next_card) {
      20           22 :     const unsupported_card = new_card({
      21           22 :         title: _("Unsupported logical volume"),
      22           22 :         next: next_card,
      23           22 :         page_location: ["vg", vgroup.Name, lvol.Name],
      24           22 :         page_name: lvol.Name,
      25           22 :         page_size: lvol.Size,
      26           22 :         component: LVM2UnsupportedLogicalVolumeCard,
      27           22 :         props: { vgroup, lvol },
      28           22 :         actions: [
      29            0 :             { title: _("Deactivate"), action: () => lvol.Deactivate({}) },
      30            0 :             { title: _("Delete"), action: () => lvol_delete(lvol, unsupported_card), danger: true },
      31           22 :         ]
      32           22 :     });
      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           22 :     new_page(parent, unsupported_card);
      45           22 : }
      46              : 
      47            0 : const LVM2UnsupportedLogicalVolumeCard = ({ card, vgroup, lvol }) => {
      48            0 :     return (
      49            0 :         <StorageCard card={card}>
      50            0 :             <CardBody>
      51            0 :                 <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            0 :             </CardBody>
      53            0 :         </StorageCard>);
      54            0 : };
        

Generated by: LCOV version 2.0-1