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
4 changes: 4 additions & 0 deletions apps/docs/components/GuidesTableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const formatTOCHeader = (content: string) => {
begin = false
res.push(`</code>`)
}
} else if (x === '<') {
res.push('&lt')
} else if (x === '>') {
res.push('&gt')
} else {
res.push(x)
}
Expand Down
42 changes: 42 additions & 0 deletions apps/docs/spec/cli_v1_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,53 @@ parameters:
tags: ['storage']
required: false
default: '"50MiB"'
description: |
The maximum file size allowed for all buckets in the project.
links:
- name: 'Storage server configuration'
link: 'https://supabase.com/docs/guides/self-hosting/storage/config'

- id: 'storage.buckets.bucket_name.public'
title: 'storage.buckets.<bucket_name>.public'
tags: ['storage']
required: false
default: 'false'
description: |
Enable public access to the bucket.
links:
- name: 'Storage server configuration'
link: 'https://supabase.com/docs/guides/self-hosting/storage/config'

- id: 'storage.buckets.bucket_name.file_size_limit'
title: 'storage.buckets.<bucket_name>.file_size_limit'
tags: ['storage']
required: false
description: |
The maximum file size allowed (e.g. "5MB", "500KB").
links:
- name: 'Storage server configuration'
link: 'https://supabase.com/docs/guides/self-hosting/storage/config'

- id: 'storage.buckets.bucket_name.allowed_mime_types'
title: 'storage.buckets.<bucket_name>.allowed_mime_types'
tags: ['storage']
required: false
description: |
The list of allowed MIME types for objects in the bucket.
links:
- name: 'Storage server configuration'
link: 'https://supabase.com/docs/guides/self-hosting/storage/config'

- id: 'storage.buckets.bucket_name.objects_path'
title: 'storage.buckets.<bucket_name>.objects_path'
tags: ['storage']
required: false
description: |
The local directory to upload objects to the bucket.
links:
- name: 'Storage server configuration'
link: 'https://supabase.com/docs/guides/self-hosting/storage/config'

- id: 'auth.enabled'
title: 'auth.enabled'
tags: ['auth']
Expand Down Expand Up @@ -1176,6 +1217,7 @@ parameters:
required: false
description: |
Specify the Deno import map file to use for the Function.
When not specified, defaults to `supabase/functions/<function_name>/deno.json`.

