8000 feat(ui): enhance not-found page by TheNando · Pull Request #1379 · SpecterOps/BloodHound · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(ui): enhance not-found page #1379

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 2 commits into from
Apr 22, 2025
Merged

feat(ui): enhance not-found page #1379

merged 2 commits into from
Apr 22, 2025

Conversation

TheNando
Copy link
Contributor

Description

Update NotFound page to clearly state 404 status and to redirect to login if unauthenticated.

Motivation and Context

Resolves BED-5326

How Has This Been Tested?

Manually tested. Visited bad routes while authenticated and again while unauthenticated.

ex. http://bloodhound.localhost/ui/not-a-route

Screenshots:

Before
image

After
image

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

@TheNando TheNando added enhancement New feature or request user interface A pull request containing changes affecting the UI code. labels Apr 18, 2025
@TheNando TheNando self-assigned this Apr 18, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mimicked the layout from the DisabledUser page, for consistency.

@catsiller
Copy link

looks wise - much better!

Comment on lines +31 to +36
useEffect(() => {
if (isFullyAuthenticated) {
return;
}

navigate(ROUTE_LOGIN);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works and make sense but was curious as to that vs

useEffect(() => {
        if (!isFullyAuthenticated) {
            navigate(ROUTE_LOGIN);
        }
 }, [isFullyAuthenticated, navigate]);

is there a benefit or consideration in having the positive conditional return ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This referred to as the "exit early" pattern. There are typically many benefits to which objectively improve code quality. You can read about it here. However, in this case, there is not much reason to pick this over your option than habit and consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for that article, read and bookmarked :)

Comment on lines 41 to 63
<Grid container spacing={4} justifyContent='center'>
<Grid item xs={12}>
<Alert severity='warning'>
<AlertTitle>404 - Page not found</AlertTitle>
There is no page associated with this route. Please contact your system administrator for
assistance.
</Alert>
</Grid>
<Grid item xs={12}>
<Box mt={2}>
<Button
=> {
navigate(ROUTE_EXPLORE);
}}
data-testid='page-not-found-go-to-explore'
size='large'
type='button'
className='w-full'>
Go to Explore
</Button>
</Box>
</Grid>
</Grid>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

( What we spoke about yesterday but figured I would add here just in case ) Not a showstopper, but could we maybe consider changing Box and Grid components to just the html tags with TW? We are trying to get some MUI components out of the codebase as we go.

@specter-flq
Copy link
Contributor

Works and looks great! Good idea on mimicking the existing one! just a couple of comments and a curiosity question.

@TheNando TheNando force-pushed the BED-5326--not-found-page branch from 5eb092b to 7aebe6e Compare April 22, 2025 16:45
@TheNando TheNando merged commit b7cddfc into main Apr 22, 2025
8 checks passed
@TheNando TheNando deleted the BED-5326--not-found-page branch April 22, 2025 18:53
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request user interface A pull request containing changes affecting the UI code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0