-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validates resource details page url's params
If url's params(resource name,resource kind name, resource catalog name) of details page is valid then it redirects to details page otherwise to the PageNotFound Signed-off-by: Shiv Verma <shverma@redhat.com>
- Loading branch information
1 parent
f79f0f3
commit 4611685
Showing
9 changed files
with
123 additions
and
24,064 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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,3 @@ | ||
.hub-pagenotfound__title { | ||
margin-top: 1.3em; | ||
} |
This file contains 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,20 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { PageNotFound } from './index'; | ||
|
||
jest.mock('react-router-dom', () => { | ||
return { | ||
useHistory: () => { | ||
return { | ||
history: '' | ||
}; | ||
} | ||
}; | ||
}); | ||
|
||
describe('PageNotFound Component', () => { | ||
it('should render PageNotFound component', () => { | ||
const component = shallow(<PageNotFound />); | ||
expect(component.debug()).toMatchSnapshot(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
ui/src/components/PageNotFound/__snapshots__/PageNotFound.test.tsx.snap
This file contains 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,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`PageNotFound Component should render PageNotFound component 1`] = ` | ||
"<EmptyState variant=\\"small\\"> | ||
<EmptyStateIcon icon={[Function: warningIcon]} /> | ||
<Title headingLevel=\\"h5\\" size=\\"lg\\" className=\\"hub-pagenotfound__title\\"> | ||
Page Not Found | ||
</Title> | ||
<Button variant=\\"primary\\" onClick={[Function: onClick]}> | ||
Back Home | ||
</Button> | ||
</EmptyState>" | ||
`; |
This file contains 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,33 @@ | ||
import React from 'react'; | ||
import { | ||
EmptyState, | ||
EmptyStateVariant, | ||
Title, | ||
Button, | ||
EmptyStateIcon | ||
} from '@patternfly/react-core'; | ||
import { IconSize } from '@patternfly/react-icons'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { Icons } from '../../common/icons'; | ||
import Icon from '../Icon'; | ||
import './PageNotFound.css'; | ||
|
||
export const PageNotFound: React.FC = () => { | ||
const history = useHistory(); | ||
|
||
const warningIcon = () => { | ||
return <Icon id={Icons.WarningTriangle} size={IconSize.xl} label="Page Not Found" />; | ||
}; | ||
|
||
return ( | ||
<EmptyState variant={EmptyStateVariant.small}> | ||
<EmptyStateIcon icon={warningIcon} /> | ||
<Title headingLevel="h5" size="lg" className="hub-pagenotfound__title"> | ||
Page Not Found | ||
</Title> | ||
<Button variant="primary" onClick={() => history.push('/')}> | ||
Back Home | ||
</Button> | ||
</EmptyState> | ||
); | ||
}; |
This file contains 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
This file contains 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