diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FunctionsAssistantPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx similarity index 98% rename from apps/studio/components/interfaces/App/FeaturePreview/FunctionsAssistantPreview.tsx rename to apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx index 88da88b7bfc..ca06b2bb376 100644 --- a/apps/studio/components/interfaces/App/FeaturePreview/FunctionsAssistantPreview.tsx +++ b/apps/studio/components/interfaces/App/FeaturePreview/AssistantV2Preview.tsx @@ -5,7 +5,7 @@ import { Markdown } from 'components/interfaces/Markdown' import { BASE_PATH } from 'lib/constants' import { detectOS } from 'lib/helpers' -export const FunctionsAssistantPreview = () => { +export const AssistantV2Preview = () => { const os = detectOS() const { ref } = useParams() diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx index 82e044bc4f9..03ef6fa224f 100644 --- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx +++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx @@ -5,13 +5,13 @@ import { LOCAL_STORAGE_KEYS } from 'lib/constants' import { EMPTY_OBJ } from 'lib/void' import { APISidePanelPreview } from './APISidePanelPreview' import { CLSPreview } from './CLSPreview' -import { FunctionsAssistantPreview } from './FunctionsAssistantPreview' +import { AssistantV2Preview } from './AssistantV2Preview' export const FEATURE_PREVIEWS = [ { - key: LOCAL_STORAGE_KEYS.UI_PREVIEW_FUNCTIONS_ASSISTANT, + key: LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2, name: 'Supabase AI Assistant V2', - content: , + content: , discussionsUrl: undefined, isNew: true, }, @@ -86,7 +86,7 @@ export const useIsColumnLevelPrivilegesEnabled = () => { return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS] } -export const useIsDatabaseFunctionsAssistantEnabled = () => { +export const useIsAssistantV2Enabled = () => { const { flags } = useFeaturePreviewContext() - return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_FUNCTIONS_ASSISTANT] + return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ASSISTANT_V2] } diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx index d5e634d4f63..b5a6e1f732b 100644 --- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx +++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx @@ -17,7 +17,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from 'ui' -import { useIsDatabaseFunctionsAssistantEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' interface FunctionListProps { schema: string @@ -37,7 +37,7 @@ const FunctionList = ({ const router = useRouter() const { project: selectedProject } = useProjectContext() const { setAiAssistantPanel } = useAppStateSnapshot() - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() + const isAssistantV2Enabled = useIsAssistantV2Enabled() const { data: functions } = useDatabaseFunctionsQuery({ projectRef: selectedProject?.ref, diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx index b3c679c7f33..4af5b51edd7 100644 --- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx +++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx @@ -5,7 +5,7 @@ import { Search } from 'lucide-react' import { useRouter } from 'next/router' import { useParams } from 'common' -import { useIsDatabaseFunctionsAssistantEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState' import Table from 'components/to-be-cleaned/Table' @@ -38,7 +38,7 @@ const FunctionsList = ({ const { search } = useParams() const { project } = useProjectContext() const { setAiAssistantPanel } = useAppStateSnapshot() - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() + const isAssistantV2Enabled = useIsAssistantV2Enabled() const { selectedSchema, setSelectedSchema } = useQuerySchemaState() const filterString = search ?? '' diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx index 4999d28409a..a958b2ffcb8 100644 --- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx +++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx @@ -52,7 +52,7 @@ import { cn, } from 'ui' import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal' -import { useIsDatabaseFunctionsAssistantEnabled } from '../App/FeaturePreview/FeaturePreviewContext' +import { useIsAssistantV2Enabled } from '../App/FeaturePreview/FeaturePreviewContext' import { subscriptionHasHipaaAddon } from '../Billing/Subscription/Subscription.utils' import { AiAssistantPanel } from './AiAssistantPanel' import AISchemaSuggestionPopover from './AISchemaSuggestionPopover' @@ -106,7 +106,7 @@ const SQLEditor = () => { const databaseSelectorState = useDatabaseSelectorStateSnapshot() const queryClient = useQueryClient() - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() + const isAssistantV2Enabled = useIsAssistantV2Enabled() const { open } = appSnap.aiAssistantPanel const { mutate: formatQuery } = useFormatQueryMutation() diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx index 38f15ee123d..abf6d206a22 100644 --- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx +++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx @@ -18,13 +18,13 @@ import { FeedbackDropdown } from './FeedbackDropdown' import HelpPopover from './HelpPopover' import NotificationsPopoverV2 from './NotificationsPopoverV2/NotificationsPopover' import AssistantButton from 'components/layouts/AppLayout/AssistantButton' -import { useIsDatabaseFunctionsAssistantEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' const LayoutHeader = ({ customHeaderComponents, breadcrumbs = [], headerBorder = true }: any) => { const { ref: projectRef } = useParams() const selectedProject = useSelectedProject() const selectedOrganization = useSelectedOrganization() - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() + const isAssistantV2Enabled = useIsAssistantV2Enabled() const isBranchingEnabled = selectedProject?.is_branch_enabled === true const { data: subscription } = useOrgSubscriptionQuery({ diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx index 157ca019585..792f39f15c4 100644 --- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx +++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx @@ -9,7 +9,7 @@ import { useState } from 'react' import { useIsAPIDocsSidePanelEnabled, - useIsDatabaseFunctionsAssistantEnabled, + useIsAssistantV2Enabled, } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { useProjectLintsQuery } from 'data/lint/lint-query' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' @@ -72,7 +72,7 @@ const NavigationBar = () => { const navLayoutV2 = useFlag('navigationLayoutV2') const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled() - const isFunctionsAssistantEnabled = useIsDatabaseFunctionsAssistantEnabled() + const isFunctionsAssistantEnabled = useIsAssistantV2Enabled() const [userDropdownOpen, setUserDropdownOpenState] = useState(false) const [allowNavPanelToExpand] = useLocalStorageQuery( diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx index 706f1b38e02..f80ce827ff3 100644 --- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx +++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx @@ -33,7 +33,7 @@ import { UpgradingState } from './UpgradingState' import { ResizingState } from './ResizingState' import { AiAssistantPanel } from 'components/ui/AIAssistantPanel/AIAssistantPanel' import { useAppStateSnapshot } from 'state/app-state' -import { useIsDatabaseFunctionsAssistantEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' // [Joshen] This is temporary while we unblock users from managing their project // if their project is not responding well for any reason. Eventually needs a bit of an overhaul @@ -92,7 +92,7 @@ const ProjectLayout = ({ const { open } = aiAssistantPanel const navLayoutV2 = useFlag('navigationLayoutV2') - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() + const isAssistantV2Enabled = useIsAssistantV2Enabled() const projectName = selectedProject?.name const organizationName = selectedOrganization?.name diff --git a/apps/studio/lib/constants/index.ts b/apps/studio/lib/constants/index.ts index 1004802f502..e2bf0d3c78e 100644 --- a/apps/studio/lib/constants/index.ts +++ b/apps/studio/lib/constants/index.ts @@ -33,7 +33,7 @@ export const LOCAL_STORAGE_KEYS = { UI_PREVIEW_NAVIGATION_LAYOUT: 'supabase-ui-preview-nav-layout', UI_PREVIEW_API_SIDE_PANEL: 'supabase-ui-api-side-panel', UI_PREVIEW_CLS: 'supabase-ui-cls', - UI_PREVIEW_FUNCTIONS_ASSISTANT: 'supabase-ui-functions-assistant', + UI_PREVIEW_ASSISTANT_V2: 'supabase-ui-assistant-v2', UI_ONBOARDING_NEW_PAGE_SHOWN: 'supabase-ui-onboarding-new-page-shown', SQL_SCRATCH_PAD_BANNER_ACKNOWLEDGED: 'supabase-sql-scratch-pad-banner-acknowledged', diff --git a/apps/studio/pages/project/[ref]/auth/policies.tsx b/apps/studio/pages/project/[ref]/auth/policies.tsx index 80dc8d97269..9c0a00a87c4 100644 --- a/apps/studio/pages/project/[ref]/auth/policies.tsx +++ b/apps/studio/pages/project/[ref]/auth/policies.tsx @@ -1,14 +1,16 @@ import type { PostgresPolicy, PostgresTable } from '@supabase/postgres-meta' import { PermissionAction } from '@supabase/shared-types/out/constants' import { partition } from 'lodash' -import { ExternalLink, Search } from 'lucide-react' +import { Search } from 'lucide-react' import { useState } from 'react' +import { useIsAssistantV2Enabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { AIPolicyEditorPanel } from 'components/interfaces/Auth/Policies/AIPolicyEditorPanel' import Policies from 'components/interfaces/Auth/Policies/Policies' import AuthLayout from 'components/layouts/AuthLayout/AuthLayout' import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import AlertError from 'components/ui/AlertError' +import { DocsButton } from 'components/ui/DocsButton' import NoPermission from 'components/ui/NoPermission' import SchemaSelector from 'components/ui/SchemaSelector' import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' @@ -18,11 +20,9 @@ import { useTablesQuery } from 'data/tables/tables-query' import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions' import { useUrlState } from 'hooks/ui/useUrlState' import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas' -import type { NextPageWithLayout } from 'types' -import { Button, Input } from 'ui' -import { DocsButton } from 'components/ui/DocsButton' import { useAppStateSnapshot } from 'state/app-state' -import { useIsDatabaseFunctionsAssistantEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import type { NextPageWithLayout } from 'types' +import { Input } from 'ui' /** * Filter tables by table name and policy name @@ -66,8 +66,8 @@ const AuthPoliciesPage: NextPageWithLayout = () => { }>() const { schema = 'public', search: searchString = '' } = params const { project } = useProjectContext() - const isAssistantV2Enabled = useIsDatabaseFunctionsAssistantEnabled() - const { setAiAssistantPanel, aiAssistantPanel } = useAppStateSnapshot() + const isAssistantV2Enabled = useIsAssistantV2Enabled() + const { setAiAssistantPanel } = useAppStateSnapshot() const [selectedTable, setSelectedTable] = useState() const [showPolicyAiEditor, setShowPolicyAiEditor] = useState(false)