Note that the `--import-map` flag overrides this configuration.
links:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,19 @@ const edgeFunctionSchema = z.object({
edgeFunctionName: z.string().trim().min(1, 'Please select one of the listed Edge Functions'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
httpBody: z.string().trim(),
httpBody: z
.string()
.trim()
.optional()
.refine((value) => {
if (!value) return true
try {
JSON.parse(value)
return true
} catch {
return false
}
}, 'Input must be valid JSON'),
})

const httpRequestSchema = z.object({
Expand All @@ -77,7 +89,19 @@ const httpRequestSchema = z.object({
.refine((value) => value.startsWith('http'), 'Please include HTTP/HTTPs to your URL'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
httpBody: z.string().trim(),
httpBody: z
.string()
.trim()
.optional()
.refine((value) => {
if (!value) return true
try {
JSON.parse(value)
return true
} catch {
return false
}
}, 'Input must be valid JSON'),
})

const sqlFunctionSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ export const CronJobCard = ({ job, onEditCronJob, onDeleteCronJob }: CronJobCard
onCheckedChange={() => showToggleConfirmationModal(true)}
/>
<Button type="default" icon={<History />}>
<Link href={`/project/${ref}/integrations/cron/cron-jobs/${job.jobname}`}>
History
</Link>
<Link href={`/project/${ref}/integrations/cron/jobs/${job.jobname}`}>History</Link>
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const buildHttpRequestCommand = (
method: 'GET' | 'POST',
url: string,
headers: HTTPHeader[],
body: string,
body: string | undefined,
timeout: number
) => {
return `$$
Expand All @@ -20,7 +20,7 @@ export const buildHttpRequestCommand = (
.filter((v) => v.name && v.value)
.map((v) => `'${v.name}', '${v.value}'`)
.join(', ')}),
${method === 'POST' ? `body:='${body}',` : ''}
${method === 'POST' && body ? `body:='${body}',` : ''}
timeout_milliseconds:=${timeout}
);
$$`
Expand Down Expand Up @@ -117,7 +117,12 @@ export function calculateDuration(start: string, end: string): string {
const startTime = new Date(start).getTime()
const endTime = new Date(end).getTime()
const duration = endTime - startTime
return isNaN(duration) ? 'Invalid Date' : `${duration} ms`

if (isNaN(duration)) return 'Invalid Date'

if (duration < 1000) return `${duration}ms`
if (duration < 60000) return `${(duration / 1000).toFixed(1)}s`
return `${(duration / 60000).toFixed(1)}m`
}

export function formatDate(dateString: string): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ export const HttpBodyFieldSection = ({ form }: HttpBodyFieldSectionProps) => {
onChange={field.onChange}
/>
</FormControl_Shadcn_>
<FormDescription_Shadcn_ className="text-foreground-lighter">
The content should match the content-type header.
</FormDescription_Shadcn_>
<FormMessage_Shadcn_ />
</FormItem_Shadcn_>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toString as CronToString } from 'cronstrue'
import { List } from 'lucide-react'
import { CircleCheck, CircleX, List, Loader } from 'lucide-react'
import Link from 'next/link'
import { UIEvent, useCallback, useEffect, useMemo } from 'react'
import DataGrid, { Column, Row } from 'react-data-grid'
Expand All @@ -12,7 +12,6 @@ import {
useCronJobRunsInfiniteQuery,
} from 'data/database-cron-jobs/database-cron-jobs-runs-infinite-query'
import {
Badge,
Button,
cn,
LoadingLine,
Expand Down Expand Up @@ -66,9 +65,7 @@ const cronJobColumns = [
id: 'status',
name: 'Status',
minWidth: 75,
value: (row: CronJobRun) => (
<Badge variant={row.status === 'succeeded' ? 'success' : 'warning'}>{row.status}</Badge>
),
value: (row: CronJobRun) => <StatusBadge status={row.status} />,
},
{
id: 'start_time',
Expand All @@ -80,15 +77,19 @@ const cronJobColumns = [
id: 'end_time',
name: 'End Time',
minWidth: 120,
value: (row: CronJobRun) => <div className="text-xs">{formatDate(row.end_time)}</div>,
value: (row: CronJobRun) => (
<div className="text-xs">{row.status === 'succeeded' ? formatDate(row.end_time) : '-'}</div>
),
},

{
id: 'duration',
name: 'Duration',
minWidth: 100,
value: (row: CronJobRun) => (
<div className="text-xs">{calculateDuration(row.start_time, row.end_time)}</div>
<span className="text-xs">
{row.status === 'succeeded' ? calculateDuration(row.start_time, row.end_time) : ''}
</span>
),
},
]
Expand Down Expand Up @@ -215,7 +216,7 @@ export const PreviousRunsTab = () => {
/>
</div>

<div className="px-6 py-6 flex gap-12 border-t">
<div className="px-6 py-6 flex gap-12 border-t bg sticky bottom-0">
{isLoadingCronJobs ? (
<GenericSkeletonLoader />
) : (
Expand Down Expand Up @@ -291,3 +292,35 @@ export const PreviousRunsTab = () => {
</div>
)
}

interface StatusBadgeProps {
status: string
}

function StatusBadge({ status }: StatusBadgeProps) {
if (status === 'succeeded') {
return (
<span className="text-brand-600 flex items-center gap-1">
<CircleCheck size={14} /> Succeeded
</span>
)
}

if (status === 'failed') {
return (
<span className="text-destructive flex items-center gap-1">
<CircleX size={14} /> Failed
</span>
)
}

if (['running', 'starting', 'sending', 'connecting'].includes(status)) {
return (
<span className="text-_secondary flex items-center gap-1">
<Loader size={14} className="animate-spin" /> Running
</span>
)
}

return null
}
4 changes: 1 addition & 3 deletions apps/studio/components/layouts/Integrations/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ export const IntegrationTabs = ({ scroll, isSticky }: IntegrationTabsProps) => {
>
<NavMenuItem active={true} className="flex items-center gap-2">
{tab.childIcon}
<Link href={`/project/${project?.ref}/integrations/${tab.route}`}>
{childId}
</Link>
<Link href={`${tabUrl}/${childId}`}>{childId}</Link>
</NavMenuItem>
</motion.div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export type CronJobRun = {
database: string
username: string
command: string
status: 'succeeded' | 'failed'
// statuses https://github.com/citusdata/pg_cron/blob/f5d111117ddc0f4d83a1bad34d61b857681b6720/include/job_metadata.h#L20
status: 'starting' | 'running' | 'sending' | 'connecting' | 'succeeded' | 'failed'
return_message: string
start_time: string
end_time: string
Expand All @@ -35,9 +36,9 @@ export async function getDatabaseCronJobRuns({
if (!projectRef) throw new Error('Project ref is required')

let query = `
SELECT * FROM cron.job_run_details
WHERE
jobid = '${jobId}'
SELECT * FROM cron.job_run_details
WHERE
jobid = '${jobId}'
${afterTimestamp ? `AND start_time < '${afterTimestamp}'` : ''}
ORDER BY start_time DESC
LIMIT ${CRON_JOB_RUNS_PAGE_SIZE}`
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ const nextConfig = {
},
{
permanent: true,
source: '/project/:ref/.....',
destination: '/project/:ref/integrations/cron-jobs',
source: '/project/:ref/database/cron-jobs',
destination: '/project/:ref/integrations/cron',
},
{
permanent: true,
Expand Down
1 change: 1 addition & 0 deletions apps/www/_blog/2024-12-01-orioledb-launch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tags:
- supabase-engineering
date: '2024-12-01'
toc_depth: 3
launchweek: '13'
---

# OrioleDB Public Alpha
Expand Down
1 change: 1 addition & 0 deletions apps/www/_blog/2024-12-02-supabase-ai-assistant-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tags:
- postgres
date: '2024-12-02'
toc_depth: 3
launchweek: '13'
---

Today we are releasing Supabase Assistant v2 in the Dashboard - a global assistant with several new abilities:
Expand Down
Loading
Loading