Skip to content

Commit

Permalink
fix: reboot required and not authorized
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolethoen committed Aug 15, 2023
1 parent dcaee14 commit 1009ccf
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './RebootRequired.scss';

import React from 'react';
import { Text, TextContent, TextVariants } from '@patternfly/react-core';
import { Icon, Text, TextContent, TextVariants } from '@patternfly/react-core';
import { PowerOffIcon } from '@patternfly/react-icons';

import { RuleDetailsMessages } from '../RuleDetails/RuleDetails';
Expand All @@ -13,7 +13,9 @@ interface RebootRequiredProps {

const RebootRequired: React.FC<RebootRequiredProps> = ({ messages, rebootRequired }) => (
<span className="system-reboot-message">
<PowerOffIcon className={rebootRequired ? 'reboot-required-icon' : 'no-reboot-required-icon'} />
<Icon>
<PowerOffIcon className={rebootRequired ? 'reboot-required-icon' : 'no-reboot-required-icon'} />
</Icon>
<TextContent className="system-reboot-message__content">
<Text component={TextVariants.p}>{messages.systemReboot}</Text>
</TextContent>
Expand Down
7 changes: 0 additions & 7 deletions packages/components/src/NotAuthorized/NotAuthorized.scss

This file was deleted.

25 changes: 14 additions & 11 deletions packages/components/src/NotAuthorized/NotAuthorized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {
Button,
EmptyState,
EmptyStateActions,
EmptyStateBody,
EmptyStateFooter,
EmptyStateHeader,
Expand Down Expand Up @@ -52,17 +53,19 @@ const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
<EmptyStateHeader titleText={heading} icon={<EmptyStateIcon icon={Icon} />} headingLevel="h5" />
<EmptyStateBody>{description}</EmptyStateBody>
<EmptyStateFooter>
{actions}
{showReturnButton &&
(document.referrer ? (
<Button variant="primary" onClick={() => history.back()}>
{prevPageButtonText}
</Button>
) : (
<Button variant="primary" component="a" href=".">
{toLandingPageText}
</Button>
))}
{actions && <EmptyStateActions>{actions}</EmptyStateActions>}
<EmptyStateActions>
{showReturnButton &&
(document.referrer ? (
<Button variant="primary" onClick={() => history.back()}>
{prevPageButtonText}
</Button>
) : (
<Button variant="primary" component="a" href=".">
{toLandingPageText}
</Button>
))}
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ exports[`NotAuthorized component should apply custom styles 1`] = `
<ContactBody />
</EmptyStateBody>
<EmptyStateFooter>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
<EmptyStateActions>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
`;
Expand All @@ -46,7 +48,9 @@ exports[`NotAuthorized component should not show buttons 1`] = `
<EmptyStateBody>
<ContactBody />
</EmptyStateBody>
<EmptyStateFooter />
<EmptyStateFooter>
<EmptyStateActions />
</EmptyStateFooter>
</EmptyState>
`;

Expand All @@ -68,13 +72,15 @@ exports[`NotAuthorized component should render 1`] = `
<ContactBody />
</EmptyStateBody>
<EmptyStateFooter>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
<EmptyStateActions>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
`;
Expand All @@ -97,25 +103,29 @@ exports[`NotAuthorized component should show custom actions 1`] = `
<ContactBody />
</EmptyStateBody>
<EmptyStateFooter>
<button
id="action-one"
key="1"
>
1
</button>
<button
id="action-one"
key="2"
>
2
</button>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
<EmptyStateActions>
<button
id="action-one"
key="1"
>
1
</button>
<button
id="action-one"
key="2"
>
2
</button>
</EmptyStateActions>
<EmptyStateActions>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
`;
Expand All @@ -138,13 +148,15 @@ exports[`NotAuthorized component should show custom description 1`] = `
Some text
</EmptyStateBody>
<EmptyStateFooter>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
<EmptyStateActions>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
`;
Expand All @@ -167,13 +179,15 @@ exports[`NotAuthorized component should show custom title 1`] = `
<ContactBody />
</EmptyStateBody>
<EmptyStateFooter>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
<EmptyStateActions>
<Button
component="a"
href="."
variant="primary"
>
Go to landing page
</Button>
</EmptyStateActions>
</EmptyStateFooter>
</EmptyState>
`;
Expand Down Expand Up @@ -219,20 +233,24 @@ exports[`NotAuthorized component should use custom icon 1`] = `
<div
className="pf-v5-c-empty-state__footer"
>
<a
aria-disabled={false}
aria-label={null}
className="pf-v5-c-button pf-m-primary"
data-ouia-component-id="OUIA-Generated-Button-primary-1"
data-ouia-component-type="PF5/Button"
data-ouia-safe={true}
disabled={null}
href="."
role={null}
type={null}
<div
className="pf-v5-c-empty-state__actions"
>
Go to landing page
</a>
<a
aria-disabled={false}
aria-label={null}
className="pf-v5-c-button pf-m-primary"
data-ouia-component-id="OUIA-Generated-Button-primary-1"
data-ouia-component-type="PF5/Button"
data-ouia-safe={true}
disabled={null}
href="."
role={null}
type={null}
>
Go to landing page
</a>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 1009ccf

Please sign in to comment.