Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit883353d

Browse files
committed
Move audit page to /deployment/audit with multi-org
The existing link remains but will redirect to the new URL.
1 parent6c2336b commit883353d

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

‎site/src/modules/dashboard/Navbar/DeploymentDropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
PopoverTrigger,
1111
usePopover,
1212
}from"components/Popover/Popover";
13-
import{USERS_LINK}from"modules/navigation";
13+
import{AUDIT_LINK,USERS_LINK}from"modules/navigation";
1414

1515
interfaceDeploymentDropdownProps{
1616
canViewDeployment:boolean;
@@ -114,7 +114,7 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({
114114
{canViewAllUsers&&(
115115
<MenuItem
116116
component={NavLink}
117-
to={USERS_LINK}
117+
to={canViewOrganizations ?`/deployment${USERS_LINK}` :USERS_LINK}
118118
css={styles.menuItem}
119119
onClick={onPopoverClose}
120120
>
@@ -124,7 +124,7 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({
124124
{canViewAuditLog&&(
125125
<MenuItem
126126
component={NavLink}
127-
to="/audit"
127+
to={canViewOrganizations ?`/deployment${AUDIT_LINK}` :AUDIT_LINK}
128128
css={styles.menuItem}
129129
onClick={onPopoverClose}
130130
>

‎site/src/modules/navigation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
*@fileoverview TODO: centralize navigation code here! URL constants, URL formatting, all of it
33
*/
44

5+
exportconstAUDIT_LINK="/audit";
6+
57
exportconstUSERS_LINK=`/users?filter=${encodeURIComponent(
68
"status:active",
79
)}`;

‎site/src/pages/AuditPage/AuditPage.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
importtype{FC}from"react";
22
import{Helmet}from"react-helmet-async";
3-
import{useSearchParams}from"react-router-dom";
3+
import{useSearchParams,Navigate,useLocation}from"react-router-dom";
44
import{paginatedAudits}from"api/queries/audits";
55
import{useFilter}from"components/Filter/filter";
66
import{useUserFilterMenu}from"components/Filter/UserFilter";
@@ -19,6 +19,8 @@ import { AuditPageView } from "./AuditPageView";
1919
constAuditPage:FC=()=>{
2020
const{audit_log:isAuditLogVisible}=useFeatureVisibility();
2121
const{ experiments}=useDashboard();
22+
constlocation=useLocation();
23+
constisMultiOrg=experiments.includes("multi-organization");
2224

2325
/**
2426
* There is an implicit link between auditsQuery and filter via the
@@ -70,6 +72,13 @@ const AuditPage: FC = () => {
7072
}),
7173
});
7274

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<Navigateto={`/deployment/audit${location.search}`}replace/>;
80+
}
81+
7382
return(
7483
<>
7584
<Helmet>
@@ -82,17 +91,15 @@ const AuditPage: FC = () => {
8291
isAuditLogVisible={isAuditLogVisible}
8392
auditsQuery={auditsQuery}
8493
error={auditsQuery.error}
85-
showOrgDetails={experiments.includes("multi-organization")}
94+
showOrgDetails={isMultiOrg}
8695
filterProps={{
8796
filter,
8897
error:auditsQuery.error,
8998
menus:{
9099
user:userMenu,
91100
action:actionMenu,
92101
resourceType:resourceTypeMenu,
93-
organization:experiments.includes("multi-organization")
94-
?organizationsMenu
95-
:undefined,
102+
organization:isMultiOrg ?organizationsMenu :undefined,
96103
},
97104
}}
98105
/>

‎site/src/pages/AuditPage/AuditPageView.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,16 @@ export const AuditPageView: FC<AuditPageViewProps> = ({
5757
constisEmpty=!isLoading&&auditLogs?.length===0;
5858

5959
return(
60-
<Margins>
61-
<PageHeader>
60+
<Marginscss={{
61+
// When acting as a deployment settings page, there is already padding.
62+
// TODO: When multi-org is stable we should move this to the deployment
63+
// settings dir, use the standard header, and remove these margins.
64+
padding:showOrgDetails ?0 :undefined,
65+
}}>
66+
<PageHeadercss={{
67+
// When acting as a deployment settings page, there is already padding.
68+
paddingTop:showOrgDetails ?0 :undefined,
69+
}}>
6270
<PageHeaderTitle>
6371
<Stackdirection="row"spacing={1}alignItems="center">
6472
<span>{Language.title}</span>

‎site/src/pages/ManagementSettingsPage/Sidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar";
99
import{Stack}from"components/Stack/Stack";
1010
import{UserAvatar}from"components/UserAvatar/UserAvatar";
1111
import{typeClassName,useClassName}from"hooks/useClassName";
12-
import{USERS_LINK}from"modules/navigation";
12+
import{AUDIT_LINK,USERS_LINK}from"modules/navigation";
1313
import{useOrganizationSettings}from"./ManagementSettingsLayout";
1414

1515
exportconstSidebar:FC=()=>{
@@ -81,6 +81,9 @@ const DeploymentSettingsNavigation: FC = () => {
8181
<SidebarNavSubItemhref={USERS_LINK.slice(1)}>
8282
Users
8383
</SidebarNavSubItem>
84+
<SidebarNavSubItemhref={AUDIT_LINK.slice(1)}>
85+
Auditing
86+
</SidebarNavSubItem>
8487
</Stack>
8588
)}
8689
</div>

‎site/src/router.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ export const router = createBrowserRouter(
409409
<Routepath="workspace-proxies"element={<WorkspaceProxyPage/>}/>
410410
<Routepath="users"element={<UsersPage/>}/>
411411
<Routepath="users/create"element={<CreateUserPage/>}/>
412+
<Routepath="audit"element={<AuditPage/>}/>
412413
</Route>
413414

414415
<Routepath="/settings"element={<UserSettingsLayout/>}>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp