Skip to content

Commit bb96840

Browse files
committed
fix(rename): Rename NotAuthorized to UnauthorizedAccess
1 parent a530eda commit bb96840

File tree

9 files changed

+63
-63
lines changed

9 files changed

+63
-63
lines changed

packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md renamed to packages/module/patternfly-docs/content/extensions/component-groups/examples/UnauthorizedAccess/UnauthorizedAccess.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
---
22
section: Component groups
33
subsection: Error communication
4-
id: Not authorized
4+
id: Unauthorized access
55
source: react
6-
propComponents: ['NotAuthorized']
7-
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorized.md
6+
propComponents: ['UnauthorizedAccess']
7+
sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/UnauthorizedAccess/UnauthorizedAccess.md
88
---
99

10-
import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAuthorized";
10+
import UnauthorizedAccess from "@patternfly/react-component-groups/dist/dynamic/UnauthorizedAccess";
1111

1212
A **not authorized** component displays an error screen to users when they attempt to view a page that they don't have permission to access.
1313

1414
## Examples
1515

16-
### Basic not authorized
16+
### Basic unauthorized access
1717

1818
A basic not authorized component displays a title, body text, and custom actions.
1919

20-
```js file="./NotAuthorizedDefaultExample.tsx"
20+
```js file="./UnauthorizedAccessExample.tsx"
2121

2222
```
2323

24-
### Not authorized with custom actions
24+
### Unauthorized access with custom actions
2525

2626
You can customize the not authorized component to fit your use case by specifying the `serviceName` to appear in the title, a `bodyText` of appropriate context for the error, and the `actions` that a user can take instead.
2727

28-
```js file="./NotAuthorizedCustomExample.tsx"
28+
```js file="./UnauthorizedAccessActionsExample.tsx"
2929

3030
```

packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorizedCustomExample.tsx renamed to packages/module/patternfly-docs/content/extensions/component-groups/examples/UnauthorizedAccess/UnauthorizedAccessActionsExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { Button } from '@patternfly/react-core';
3-
import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAuthorized";
3+
import UnauthorizedAccess from "@patternfly/react-component-groups/dist/dynamic/UnauthorizedAccess";
44

