Gate unified logs to team and above (#37260)

This commit is contained in:
Joshen Lim authored and GitHub committed 2025-07-18 01:08:13 +08:00
1 parent 2abeba548f
commit ba2c83decc
3 files changed
+15 -2

No files matched your search

@@ -11,6 +11,7 @@ import {
} from 'react'
import { FeatureFlagContext, LOCAL_STORAGE_KEYS } from 'common'
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
import { useFlag, useIsRealtimeSettingsFFEnabled } from 'hooks/ui/useFlag'
import { EMPTY_OBJ } from 'lib/void'
import { FEATURE_PREVIEWS } from './FeaturePreview.constants'
@@ -91,8 +92,12 @@ export const useIsInlineEditorEnabled = () => {
}
export const useUnifiedLogsPreview = () => {
const organization = useSelectedOrganization()
const { flags, onUpdateFlag } = useFeaturePreviewContext()
const isEnabled = flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS]
const isTeamsOrEnterprise = ['team', 'enterprise'].includes(organization?.plan.id ?? '')
const isEnabled = isTeamsOrEnterprise && flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS]
const enable = () => onUpdateFlag(LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS, true)
const disable = () => onUpdateFlag(LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS, false)
return { isEnabled, enable, disable }
@@ -19,6 +19,9 @@ export const UnifiedLogsPreview = () => {
Experience our enhanced logs interface with improved filtering, real-time updates, and a
unified view across all your services. Built for better performance and easier debugging.
</p>
<p className="text-foreground-light text-sm mb-4">
This interface will only be available for organizations on the Team plan or above.
</p>
<div className="space-y-2 !mt-4">
<p className="text-sm">Enabling this preview will:</p>
<ul className="list-disc pl-6 text-sm text-foreground-light space-y-1">
@@ -91,7 +91,7 @@ export function LogsSidebarMenuV2() {
const { ref } = useParams() as { ref: string }
const warehouseEnabled = useFlag('warehouse')
const isUnifiedLogsPreviewAvailable = useFlag('unifiedLogs')
const unifiedLogsFlagEnabled = useFlag('unifiedLogs')
const { selectFeaturePreview } = useFeaturePreviewModal()
const { enable: enableUnifiedLogs } = useUnifiedLogsPreview()
@@ -115,6 +115,11 @@ export function LogsSidebarMenuV2() {
const { plan: orgPlan, isLoading: isOrgPlanLoading } = useCurrentOrgPlan()
const isFreePlan = !isOrgPlanLoading && orgPlan?.id === 'free'
const isUnifiedLogsPreviewAvailable =
unifiedLogsFlagEnabled &&
!isOrgPlanLoading &&
['team', 'enterprise'].includes(orgPlan?.id ?? '')
const { data: savedQueriesRes, isLoading: savedQueriesLoading } = useContentQuery({
projectRef: ref,
type: 'log_sql',