-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Add Maintenance component #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f2e30f3
RHCLOUD-33366 Add Maintenance component plus tests and examples
aferd 6ea84de
text fix
aferd eda0c64
remove snapshots
aferd 9c526ce
add custom footer and body text
aferd 1240b0c
fix redirectUrl and custom example
aferd f8dd98e
adjust cypress test
aferd 7cde498
Update packages/module/src/Maintenance/Maintenance.tsx
fhlavac 2be7ff5
feat(Maintenance): Update cypress/component/Maintenance.cy.tsx
fhlavac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import React from 'react'; | ||
| import Maintenance from '../../packages/module/dist/dynamic/Maintenance'; | ||
|
|
||
| describe('Maintenance', () => { | ||
| it('renders Maintenance', () => { | ||
| cy.mount(<Maintenance />) | ||
| cy.get('[data-ouia-component-id="Maintenance"]').should('exist'); | ||
| cy.get('[data-ouia-component-id="Maintenance"]').contains('Maintenance in progress'); | ||
| cy.get('[data-ouia-component-id="Maintenance-body"]').contains('We are currently undergoing scheduled maintenance and will be unavailable from 10am to 12am UTC (6am-8am EST). For more information please visit status.redhat.com.'); | ||
| }); | ||
| }); | ||
29 changes: 29 additions & 0 deletions
29
...ly-docs/content/extensions/component-groups/examples/Maintenance/Maintenance.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| # Sidenav top-level section | ||
| # should be the same for all markdown files | ||
| section: Component groups | ||
| subsection: Error communication | ||
| # Sidenav secondary level section | ||
| # should be the same for all markdown files | ||
| id: Maintenance | ||
| # Tab (react | react-demos | html | html-demos | design-guidelines | accessibility) | ||
| source: react | ||
| # If you use typescript, the name of the interface to display props for | ||
| # These are found through the sourceProps function provided in patternfly-docs.source.js | ||
| propComponents: ['Maintenance'] | ||
| sourceLink: https://github.com/patternfly/react-component-groups/blob/main/packages/module/patternfly-docs/content/extensions/component-groups/examples/Maintenance/Maintenance.md | ||
| --- | ||
|
|
||
| import Maintenance from '@patternfly/react-component-groups/dist/dynamic/Maintenance'; | ||
|
|
||
| A **maintenance** component displays a screen to users when they are undergoing scheduled maintenance. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Basic maintenance | ||
|
|
||
| A basic maintenance component provides users with information regarding scheduled maintenance. | ||
|
|
||
| ```js file="./MaintenanceExample.tsx" | ||
|
|
||
| ``` |
6 changes: 6 additions & 0 deletions
6
...nfly-docs/content/extensions/component-groups/examples/Maintenance/MaintenanceExample.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import React from 'react'; | ||
| import Maintenance from '@patternfly/react-component-groups/dist/dynamic/Maintenance' | ||
|
|
||
| export const BasicExample: React.FunctionComponent = () => ( | ||
| <Maintenance utcStartTime='10am' utcEndTime='12am' startTime='6am' endTime='8am' timeZone='EST' /> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import React from 'react'; | ||
| import { Button, EmptyState, EmptyStateBody, EmptyStateProps, EmptyStateStatus, EmptyStateVariant } from '@patternfly/react-core'; | ||
| import { HourglassHalfIcon } from '@patternfly/react-icons'; | ||
|
|
||
| /** extends EmptyStateProps */ | ||
| export interface MaintenanceProps extends Omit<EmptyStateProps, 'children' | 'title'> { | ||
| /** The title for the maintenance message */ | ||
| titleText?: string; | ||
| /** start time for maintenance UTC */ | ||
| utcStartTime?: string; | ||
| /** end time for maintenance UTC */ | ||
| utcEndTime?: string; | ||
| /** start time in a specific time zone */ | ||
| startTime?: string; | ||
| /** end time in a specific time zone */ | ||
| endTime?: string; | ||
| /** specify time zone */ | ||
| timeZone?: string; | ||
| /** Information link */ | ||
| redirectUrl?: string; | ||
| /** Information link title */ | ||
| redirectUrlLinkText?: string; | ||
| /** Custom OUIA ID */ | ||
| ouiaId?: string | number; } | ||
|
|
||
| const Maintenance: React.FunctionComponent<MaintenanceProps> = ({ | ||
| titleText = 'Maintenance in progress', | ||
| utcStartTime, | ||
| utcEndTime, | ||
| startTime, | ||
| endTime, | ||
| timeZone, | ||
| redirectUrl = 'https://status.redhat.com', | ||
| redirectUrlLinkText = 'status.redhat.com', | ||
| ouiaId = 'Maintenance', | ||
| ...props | ||
| }: MaintenanceProps) => ( | ||
| <EmptyState headingLevel="h5" status={EmptyStateStatus.danger} icon={HourglassHalfIcon} titleText={titleText} variant={EmptyStateVariant.lg} data-ouia-component-id={ouiaId} {...props}> | ||
| <EmptyStateBody data-ouia-component-id={`${ouiaId}-body`}> | ||
| We are currently undergoing scheduled maintenance and will be unavailable from {utcStartTime} to {utcEndTime} UTC ({startTime}-{endTime} {timeZone}). | ||
aferd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| For more information please visit {' '} | ||
| <Button variant='link' component='span' isInline href={redirectUrl} target="_blank" ouiaId={`${ouiaId}-link`}> | ||
aferd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {redirectUrlLinkText}. | ||
| </Button> | ||
| </EmptyStateBody> | ||
| </EmptyState> | ||
| ); | ||
|
|
||
| export default Maintenance; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default } from './Maintenance'; | ||
| export * from './Maintenance'; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.