Add feature flag for unified logs

This commit is contained in:
Joshen Lim committed 2025-06-10 19:58:08 +08:00
1 parent 79f558af55
commit 243b9ab23f
2 files changed
+19 -8

No files matched your search

@@ -223,6 +223,7 @@ const ProjectLinks = () => {
const { securityLints, errorLints } = useLints()
const showWarehouse = useFlag('warehouse')
const showUnifiedLogs = useFlag('unifiedLogs')
const isSqlEditorTabsEnabled = useIsSQLEditorTabsEnabled()
const activeRoute = router.pathname.split('/')[3]
@@ -248,7 +249,7 @@ const ProjectLinks = () => {
storage: storageEnabled,
realtime: realtimeEnabled,
})
const otherRoutes = generateOtherRoutes(ref, project)
const otherRoutes = generateOtherRoutes(ref, project, { unifiedLogs: showUnifiedLogs })
const settingsRoutes = generateSettingsRoutes(ref, project)
return (
@@ -122,10 +122,16 @@ export const generateProductRoutes = (
]
}
export const generateOtherRoutes = (ref?: string, project?: Project): Route[] => {
export const generateOtherRoutes = (
ref?: string,
project?: Project,
features?: { unifiedLogs?: boolean }
): Route[] => {
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
const buildingUrl = `/project/${ref}`
const showUnifiedLogs = features?.unifiedLogs ?? false
return [
{
key: 'advisors',
@@ -149,12 +155,16 @@ export const generateOtherRoutes = (ref?: string, project?: Project): Route[] =>
icon: <List size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/logs`),
},
{
key: 'unified-logs',
label: 'Unified Logs',
icon: <Logs size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/unified-logs`),
},
...(showUnifiedLogs
? [
{
key: 'unified-logs',
label: 'Unified Logs',
icon: <Logs size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/unified-logs`),
},
]
: []),
{
key: 'api',
label: 'API Docs',