Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Gate unified logs to team and above (#37260)

Joshen Limba2c83decca2
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
index 0ab0b040922..2578ca33fa2 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx
@@ -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 }
diff --git a/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
index 981d98ad42e..b757cba8f45 100644
--- a/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
+++ b/apps/studio/components/interfaces/App/FeaturePreview/UnifiedLogsPreview.tsx
@@ -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">
diff --git a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx
index b9f02d6b4a0..e29eaa8b793 100644
--- a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx
+++ b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx
@@ -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',