diff --git a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx index c321490e436..83e3e51a1ac 100644 --- a/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx +++ b/apps/studio/components/layouts/LogsLayout/LogsSidebarMenuV2.tsx @@ -1,5 +1,4 @@ -import { PermissionAction } from '@supabase/shared-types/out/constants' -import { ChevronRight, CircleHelpIcon, FilePlus, Plus } from 'lucide-react' +import { ChevronRight, CircleHelpIcon, Plus } from 'lucide-react' import Link from 'next/link' import { useRouter } from 'next/router' import { useState } from 'react' @@ -13,13 +12,14 @@ import SavedQueriesItem from 'components/interfaces/Settings/Logs/Logs.SavedQuer import { LogsSidebarItem } from 'components/interfaces/Settings/Logs/SidebarV2/SidebarItem' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { useContentQuery } from 'data/content/content-query' -import { useCheckPermissions } from 'hooks/misc/useCheckPermissions' +import { useReplicationSourcesQuery } from 'data/replication/sources-query' import { useCurrentOrgPlan } from 'hooks/misc/useCurrentOrgPlan' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import { useFlag } from 'hooks/ui/useFlag' import { Badge, Button, + cn, Collapsible_Shadcn_, CollapsibleContent_Shadcn_, CollapsibleTrigger_Shadcn_, @@ -33,7 +33,6 @@ import { } from 'ui-patterns/InnerSideMenu' import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' import { FeaturePreviewSidebarPanel } from '../../ui/FeaturePreviewSidebarPanel' -import { useReplicationSourcesQuery } from 'data/replication/sources-query' const SupaIcon = ({ className }: { className?: string }) => { return ( @@ -90,7 +89,15 @@ export function LogsSidebarMenuV2() { projectAuthAll: authEnabled, projectStorageAll: storageEnabled, realtimeAll: realtimeEnabled, - } = useIsFeatureEnabled(['project_storage:all', 'project_auth:all', 'realtime:all']) + logsTemplates: templatesEnabled, + logsCollections: collectionsEnabled, + } = useIsFeatureEnabled([ + 'project_storage:all', + 'project_auth:all', + 'realtime:all', + 'logs:templates', + 'logs:collections', + ]) const enablePgReplicate = useFlag('enablePgReplicate') const { data: etlData, isLoading: isETLLoading } = useReplicationSourcesQuery( @@ -227,7 +234,7 @@ export function LogsSidebarMenuV2() { return (
- {IS_PLATFORM && ( + {IS_PLATFORM && !isUnifiedLogsPreviewAvailable && ( Coming soon} @@ -272,7 +279,12 @@ export function LogsSidebarMenuV2() { /> )} -
+
router.push(`/project/${ref}/logs/explorer`)} />
-
- - Templates - -
- - - - {filteredLogs.map((collection) => { - const isItemActive = isActive(collection.url) - return ( - } - label={collection.name} - /> - ) - })} - - {OPERATIONAL_COLLECTIONS.length > 0 && ( - <> - - - {filteredOperationalLogs.map((collection) => ( - } - label={collection.name} - /> - ))} - - + {templatesEnabled && ( +
+ + Templates + +
)} + + {collectionsEnabled && ( + <> + + {filteredLogs.map((collection) => { + const isItemActive = isActive(collection.url) + return ( + } + label={collection.name} + /> + ) + })} + + {OPERATIONAL_COLLECTIONS.length > 0 && ( + <> + + + {filteredOperationalLogs.map((collection) => ( + } + label={collection.name} + /> + ))} + + + )} + + + )} {savedQueriesLoading && (
diff --git a/apps/studio/components/ui/UnknownInterface.tsx b/apps/studio/components/ui/UnknownInterface.tsx new file mode 100644 index 00000000000..d53ef6c7aaf --- /dev/null +++ b/apps/studio/components/ui/UnknownInterface.tsx @@ -0,0 +1,21 @@ +import Link from 'next/link' + +import { Button } from 'ui' +import { Admonition } from 'ui-patterns' + +export const UnknownInterface = ({ urlBack }: { urlBack: string }) => { + return ( +
+ + + +
+ ) +} diff --git a/apps/studio/pages/project/[ref]/logs/explorer/templates.tsx b/apps/studio/pages/project/[ref]/logs/explorer/templates.tsx index 491604e25d3..9c93527c570 100644 --- a/apps/studio/pages/project/[ref]/logs/explorer/templates.tsx +++ b/apps/studio/pages/project/[ref]/logs/explorer/templates.tsx @@ -1,18 +1,25 @@ import { useParams } from 'common' import { CodeIcon } from 'lucide-react' import { useState } from 'react' -import { Button, Popover, cn } from 'ui' import { TEMPLATES } from 'components/interfaces/Settings/Logs/Logs.constants' import type { LogTemplate } from 'components/interfaces/Settings/Logs/Logs.types' +import DefaultLayout from 'components/layouts/DefaultLayout' import LogsLayout from 'components/layouts/LogsLayout/LogsLayout' import CardButton from 'components/ui/CardButton' import LogsExplorerHeader from 'components/ui/Logs/LogsExplorerHeader' +import { UnknownInterface } from 'components/ui/UnknownInterface' +import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import type { NextPageWithLayout } from 'types' -import DefaultLayout from 'components/layouts/DefaultLayout' +import { Button, Popover, cn } from 'ui' export const LogsTemplatesPage: NextPageWithLayout = () => { const { ref: projectRef } = useParams() + const isTemplatesEnabled = useIsFeatureEnabled('logs:templates') + + if (!isTemplatesEnabled) { + return + } return (
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json index 523eda6e323..7e89886356f 100644 --- a/packages/common/enabled-features/enabled-features.json +++ b/packages/common/enabled-features/enabled-features.json @@ -1,6 +1,9 @@ { "$schema": "./enabled-features.schema.json", + "logs:templates": true, + "logs:collections": true, + "profile:show_email": true, "profile:update": true } diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json index bef56000407..1d3ffa384d4 100644 --- a/packages/common/enabled-features/enabled-features.schema.json +++ b/packages/common/enabled-features/enabled-features.schema.json @@ -6,6 +6,15 @@ "type": "string" }, + "logs:templates": { + "type": "boolean", + "description": "Enable the logs templates page" + }, + "logs:collections": { + "type": "boolean", + "description": "Enable the logs collections page" + }, + "profile:show_email": { "type": "boolean", "description": "Show the user's email address in the toolbar" @@ -15,6 +24,6 @@ "description": "Allow the user to change their profile information (first name, last name)" } }, - "required": ["profile:show_email", "profile:update"], + "required": ["profile:show_email", "profile:update", "logs:templates", "logs:collections"], "additionalProperties": false }