LCOV - code coverage report
Current view: top level - pkg/playground - packagemanager.tsx Coverage Total Hit
Test: cockpit Lines: 100.0 % 32 32
Test Date: 2026-06-25 09:20:42

            Line data    Source code
       1              : // SPDX-License-Identifier: LGPL-2.1-or-later
       2            1 : import React from 'react';
       3            1 : import { createRoot } from "react-dom/client";
       4              : 
       5              : import '../lib/patternfly/patternfly-6-cockpit.scss';
       6              : 
       7              : import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.js";
       8              : import { Card, CardBody, CardTitle } from '@patternfly/react-core/dist/esm/components/Card/index.js';
       9              : import { Content } from "@patternfly/react-core/dist/esm/components/Content/index.js";
      10              : import { Page, PageSection } from "@patternfly/react-core/dist/esm/components/Page/index.js";
      11              : import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput/index.js";
      12              : 
      13              : import { install_dialog } from "../lib/cockpit-components-install-dialog.jsx";
      14              : 
      15              : import 'cockpit-dark-theme'; // once per page
      16              : import 'page.scss';
      17              : 
      18            1 : const PackageManagerPage = () => {
      19            1 :     const [isInstalling, setIsInstalling] = React.useState(false);
      20            1 :     const [installPackages, setInstallPackages] = React.useState("");
      21              : 
      22            1 :     const openInstallDialog = async () => {
      23            1 :         setIsInstalling(true);
      24            1 :         try {
      25            1 :             await install_dialog(installPackages.split(","));
      26            1 :         } finally {
      27            1 :             setIsInstalling(false);
      28            1 :         }
      29            1 :     };
      30              : 
      31            1 :     return (
      32            1 :         <Page isContentFilled className="no-masthead-sidebar">
      33            1 :             <PageSection hasBodyWrapper={false}>
      34            1 :                 <Content>
      35            1 :                     <Card>
      36            1 :                         <CardTitle id="install-card-title">Install dialog test</CardTitle>
      37            1 :                         <CardBody>
      38            1 :                             <TextInput id="install-packages" value={installPackages} onChange={(_event, value) => setInstallPackages(value)} />
      39            1 :                             <Button id="install-button" variant="primary" onClick={() => openInstallDialog()} isLoading={isInstalling}>Install Package</Button>
      40            1 :                         </CardBody>
      41            1 :                     </Card>
      42            1 :                 </Content>
      43            1 :             </PageSection>
      44            1 :         </Page>
      45              :     );
      46            1 : };
      47              : 
      48            1 : document.addEventListener("DOMContentLoaded", async () => {
      49            1 :     const root = createRoot(document.getElementById("packagemanager")!);
      50            1 :     root.render(<PackageManagerPage />);
      51            1 : });
        

Generated by: LCOV version 2.0-1