Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export const BranchSelector = ({
const [open, setOpen] = useState(false)
const [selectedBranch, setSelectedBranch] = useState<Branch | null>(null)

// Filter out branches that are already ready for review and the main branch
// Filter out branches that are already ready for review or linked to a github branch
const availableBranches = branches.filter(
(branch) => !branch.is_default && !branch.review_requested_at
(branch) => !branch.is_default && !branch.review_requested_at && !branch.git_branch
)

const handleBranchSelect = (branch: Branch) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { INTEGRATIONS } from '../Landing/Integrations.constants'
import DeleteWrapperModal from './DeleteWrapperModal'
import { EditWrapperSheet } from './EditWrapperSheet'
import { formatWrapperTables } from './Wrappers.utils'
import { convertKVStringArrayToJson, formatWrapperTables } from './Wrappers.utils'

interface WrapperRowProps {
wrapper: FDW
Expand Down Expand Up @@ -55,9 +55,7 @@ export const WrapperRow = ({
return <p className="text-foreground-lighter text-sm">A wrapper with this ID does not exist</p>
}

const serverOptions = Object.fromEntries(
wrapper.server_options.map((option) => option.split('='))
)
const serverOptions = convertKVStringArrayToJson(wrapper.server_options ?? [])
const [encryptedMetadata, visibleMetadata] = partition(
integration?.meta?.server.options.filter((option) => !option.hidden),
'secureEntry'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const CreateVectorTableSheet = ({ bucketName }: CreateVectorTableSheetPro
const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')

const { data: wrapperInstance } = useS3VectorsWrapperInstance({ bucketId: bucketName })
const schema = wrapperInstance?.server_options
const schema = (wrapperInstance?.server_options ?? [])
.find((x) => x.startsWith('supabase_target_schema'))
?.split('supabase_target_schema=')[1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const VectorBucketDetails = () => {
} = useS3VectorsWrapperInstance({ bucketId })

const isLoading = isLoadingIndexes || isLoadingWrapper
const hasSetUpForeignSchema = wrapperInstance?.server_options.find((x) =>
const hasSetUpForeignSchema = (wrapperInstance?.server_options ?? []).find((x) =>
x.startsWith('supabase_target_schema')
)

Expand Down
4 changes: 3 additions & 1 deletion apps/studio/components/layouts/AppLayout/ProjectDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { IS_PLATFORM } from 'lib/constants'
import { Button, CommandGroup_Shadcn_, CommandItem_Shadcn_, cn } from 'ui'
import { Badge, Button, CommandGroup_Shadcn_, CommandItem_Shadcn_, cn } from 'ui'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'

export const sanitizeRoute = (route: string, routerQueries: ParsedUrlQuery) => {
Expand Down Expand Up @@ -87,11 +87,13 @@ export const ProjectDropdown = () => {
const sanitizedRoute = sanitizeRoute(router.route, router.query)
const href = sanitizedRoute?.replace('[ref]', project.ref) ?? `/project/${project.ref}`
const isSelected = project.ref === ref
const isPaused = project.status === 'INACTIVE'

return (
<Link href={href} className="w-full flex items-center justify-between">
<span className={cn('truncate', isSelected ? 'max-w-60' : 'max-w-64')}>
{project.name}
{isPaused && <Badge className="ml-2">Paused</Badge>}
</span>
{isSelected && <Check size={16} />}
</Link>
Expand Down
34 changes: 19 additions & 15 deletions apps/studio/components/ui/AIEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface AIEditorProps {
// Can we try to de-dupe accordingly? Perhaps the SQL Editor could use this AIEditor
// We have a tendency to create multiple versions of the monaco editor like RLSCodeEditor
// so hoping to prevent that from snowballing
const AIEditor = ({
export const AIEditor = ({
language = 'javascript',
value,
defaultValue = '',
Expand Down Expand Up @@ -200,18 +200,24 @@ const AIEditor = ({
diagnosticCodesToIgnore: [2792],
})

fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}/deno/lib.deno.d.ts`)
.then((response) => response.text())
.then((code) => {
monaco.languages.typescript.typescriptDefaults.addExtraLib(code)
})

// Add edge runtime types to the TS language service
fetch(`${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}/deno/edge-runtime.d.ts`)
.then((response) => response.text())
.then((code) => {
monaco.languages.typescript.typescriptDefaults.addExtraLib(code)
})
if (language === 'javascript' || language === 'typescript') {
// The Deno libs are loaded as a raw text via raw-loader in next.config.js. They're passed as raw text to the
// Monaco editor.
import('public/deno/edge-runtime.d.ts' as string)
.then((module) => {
monaco.languages.typescript.typescriptDefaults.addExtraLib(module.default)
})
.catch((error) => {
console.error('Failed to load Deno edge-runtime typings:', error)
})
import('public/deno/lib.deno.d.ts' as string)
.then((module) => {
monaco.languages.typescript.typescriptDefaults.addExtraLib(module.default)
})
.catch((error) => {
console.error('Failed to load Deno lib typings:', error)
})
}

if (!!executeQueryRef.current) {
editor.addAction({
Expand Down Expand Up @@ -458,5 +464,3 @@ const AIEditor = ({
</div>
)
}

export default AIEditor
6 changes: 3 additions & 3 deletions apps/studio/components/ui/EditorPanel/EditorPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useRouter } from 'next/router'
import { useState } from 'react'

import { LOCAL_STORAGE_KEYS, useParams } from 'common'
import { isExplainQuery } from 'components/interfaces/ExplainVisualizer/ExplainVisualizer.utils'
import { generateSnippetTitle } from 'components/interfaces/SQLEditor/SQLEditor.constants'
import {
createSqlSnippetSkeletonV2,
suffixWithLimit,
Expand Down Expand Up @@ -40,11 +42,9 @@ import {
} from 'ui'
import { Admonition } from 'ui-patterns'
import { containsUnknownFunction, isReadOnlySelect } from '../AIAssistantPanel/AIAssistant.utils'
import AIEditor from '../AIEditor'
import { AIEditor } from '../AIEditor'
import { ButtonTooltip } from '../ButtonTooltip'
import { SqlWarningAdmonition } from '../SqlWarningAdmonition'
import { isExplainQuery } from 'components/interfaces/ExplainVisualizer/ExplainVisualizer.utils'
import { generateSnippetTitle } from 'components/interfaces/SQLEditor/SQLEditor.constants'

export const EditorPanel = () => {
const {
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/components/ui/FileExplorerAndEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AnimatePresence, motion } from 'framer-motion'
import { Edit, File, Plus, Trash } from 'lucide-react'
import { useEffect, useState } from 'react'

import AIEditor from 'components/ui/AIEditor'
import { toast } from 'sonner'

import { AIEditor } from 'components/ui/AIEditor'
import {
Button,
ContextMenu_Shadcn_,
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/data/fdw/fdws-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export type FDW = {
name: string
handler: string
server_name: string
server_options: string[]
server_options: string[] | null
tables: FDWTable[]
}

Expand Down
2 changes: 1 addition & 1 deletion apps/studio/hooks/useProtectedSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const useFdwSchemasQuery = () => {

const fdwSchemas = icebergFDWs.map((fdw) => {
const schemaOption =
convertKVStringArrayToJson(fdw.server_options)['supabase_target_schema'] ?? ''
convertKVStringArrayToJson(fdw.server_options ?? [])['supabase_target_schema'] ?? ''

const schemas = uniq(schemaOption.split(',').filter(Boolean))

Expand Down
9 changes: 9 additions & 0 deletions apps/studio/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,15 @@ const nextConfig = {
loaders: ['raw-loader'],
as: '*.js',
},
// special case for Deno libs to be loaded as a raw text. They're passed as raw text to the Monaco editor.
'edge-runtime.d.ts': {
loaders: ['raw-loader'],
as: '*.js',
},
'lib.deno.d.ts': {
loaders: ['raw-loader'],
as: '*.js',
},
},
},
onDemandEntries: {
Expand Down
11 changes: 8 additions & 3 deletions apps/studio/pages/project/[ref]/merge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ const MergePage: NextPageWithLayout = () => {
}

const isMergeDisabled =
!combinedHasChanges || isCombinedDiffLoading || isBranchOutOfDateOverall || isWorkflowRunning
!combinedHasChanges ||
isCombinedDiffLoading ||
isBranchOutOfDateOverall ||
isWorkflowRunning ||
Boolean(mainBranch?.git_branch)

const primaryActions = (
<div className="flex items-end gap-2">
Expand All @@ -388,7 +392,9 @@ const MergePage: NextPageWithLayout = () => {
? 'No changes to merge'
: isWorkflowRunning
? 'Workflow is currently running'
: 'Unable to merge at this time',
: Boolean(mainBranch?.git_branch)
? 'Deploy to production from GitHub is enabled'
: 'Unable to merge at this time',
},
}}
type="primary"
Expand All @@ -404,7 +410,6 @@ const MergePage: NextPageWithLayout = () => {
type="primary"
loading={isMerging || isSubmitting}
onClick={() => setShowConfirmDialog(true)}
disabled={isBranchOutOfDateOverall}
icon={<GitMerge size={16} strokeWidth={1.5} className="text-brand" />}
>
Merge branch
Expand Down
Loading