Skip to content

Commit 815f692

Browse files
authored
Merge pull request supabase#17526 from supabase/fix/logs-behind-flag
Put the account audit logs page behind a feature flag
2 parents 923fba2 + fb56bea commit 815f692

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

studio/components/layouts/AccountLayout/AccountLayout.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
2828
const ongoingIncident = useFlag('ongoingIncident')
2929
const navLayoutV2 = useFlag('navigationLayoutV2')
3030
const mfaSetup = useFlag('mfaSetup')
31+
const showAuditLogs = useFlag('auditLogs')
3132
const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
3233

3334
const signOut = useSignOut()
@@ -101,13 +102,17 @@ const AccountLayout = ({ children, title, breadcrumbs }: PropsWithChildren<Accou
101102
},
102103
]
103104
: []),
104-
{
105-
isActive: router.pathname === `/account/audit`,
106-
icon: `${router.basePath}/img/user.svg`,
107-
label: 'Audit Logs',
108-
href: `/account/audit`,
109-
key: `/account/audit`,
110-
},
105+
...(showAuditLogs
106+
? [
107+
{
108+
isActive: router.pathname === `/account/audit`,
109+
icon: `${router.basePath}/img/user.svg`,
110+
label: 'Audit Logs',
111+
href: `/account/audit`,
112+
key: `/account/audit`,
113+
},
114+
]
115+
: []),
111116
],
112117
},
113118
]

studio/components/layouts/AppLayout/UserSettingsDropdown.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from 'ui'
1717

1818
import { useTheme } from 'common'
19+
import { useFlag } from 'hooks'
1920
import { useSignOut } from 'lib/auth'
2021
import { useProfile } from 'lib/profile'
2122
import { useState } from 'react'
@@ -25,6 +26,7 @@ const UserSettingsDropdown = () => {
2526
const router = useRouter()
2627
const [open, setOpen] = useState(false)
2728
const { profile } = useProfile()
29+
const showAuditLogs = useFlag('auditLogs')
2830
const { setIsOpen: setCommandMenuOpen } = useCommandMenu()
2931
const { isDarkMode, toggleTheme } = useTheme()
3032

@@ -71,15 +73,17 @@ const UserSettingsDropdown = () => {
7173
<a>Access tokens</a>
7274
</DropdownMenuItem_Shadcn_>
7375
</Link>
74-
<Link passHref href="/account/audit">
75-
<DropdownMenuItem_Shadcn_
76-
className="cursor-pointer"
77-
onClick={() => setOpen(false)}
78-
asChild
79-
>
80-
<a>Audit logs</a>
81-
</DropdownMenuItem_Shadcn_>
82-
</Link>
76+
{showAuditLogs ? (
77+
<Link passHref href="/account/audit">
78+
<DropdownMenuItem_Shadcn_
79+
className="cursor-pointer"
80+
onClick={() => setOpen(false)}
81+
asChild
82+
>
83+
<a>Audit logs</a>
84+
</DropdownMenuItem_Shadcn_>
85+
</Link>
86+
) : null}
8387
<DropdownMenuSeparator_Shadcn_ />
8488
<DropdownMenuItem_Shadcn_
8589
className="cursor-pointer"

studio/components/layouts/SettingsLayout/AccountSettingsMenu.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
import { useFlag } from 'hooks'
2+
import { compact } from 'lodash'
13
import { useRouter } from 'next/router'
24
import SettingsMenuItem from './SettingsMenuItem'
35

46
const AccountSettingsMenu = () => {
57
const router = useRouter()
6-
const accountSettings = [
8+
const mfaSetup = useFlag('mfaSetup')
9+
const showAuditLogs = useFlag('auditLogs')
10+
const accountSettings = compact([
711
{ label: 'Preferences', pathname: `/account/me` },
812
{ label: 'Access Tokens', pathname: `/account/tokens` },
9-
{ label: 'Security', pathname: `/account/security` },
10-
{ label: 'Audit logs', pathname: `/account/audit` },
11-
]
13+
mfaSetup ? { label: 'Security', pathname: `/account/security` } : null,
14+
showAuditLogs ? { label: 'Audit logs', pathname: `/account/audit` } : null,
15+
])
1216

1317
return (
1418
<div className="space-y-10">

0 commit comments

Comments
 (0)