55
export const BasicExample: React.FunctionComponent = () => {
66
const primaryAction =
@@ -16,7 +16,7 @@ export const BasicExample: React.FunctionComponent = () => {
1616
</Button>
1717
];
1818
return (
19-
<NotAuthorized
19+
<UnauthorizedAccess
2020
primaryAction={primaryAction}
2121
secondaryActions={secondaryActions}
2222
bodyText="Description text"

packages/module/patternfly-docs/content/extensions/component-groups/examples/NotAuthorized/NotAuthorizedDefaultExample.tsx renamed to packages/module/patternfly-docs/content/extensions/component-groups/examples/UnauthorizedAccess/UnauthorizedAccessExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
2-
import NotAuthorized from "@patternfly/react-component-groups/dist/dynamic/NotAuthorized";
2+
import UnauthorizedAccess from "@patternfly/react-component-groups/dist/dynamic/UnauthorizedAccess";
33

44
export const BasicExample: React.FunctionComponent = () => (
5-
<NotAuthorized
5+
<UnauthorizedAccess
66
bodyText="Description text"
77
serviceName="Demo bundle"
88
/>

packages/module/src/NotAuthorized/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/module/src/NotAuthorized/NotAuthorized.test.tsx renamed to packages/module/src/UnauthorizedAccess/UnauthorizedAccess.test.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
import React from 'react';
22
import { render } from '@testing-library/react';
33
import { QuestionCircleIcon } from '@patternfly/react-icons';
4-
import NotAuthorized from './NotAuthorized';
4+
import UnauthorizedAccess from './UnauthorizedAccess';
55

6-
describe('NotAuthorized component', () => {
6+
describe('UnauthorizedAccess component', () => {
77
const initialProps = {
88
serviceName: 'Foo',
99
};
1010
it('should render', () => {
11-
const { container } = render(<NotAuthorized {...initialProps} />);
11+
const { container } = render(<UnauthorizedAccess {...initialProps} />);
1212
expect(container.firstChild).toMatchSnapshot();
1313
});
1414

1515
it('should apply custom styles', () => {
16-
const { container } = render(<NotAuthorized {...initialProps} className="something" />);
16+
const { container } = render(<UnauthorizedAccess {...initialProps} className="something" />);
1717
expect(container.firstChild).toMatchSnapshot();
1818
});
1919

2020
it('should use custom icon', () => {
21-
const { container } = render(<NotAuthorized {...initialProps} icon={QuestionCircleIcon} />);
21+
const { container } = render(<UnauthorizedAccess {...initialProps} icon={QuestionCircleIcon} />);
2222
expect(container.firstChild).toMatchSnapshot();
2323
});
2424

2525
it('should not show buttons', () => {
26-
const { container } = render(<NotAuthorized {...initialProps} showReturnButton={false} />);
26+
const { container } = render(<UnauthorizedAccess {...initialProps} showReturnButton={false} />);
2727
expect(container.firstChild).toMatchSnapshot();
2828
});
2929

3030
it('should show custom body text', () => {
31-
const { container } = render(<NotAuthorized {...initialProps} bodyText="Some text" />);
31+
const { container } = render(<UnauthorizedAccess {...initialProps} bodyText="Some text" />);
3232
expect(container.firstChild).toMatchSnapshot();
3333
});
3434

3535
it('should show custom title', () => {
36-
const { container } = render(<NotAuthorized titleText="Custom title" />);
36+
const { container } = render(<UnauthorizedAccess titleText="Custom title" />);
3737
expect(container.firstChild).toMatchSnapshot();
3838
});
3939

@@ -50,7 +50,7 @@ describe('NotAuthorized component', () => {
5050
3
5151
</button>
5252
];
53-
const { container } = render(<NotAuthorized {...initialProps} primaryAction={primaryAction} secondaryActions={secondaryActions} />);
53+
const { container } = render(<UnauthorizedAccess {...initialProps} primaryAction={primaryAction} secondaryActions={secondaryActions} />);
5454
expect(container.firstChild).toMatchSnapshot();
5555
});
5656
});

packages/module/src/NotAuthorized/NotAuthorized.tsx renamed to packages/module/src/UnauthorizedAccess/UnauthorizedAccess.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { Button, EmptyState, EmptyStateBody, EmptyStateProps, EmptyStateVariant, EmptyStateFooter, EmptyStateActions, ButtonVariant, } from '@patternfly/react-core';
33
import { LockIcon } from '@patternfly/react-icons';
44

5-
export interface NotAuthorizedProps extends Omit<EmptyStateProps, 'children' | 'titleText'> {
5+
export interface UnauthorizedAccessProps extends Omit<EmptyStateProps, 'children' | 'titleText'> {
66
/** Service name displayed in the title */
77
serviceName?: string;
88
/** Icon displayed above the title */
@@ -29,7 +29,7 @@ export interface NotAuthorizedProps extends Omit<EmptyStateProps, 'children' | '
2929
ouiaId?: string | number;
3030
}
3131

32-
const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
32+
const UnauthorizedAccess: React.FunctionComponent<UnauthorizedAccessProps> = ({
3333
prevPageButtonText = 'Return to previous page',
3434
toLandingPageText = 'Go to landing page',
3535
toLandingPageUrl = ".",
@@ -41,9 +41,9 @@ const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
4141
bodyText = 'Contact your system administrator(s) for more information.',
4242
showReturnButton = true,
4343
className,
44-
ouiaId = 'NotAuthorized',
44+
ouiaId = 'UnauthorizedAccess',
4545
...props
46-
}: NotAuthorizedProps) => (
46+
}: UnauthorizedAccessProps) => (
4747
<EmptyState headingLevel="h5" icon={Icon} variant={EmptyStateVariant.full} className={className} data-ouia-component-id={ouiaId} {...props} titleText={titleText}>
4848
<EmptyStateBody data-ouia-component-id={`${ouiaId}-body`}>{bodyText}</EmptyStateBody>
4949
<EmptyStateFooter data-ouia-component-id={`${ouiaId}-footer`}>
@@ -66,4 +66,4 @@ const NotAuthorized: React.FunctionComponent<NotAuthorizedProps> = ({
6666
);
6767

6868

69-
export default NotAuthorized;
69+
export default UnauthorizedAccess;

packages/module/src/NotAuthorized/__snapshots__/NotAuthorized.test.tsx.snap renamed to packages/module/src/UnauthorizedAccess/__snapshots__/UnauthorizedAccess.test.tsx.snap

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`NotAuthorized component should apply custom styles 1`] = `
3+
exports[`UnauthorizedAccess component should apply custom styles 1`] = `
44
<div
55
class="pf-v6-c-empty-state something"
6-
data-ouia-component-id="NotAuthorized"
6+
data-ouia-component-id="UnauthorizedAccess"
77
>
88
<div
99
class="pf-v6-c-empty-state__content"
@@ -40,18 +40,18 @@ exports[`NotAuthorized component should apply custom styles 1`] = `
4040
</div>
4141
<div
4242
class="pf-v6-c-empty-state__body"
43-
data-ouia-component-id="NotAuthorized-body"
43+
data-ouia-component-id="UnauthorizedAccess-body"
4444
>
4545
Contact your system administrator(s) for more information.
4646
</div>
4747
<div
4848
class="pf-v6-c-empty-state__footer"
49-
data-ouia-component-id="NotAuthorized-footer"
49+
data-ouia-component-id="UnauthorizedAccess-footer"
5050
>
5151
<a
5252
aria-disabled="false"
5353
class="pf-v6-c-button pf-m-primary"
54-
data-ouia-component-id="NotAuthorized-home-button"
54+
data-ouia-component-id="UnauthorizedAccess-home-button"
5555
data-ouia-component-type="PF6/Button"
5656
data-ouia-safe="true"
5757
href="."
@@ -70,10 +70,10 @@ exports[`NotAuthorized component should apply custom styles 1`] = `
7070
</div>
7171
`;
7272

73-
exports[`NotAuthorized component should not show buttons 1`] = `
73+
exports[`UnauthorizedAccess component should not show buttons 1`] = `
7474
<div
7575
class="pf-v6-c-empty-state"
76-
data-ouia-component-id="NotAuthorized"
76+
data-ouia-component-id="UnauthorizedAccess"
7777
>
7878
<div
7979
class="pf-v6-c-empty-state__content"
@@ -110,13 +110,13 @@ exports[`NotAuthorized component should not show buttons 1`] = `
110110
</div>
111111
<div
112112
class="pf-v6-c-empty-state__body"
113-
data-ouia-component-id="NotAuthorized-body"
113+
data-ouia-component-id="UnauthorizedAccess-body"
114114
>
115115
Contact your system administrator(s) for more information.
116116
</div>
117117
<div
118118
class="pf-v6-c-empty-state__footer"
119-
data-ouia-component-id="NotAuthorized-footer"
119+
data-ouia-component-id="UnauthorizedAccess-footer"
120120
>
121121
<div
122122
class="pf-v6-c-empty-state__actions"
@@ -126,10 +126,10 @@ exports[`NotAuthorized component should not show buttons 1`] = `
126126
</div>
127127
`;
128128

129-
exports[`NotAuthorized component should render 1`] = `
129+
exports[`UnauthorizedAccess component should render 1`] = `
130130
<div
131131
class="pf-v6-c-empty-state"
132-
data-ouia-component-id="NotAuthorized"
132+
data-ouia-component-id="UnauthorizedAccess"
133133
>
134134
<div
135135
class="pf-v6-c-empty-state__content"
@@ -166,18 +166,18 @@ exports[`NotAuthorized component should render 1`] = `
166166
</div>
167167
<div
168168
class="pf-v6-c-empty-state__body"
169-
data-ouia-component-id="NotAuthorized-body"
169+
data-ouia-component-id="UnauthorizedAccess-body"
170170
>
171171
Contact your system administrator(s) for more information.
172172
</div>
173173
<div
174174
class="pf-v6-c-empty-state__footer"
175-
data-ouia-component-id="NotAuthorized-footer"
175+
data-ouia-component-id="UnauthorizedAccess-footer"
176176
>
177177
<a
178178
aria-disabled="false"
179179
class="pf-v6-c-button pf-m-primary"
180-
data-ouia-component-id="NotAuthorized-home-button"
180+
data-ouia-component-id="UnauthorizedAccess-home-button"
181181
data-ouia-component-type="PF6/Button"
182182
data-ouia-safe="true"
183183
href="."
@@ -196,10 +196,10 @@ exports[`NotAuthorized component should render 1`] = `
196196
</div>
197197
`;
198198

199-
exports[`NotAuthorized component should show custom actions 1`] = `
199+
exports[`UnauthorizedAccess component should show custom actions 1`] = `
200200
<div
201201
class="pf-v6-c-empty-state"
202-
data-ouia-component-id="NotAuthorized"
202+
data-ouia-component-id="UnauthorizedAccess"
203203
>
204204
<div
205205
class="pf-v6-c-empty-state__content"
@@ -236,13 +236,13 @@ exports[`NotAuthorized component should show custom actions 1`] = `
236236
</div>
237237
<div
238238
class="pf-v6-c-empty-state__body"
239-
data-ouia-component-id="NotAuthorized-body"
239+
data-ouia-component-id="UnauthorizedAccess-body"
240240
>
241241
Contact your system administrator(s) for more information.
242242
</div>
243243
<div
244244
class="pf-v6-c-empty-state__footer"
245-
data-ouia-component-id="NotAuthorized-footer"
245+
data-ouia-component-id="UnauthorizedAccess-footer"
246246
>
247247
<div
248248
class="pf-v6-c-empty-state__actions"
@@ -276,10 +276,10 @@ exports[`NotAuthorized component should show custom actions 1`] = `
276276
</div>
277277
`;
278278

279-
exports[`NotAuthorized component should show custom body text 1`] = `
279+
exports[`UnauthorizedAccess component should show custom body text 1`] = `
280280
<div
281281
class="pf-v6-c-empty-state"
282-
data-ouia-component-id="NotAuthorized"
282+
data-ouia-component-id="UnauthorizedAccess"
283283
>
284284
<div
285285
class="pf-v6-c-empty-state__content"
@@ -316,18 +316,18 @@ exports[`NotAuthorized component should show custom body text 1`] = `
316316
</div>
317317
<div
318318
class="pf-v6-c-empty-state__body"
319-
data-ouia-component-id="NotAuthorized-body"
319+
data-ouia-component-id="UnauthorizedAccess-body"
320320
>
321321
Some text
322322
</div>
323323
<div
324324
class="pf-v6-c-empty-state__footer"
325-
data-ouia-component-id="NotAuthorized-footer"
325+
data-ouia-component-id="UnauthorizedAccess-footer"
326326
>
327327
<a
328328
aria-disabled="false"
329329
class="pf-v6-c-button pf-m-primary"
330-
data-ouia-component-id="NotAuthorized-home-button"
330+
data-ouia-component-id="UnauthorizedAccess-home-button"
331331
data-ouia-component-type="PF6/Button"
332332
data-ouia-safe="true"
333333
href="."
@@ -346,10 +346,10 @@ exports[`NotAuthorized component should show custom body text 1`] = `
346346
</div>
347347
`;
348348

349-
exports[`NotAuthorized component should show custom title 1`] = `
349+
exports[`UnauthorizedAccess component should show custom title 1`] = `
350350
<div
351351
class="pf-v6-c-empty-state"
352-
data-ouia-component-id="NotAuthorized"
352+
data-ouia-component-id="UnauthorizedAccess"
353353
>
354354
<div
355355
class="pf-v6-c-empty-state__content"
@@ -386,18 +386,18 @@ exports[`NotAuthorized component should show custom title 1`] = `
386386
</div>
387387
<div
388388
class="pf-v6-c-empty-state__body"
389-
data-ouia-component-id="NotAuthorized-body"
389+
data-ouia-component-id="UnauthorizedAccess-body"
390390
>
391391
Contact your system administrator(s) for more information.
392392
</div>
393393
<div
394394
class="pf-v6-c-empty-state__footer"
395-
data-ouia-component-id="NotAuthorized-footer"
395+
data-ouia-component-id="UnauthorizedAccess-footer"
396396
>
397397
<a
398398
aria-disabled="false"
399399
class="pf-v6-c-button pf-m-primary"
400-
data-ouia-component-id="NotAuthorized-home-button"
400+
data-ouia-component-id="UnauthorizedAccess-home-button"
401401
data-ouia-component-type="PF6/Button"
402402
data-ouia-safe="true"
403403
href="."
@@ -416,10 +416,10 @@ exports[`NotAuthorized component should show custom title 1`] = `
416416
</div>
417417
`;
418418

419-
exports[`NotAuthorized component should use custom icon 1`] = `
419+
exports[`UnauthorizedAccess component should use custom icon 1`] = `
420420
<div
421421
class="pf-v6-c-empty-state"
422-
data-ouia-component-id="NotAuthorized"
422+
data-ouia-component-id="UnauthorizedAccess"
423423
>
424424
<div
425425
class="pf-v6-c-empty-state__content"
@@ -456,18 +456,18 @@ exports[`NotAuthorized component should use custom icon 1`] = `
456456
</div>
457457
<div
458458
class="pf-v6-c-empty-state__body"
459-
data-ouia-component-id="NotAuthorized-body"
459+
data-ouia-component-id="UnauthorizedAccess-body"
460460
>
461461
Contact your system administrator(s) for more information.
462462
</div>
463463
<div
464464
class="pf-v6-c-empty-state__footer"
465-
data-ouia-component-id="NotAuthorized-footer"
465+
data-ouia-component-id="UnauthorizedAccess-footer"
466466
>
467467
<a
468468
aria-disabled="false"
469469
class="pf-v6-c-button pf-m-primary"
470-
data-ouia-component-id="NotAuthorized-home-button"
470+
data-ouia-component-id="UnauthorizedAccess-home-button"
471471
data-ouia-component-type="PF6/Button"
472472
data-ouia-safe="true"
473473
href="."
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default } from './UnauthorizedAccess';
2+
export * from './UnauthorizedAccess';

0 commit comments

Comments
 (0)