Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React, { type PropsWithChildren } from 'react';
import { Redirect } from 'react-router-dom';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import type { SecurityPageName } from '../../../../common';
import { SecurityPageName } from '../../../../common';
import { useLinkInfo } from '../../links';
import { NoPrivilegesPage } from '../no_privileges';
import { useUpsellingPage } from '../../hooks/use_upselling';
Expand All @@ -26,6 +26,8 @@ type SecurityRoutePageWrapperProps = {
pageName: SecurityPageName;
} & SecurityRoutePageWrapperOptionProps;

const deprectedPagesWithRedirect = [SecurityPageName.detections];

/**
* This component is created to wrap all the pages in the security solution app.
*
Expand Down Expand Up @@ -61,12 +63,13 @@ export const SecurityRoutePageWrapper: React.FC<PropsWithChildren<SecurityRouteP

// Redirect to the home page if the link does not exist in the application links (has been filtered out).
// or if the link is unavailable (payment plan not met, if it had upselling page associated it would have been rendered above).
if (link == null || link.unavailable) {
// Some pages handle their own redirect logic, so we need to exclude them from this check.
if (!deprectedPagesWithRedirect.includes(pageName) && (link == null || link.unavailable)) {
return <Redirect to="" />;
}

// Show the no privileges page if the link is unauthorized.
if (link.unauthorized) {
if (link && link.unauthorized) {
return (
<>
<SpyRoute pageName={pageName} />
Expand Down