Line data Source code
1 : /*
2 : * Copyright (C) 2020 Red Hat, Inc.
3 : * SPDX-License-Identifier: LGPL-2.1-or-later
4 : */
5 :
6 93 : import cockpit from "cockpit";
7 93 : 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 93 : const _ = cockpit.gettext;
18 :
19 93 : export const SuperuserAlert = () => {
20 93 : if (superuser.allowed || !superuser.configured)
21 93 : 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 44 : return (
27 44 : <PageSection>
28 44 : <Alert className="ct-limited-access-alert"
29 44 : variant="warning" isInline
30 44 : customIcon={<LockIcon />}
31 44 : actionClose={<SuperuserButton />}
32 44 : title={_("Web console is running in limited access mode.")} />
33 44 : </PageSection>
34 : );
35 93 : };
|