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 48 : return (
27 48 : <PageSection>
28 48 : <Alert className="ct-limited-access-alert"
29 48 : variant="warning" isInline
30 48 : customIcon={<LockIcon />}
31 48 : actionClose={<SuperuserButton />}
32 48 : title={_("Web console is running in limited access mode.")} />
33 48 : </PageSection>
34 : );
35 95 : };
|