1
1
import type { FC } from "react" ;
2
2
import { Helmet } from "react-helmet-async" ;
3
- import { useSearchParams } from "react-router-dom" ;
3
+ import { useSearchParams , Navigate , useLocation } from "react-router-dom" ;
4
4
import { paginatedAudits } from "api/queries/audits" ;
5
5
import { useFilter } from "components/Filter/filter" ;
6
6
import { useUserFilterMenu } from "components/Filter/UserFilter" ;
@@ -19,6 +19,8 @@ import { AuditPageView } from "./AuditPageView";
19
19
const AuditPage : FC = ( ) => {
20
20
const { audit_log : isAuditLogVisible } = useFeatureVisibility ( ) ;
21
21
const { experiments } = useDashboard ( ) ;
22
+ const location = useLocation ( ) ;
23
+ const isMultiOrg = experiments . includes ( "multi-organization" ) ;
22
24
23
25
/**
24
26
* There is an implicit link between auditsQuery and filter via the
@@ -70,6 +72,13 @@ const AuditPage: FC = () => {
70
72
} ) ,
71
73
} ) ;
72
74
75
+ // TODO: Once multi-org is stable, we can could place this redirect into the
76
+ // router directly, if we still need to maintain it (for users who are
77
+ // typing the old URL manually or have it bookmarked).
78
+ if ( isMultiOrg && location . pathname !== "/deployment/audit" ) {
79
+ return < Navigate to = { `/deployment/audit${ location . search } ` } replace /> ;
80
+ }
81
+
73
82
return (
74
83
< >
75
84
< Helmet >
@@ -82,17 +91,15 @@ const AuditPage: FC = () => {
82
91
isAuditLogVisible = { isAuditLogVisible }
83
92
auditsQuery = { auditsQuery }
84
93
error = { auditsQuery . error }
85
- showOrgDetails = { experiments . includes ( "multi-organization" ) }
94
+ showOrgDetails = { isMultiOrg }
86
95
filterProps = { {
87
96
filter,
88
97
error : auditsQuery . error ,
89
98
menus : {
90
99
user : userMenu ,
91
100
action : actionMenu ,
92
101
resourceType : resourceTypeMenu ,
93
- organization : experiments . includes ( "multi-organization" )
94
- ? organizationsMenu
95
- : undefined ,
102
+ organization : isMultiOrg ? organizationsMenu : undefined ,
96
103
} ,
97
104
} }
98
105
/>
0 commit comments