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