[AI4DSOC] Redirect from Entity Analytics pages on lower tiers (#218416)

This commit is contained in:
Tomasz Ciecierski 2025-04-22 11:14:37 +02:00 committed by GitHub
parent ea855c8dba
commit fe31818a3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,12 +6,10 @@
*/
import React from 'react';
import { Route, Routes } from '@kbn/shared-ux-router';
import { Redirect } from 'react-router-dom';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
import { SpyRoute } from '../common/utils/route/spy_routes';
import { NotFoundPage } from '../app/404';
import { withSecurityRoutePageWrapper } from '../common/components/security_route_page_wrapper';
import {
ENTITY_ANALYTICS_ASSET_CRITICALITY_PATH,
ENTITY_ANALYTICS_ENTITY_STORE_MANAGEMENT_PATH,
@ -26,12 +24,9 @@ import { EntityStoreManagementPage } from './pages/entity_store_management_page'
import { EntityAnalyticsLandingPage } from './pages/entity_analytics_landing';
import { EntityAnalyticsPrivilegedUserMonitoringPage } from './pages/entity_analytics_privileged_user_monitoring_page';
const EntityAnalyticsManagementTelemetry = () => (
const EntityAnalyticsManagementWrapper = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.entityAnalyticsManagement}>
<EntityAnalyticsManagementPage />
<SpyRoute pageName={SecurityPageName.entityAnalyticsManagement} />
</TrackApplicationView>
<EntityAnalyticsManagementPage />
</PluginTemplateWrapper>
);
@ -41,7 +36,7 @@ const EntityAnalyticsManagementContainer: React.FC = React.memo(() => {
<Route
path={ENTITY_ANALYTICS_MANAGEMENT_PATH}
exact
component={EntityAnalyticsManagementTelemetry}
component={EntityAnalyticsManagementWrapper}
/>
<Route component={NotFoundPage} />
</Routes>
@ -49,22 +44,21 @@ const EntityAnalyticsManagementContainer: React.FC = React.memo(() => {
});
EntityAnalyticsManagementContainer.displayName = 'EntityAnalyticsManagementContainer';
const EntityAnalyticsAssetClassificationTelemetry = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.entityAnalyticsAssetClassification}>
<EntityStoreManagementPage />
<SpyRoute pageName={SecurityPageName.entityAnalyticsAssetClassification} />
</TrackApplicationView>
</PluginTemplateWrapper>
);
const EntityAnalyticsAssetClassificationContainer: React.FC = React.memo(() => {
return (
<Routes>
<Route
path={ENTITY_ANALYTICS_ASSET_CRITICALITY_PATH}
exact
component={EntityAnalyticsAssetClassificationTelemetry}
render={({ location }) => (
<Redirect
to={{
...location,
pathname: ENTITY_ANALYTICS_ENTITY_STORE_MANAGEMENT_PATH,
search: location.search,
}}
/>
)}
/>
<Route component={NotFoundPage} />
</Routes>
@ -74,12 +68,9 @@ const EntityAnalyticsAssetClassificationContainer: React.FC = React.memo(() => {
EntityAnalyticsAssetClassificationContainer.displayName =
'EntityAnalyticsAssetClassificationContainer';
const EntityAnalyticsEntityStoreTelemetry = () => (
const EntityAnalyticsEntityStoreWrapper = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.entityAnalyticsEntityStoreManagement}>
<EntityStoreManagementPage />
<SpyRoute pageName={SecurityPageName.entityAnalyticsEntityStoreManagement} />
</TrackApplicationView>
<EntityStoreManagementPage />
</PluginTemplateWrapper>
);
@ -89,7 +80,7 @@ const EntityAnalyticsEntityStoreContainer: React.FC = React.memo(() => {
<Route
path={ENTITY_ANALYTICS_ENTITY_STORE_MANAGEMENT_PATH}
exact
component={EntityAnalyticsEntityStoreTelemetry}
component={EntityAnalyticsEntityStoreWrapper}
/>
<Route component={NotFoundPage} />
</Routes>
@ -98,23 +89,16 @@ const EntityAnalyticsEntityStoreContainer: React.FC = React.memo(() => {
EntityAnalyticsEntityStoreContainer.displayName = 'EntityAnalyticsEntityStoreContainer';
const EntityAnalyticsLandingTelemetry = () => (
const EntityAnalyticsLandingWrapper = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.entityAnalyticsLanding}>
<EntityAnalyticsLandingPage />
<SpyRoute pageName={SecurityPageName.entityAnalyticsLanding} />
</TrackApplicationView>
<EntityAnalyticsLandingPage />
</PluginTemplateWrapper>
);
const EntityAnalyticsLandingContainer: React.FC = React.memo(() => {
return (
<Routes>
<Route
path={ENTITY_ANALYTICS_LANDING_PATH}
exact
component={EntityAnalyticsLandingTelemetry}
/>
<Route path={ENTITY_ANALYTICS_LANDING_PATH} exact component={EntityAnalyticsLandingWrapper} />
<Route component={NotFoundPage} />
</Routes>
);
@ -122,12 +106,9 @@ const EntityAnalyticsLandingContainer: React.FC = React.memo(() => {
EntityAnalyticsLandingContainer.displayName = 'EntityAnalyticsLandingContainer';
const EntityAnalyticsPrivilegedUserMonitoringTelemetry = () => (
const EntityAnalyticsPrivilegedUserMonitoringWrapper = () => (
<PluginTemplateWrapper>
<TrackApplicationView viewId={SecurityPageName.privilegedUserMonitoring}>
<EntityAnalyticsPrivilegedUserMonitoringPage />
<SpyRoute pageName={SecurityPageName.privilegedUserMonitoring} />
</TrackApplicationView>
<EntityAnalyticsPrivilegedUserMonitoringPage />
</PluginTemplateWrapper>
);
@ -137,7 +118,7 @@ const EntityAnalyticsPrivilegedUserMonitoringContainer: React.FC = React.memo(()
<Route
path={ENTITY_ANALYTICS_PRIVILEGED_USER_MONITORING_PATH}
exact
component={EntityAnalyticsPrivilegedUserMonitoringTelemetry}
component={EntityAnalyticsPrivilegedUserMonitoringWrapper}
/>
<Route component={NotFoundPage} />
</Routes>
@ -150,7 +131,13 @@ EntityAnalyticsPrivilegedUserMonitoringContainer.displayName =
export const routes = [
{
path: ENTITY_ANALYTICS_MANAGEMENT_PATH,
component: EntityAnalyticsManagementContainer,
component: withSecurityRoutePageWrapper(
EntityAnalyticsManagementContainer,
SecurityPageName.entityAnalyticsManagement,
{
redirectOnMissing: true,
}
),
},
{
path: ENTITY_ANALYTICS_ASSET_CRITICALITY_PATH,
@ -158,14 +145,32 @@ export const routes = [
},
{
path: ENTITY_ANALYTICS_ENTITY_STORE_MANAGEMENT_PATH,
component: EntityAnalyticsEntityStoreContainer,
component: withSecurityRoutePageWrapper(
EntityAnalyticsEntityStoreContainer,
SecurityPageName.entityAnalyticsEntityStoreManagement,
{
redirectOnMissing: true,
}
),
},
{
path: ENTITY_ANALYTICS_LANDING_PATH,
component: EntityAnalyticsLandingContainer,
component: withSecurityRoutePageWrapper(
EntityAnalyticsLandingContainer,
SecurityPageName.entityAnalyticsLanding,
{
redirectOnMissing: true,
}
),
},
{
path: ENTITY_ANALYTICS_PRIVILEGED_USER_MONITORING_PATH,
component: EntityAnalyticsPrivilegedUserMonitoringContainer,
component: withSecurityRoutePageWrapper(
EntityAnalyticsPrivilegedUserMonitoringContainer,
SecurityPageName.privilegedUserMonitoring,
{
redirectOnMissing: true,
}
),
},
];