LCOV - code coverage report
Current view: top level - pkg/systemd - superuser-alert.jsx Coverage Total Hit
Test: cockpit Lines: 100.0 % 15 15
Test Date: 2026-06-25 09:20:42

            Line data    Source code
       1              : /*
       2              :  * Copyright (C) 2020 Red Hat, Inc.
       3              :  * SPDX-License-Identifier: LGPL-2.1-or-later
       4              :  */
       5              : 
       6           95 : import cockpit from "cockpit";
       7           95 : import React from 'react';
       8              : 
       9              : import { Alert } from "@patternfly/react-core/dist/esm/components/Alert/index.js";
      10              : import { PageSection } from "@patternfly/react-core/dist/esm/components/Page/index.js";
      11              : 
      12              : import { LockIcon } from '@patternfly/react-icons';
      13              : 
      14              : import { SuperuserButton } from "superuser-dialogs";
      15              : import { superuser } from "superuser.js";
      16              : 
      17           95 : const _ = cockpit.gettext;
      18              : 
      19           95 : export const SuperuserAlert = () => {
      20           95 :     if (superuser.allowed || !superuser.configured)
      21           95 :         return null;
      22              : 
      23              :     // @Venefilyn: We have a PageSection here to get padding when rendered
      24              :     // and avoid that padding when Alert is not rendered. If we start using this
      25              :     // in another place we need to make it work in the aforementioned scenarios.
      26           46 :     return (
      27           46 :         <PageSection>
      28           46 :             <Alert className="ct-limited-access-alert"
      29           46 :                 variant="warning" isInline
      30           46 :                 customIcon={<LockIcon />}
      31           46 :                 actionClose={<SuperuserButton />}
      32           46 :                 title={_("Web console is running in limited access mode.")} />
      33           46 :         </PageSection>
      34              :     );
      35           95 : };
        

Generated by: LCOV version 2.0-1