Skip to content

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

fix: Polish stuff for Cron (#30721)

Ivan Vasilov3619eb0ae9a5
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
index e477d0c146c..5d4580608f3 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
@@ -43,8 +43,8 @@ import {
} from './CronJobs.utils'
import { CronJobScheduleSection } from './CronJobScheduleSection'
import { EdgeFunctionSection } from './EdgeFunctionSection'
+import { HttpBodyFieldSection } from './HttpBodyFieldSection'
import { HTTPHeaderFieldsSection } from './HttpHeaderFieldsSection'
-import { HTTPParameterFieldsSection } from './HttpParameterFieldsSection'
import { HttpRequestSection } from './HttpRequestSection'
import { SqlFunctionSection } from './SqlFunctionSection'
import { SqlSnippetSection } from './SqlSnippetSection'
@@ -63,7 +63,7 @@ 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() })),
- httpParameters: z.array(z.object({ name: z.string(), value: z.string() })),
+ httpBody: z.string().trim(),
})
const httpRequestSchema = z.object({
@@ -77,7 +77,7 @@ 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() })),
- httpParameters: z.array(z.object({ name: z.string(), value: z.string() })),
+ httpBody: z.string().trim(),
})
const sqlFunctionSchema = z.object({
@@ -187,7 +187,7 @@ export const CreateCronJobSheet = ({
values.method,
values.edgeFunctionName,
values.httpHeaders,
- values.httpParameters,
+ values.httpBody,
values.timeoutMs
)
} else if (values.type === 'http_request') {
@@ -195,7 +195,7 @@ export const CreateCronJobSheet = ({
values.method,
values.endpoint,
values.httpHeaders,
- values.httpParameters,
+ values.httpBody,
values.timeoutMs
)
} else if (values.type === 'sql_function') {
@@ -367,7 +367,7 @@ export const CreateCronJobSheet = ({
<Separator />
<HTTPHeaderFieldsSection variant={cronType} />
<Separator />
- <HTTPParameterFieldsSection variant={cronType} />
+ <HttpBodyFieldSection form={form} />
</>
)}
{cronType === 'edge_function' && (
@@ -376,7 +376,7 @@ export const CreateCronJobSheet = ({
<Separator />
<HTTPHeaderFieldsSection variant={cronType} />
<Separator />
- <HTTPParameterFieldsSection variant={cronType} />
+ <HttpBodyFieldSection form={form} />
</>
)}
{cronType === 'sql_function' && <SqlFunctionSection form={form} />}
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
index d8bbd50102b..21f1c65abf8 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
@@ -1,13 +1,13 @@
import { toString as CronToString } from 'cronstrue'
-import { Clock, Loader2, MoreVertical } from 'lucide-react'
+import { Clock, History, Loader2, MoreVertical } from 'lucide-react'
import Link from 'next/link'
+import { useState } from 'react'
import { useParams } from 'common'
import { SQLCodeBlock } from 'components/interfaces/Auth/ThirdPartyAuthForm/SqlCodeBlock'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { CronJob } from 'data/database-cron-jobs/database-cron-jobs-query'
import { useDatabaseCronJobToggleMutation } from 'data/database-cron-jobs/database-cron-jobs-toggle-mutation'
-import { useState } from 'react'
import {
Button,
DropdownMenu,
@@ -68,6 +68,11 @@ export const CronJobCard = ({ job, onEditCronJob, onDeleteCronJob }: CronJobCard
checked={job.active}
onCheckedChange={() => showToggleConfirmationModal(true)}
/>
+ <Button type="default" icon={<History />}>
+ <Link href={`/project/${ref}/integrations/cron-jobs/cron-jobs/${job.jobname}`}>
+ History
+ </Link>
+ </Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button type="default" icon={<MoreVertical />} className="px-1.5" />
@@ -76,11 +81,6 @@ export const CronJobCard = ({ job, onEditCronJob, onDeleteCronJob }: CronJobCard
<DropdownMenuItem onClick={() => onEditCronJob(job)}>
Edit cron job
</DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href={`/project/${ref}/integrations/cron-jobs/cron-jobs/${job.jobname}`}>
- View previous runs
- </Link>
- </DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={() => onDeleteCronJob(job)}>
Delete cron job
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.test.ts b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.test.ts
index ad1dab0ead7..0474694ed28 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.test.ts
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.test.ts
@@ -1,14 +1,14 @@
import { it } from 'vitest'
-import { parseCronJobCommand, secondsPattern, cronPattern } from './CronJobs.utils'
+import { cronPattern, parseCronJobCommand, secondsPattern } from './CronJobs.utils'
describe('parseCronJobCommand', () => {
it('should return a default object when the command is null', () => {
- expect(parseCronJobCommand('')).toStrictEqual({ snippet: '', type: 'sql_snippet' })
+ expect(parseCronJobCommand('')).toMatchObject({ snippet: '', type: 'sql_snippet' })
})
it('should return a default object when the command is random', () => {
const command = 'some random text'
- expect(parseCronJobCommand(command)).toStrictEqual({
+ expect(parseCronJobCommand(command)).toMatchObject({
snippet: 'some random text',
type: 'sql_snippet',
})
@@ -16,7 +16,7 @@ describe('parseCronJobCommand', () => {
it('should return a sql function command when the command is CALL auth.jwt ()', () => {
const command = 'CALL auth.jwt ()'
- expect(parseCronJobCommand(command)).toStrictEqual({
+ expect(parseCronJobCommand(command)).toMatchObject({
type: 'sql_function',
schema: 'auth',
functionName: 'jwt',
@@ -24,17 +24,65 @@ describe('parseCronJobCommand', () => {
})
it('should return a edge function config when the command posts to supabase.co', () => {
- const command = `select net.http_post( url:='https://_.supabase.co/functions/v1/_', headers:=jsonb_build_object(), body:=jsonb_build_object(), timeout_milliseconds:=5000 );`
- expect(parseCronJobCommand(command)).toStrictEqual({
+ const command = `select net.http_post( url:='https://_.supabase.co/functions/v1/_', headers:=jsonb_build_object(), body:='', timeout_milliseconds:=5000 );`
+ expect(parseCronJobCommand(command)).toMatchObject({
edgeFunctionName: 'https://_.supabase.co/functions/v1/_',
method: 'POST',
httpHeaders: [],
- httpParameters: [],
+ httpBody: '',
timeoutMs: 5000,
type: 'edge_function',
})
})
+ it('should return a HTTP request config with POST method, empty headers and a body as string', () => {
+ const command = `select net.http_post( url:='https://example.com/api/endpoint', headers:=jsonb_build_object(), body:='hello', timeout_milliseconds:=5000 );`
+ expect(parseCronJobCommand(command)).toMatchObject({
+ endpoint: 'https://example.com/api/endpoint',
+ method: 'POST',
+ httpHeaders: [],
+ httpBody: 'hello',
+ timeoutMs: 5000,
+ type: 'http_request',
+ })
+ })
+
+ it('should return a HTTP request config with POST method, some headers and empty body', () => {
+ const command = `select net.http_post( url:='https://example.com/api/endpoint', headers:=jsonb_build_object('headerche', '2'), body:='', timeout_milliseconds:=1000 );`
+ expect(parseCronJobCommand(command)).toMatchObject({
+ endpoint: 'https://example.com/api/endpoint',
+ method: 'POST',
+ httpHeaders: [{ name: 'headerche', value: '2' }],
+ httpBody: '',
+ timeoutMs: 1000,
+ type: 'http_request',
+ })
+ })
+
+ it('should return a HTTP request config with GET method and empty body', () => {
+ const command = `select net.http_get( url:='https://example.com/api/endpoint', headers:=jsonb_build_object(), timeout_milliseconds:=5000 );`
+ expect(parseCronJobCommand(command)).toMatchObject({
+ endpoint: 'https://example.com/api/endpoint',
+ method: 'GET',
+ httpHeaders: [],
+ httpBody: '',
+ timeoutMs: 5000,
+ type: 'http_request',
+ })
+ })
+
+ it('should return a HTTP request config with POST method and a body as JSON object', () => {
+ const command = `select net.http_post( url:='https://example.com/api/endpoint', headers:=jsonb_build_object(), body:='{"key": "value"}', timeout_milliseconds:=5000 );`
+ expect(parseCronJobCommand(command)).toMatchObject({
+ endpoint: 'https://example.com/api/endpoint',
+ method: 'POST',
+ httpHeaders: [],
+ httpBody: '{"key": "value"}',
+ timeoutMs: 5000,
+ type: 'http_request',
+ })
+ })
+
// Array of test cases for secondsPattern
const secondsPatternTests = [
{ description: '10 seconds', command: '10 seconds' },
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
index 4ebe44ebe89..45398aa5e9e 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
@@ -1,5 +1,5 @@
import { CronJobType } from './CreateCronJobSheet'
-import { HTTPHeader, HTTPParameter } from './CronJobs.constants'
+import { HTTPHeader } from './CronJobs.constants'
export const buildCronQuery = (name: string, schedule: string, command: string) => {
return `select cron.schedule('${name}','${schedule}',${command});`
@@ -9,7 +9,7 @@ export const buildHttpRequestCommand = (
method: 'GET' | 'POST',
url: string,
headers: HTTPHeader[],
- body: HTTPParameter[],
+ body: string,
timeout: number
) => {
return `$$
@@ -20,10 +20,7 @@ export const buildHttpRequestCommand = (
.filter((v) => v.name && v.value)
.map((v) => `'${v.name}', '${v.value}'`)
.join(', ')}),
- body:=jsonb_build_object(${body
- .filter((v) => v.name && v.value)
- .map((v) => `'${v.name}', '${v.value}'`)
- .join(', ')}),
+ ${method === 'POST' ? `body:='${body}',` : ''}
timeout_milliseconds:=${timeout}
);
$$`
@@ -32,6 +29,10 @@ export const buildHttpRequestCommand = (
const DEFAULT_CRONJOB_COMMAND = {
type: 'sql_snippet',
snippet: '',
+ // add default values for the other command types. Even though they don't exist in sql_snippet, they'll still work as default values.
+ method: 'POST',
+ timeoutMs: 1000,
+ httpBody: '',
} as const
export const parseCronJobCommand = (originalCommand: string): CronJobType => {
@@ -40,12 +41,21 @@ export const parseCronJobCommand = (originalCommand: string): CronJobType => {
.replaceAll(/\n/g, ' ')
.replaceAll(/\s+/g, ' ')
.trim()
+
if (command.toLocaleLowerCase().startsWith('select net.')) {
- const matches =
+ let matches =
command.match(
- /select net\.([^']+)\(\s*url:='([^']+)',\s*headers:=jsonb_build_object\(([^)]*)\),\s*body:=jsonb_build_object\(([^]*)\s*\),\s*timeout_milliseconds:=(\d+) \)/i
+ /select net\.([^']+)\(\s*url:='([^']+)',\s*headers:=jsonb_build_object\(([^)]*)\),(?:\s*body:='(.*)',)?\s*timeout_milliseconds:=(\d+) \)/i
) || []
+ // if the match has been unsuccesful, the cron may be created with the previous encoding/parsing.
+ if (matches.length === 0) {
+ matches =
+ command.match(
+ /select net\.([^']+)\(\s*url:='([^']+)',\s*headers:=jsonb_build_object\(([^)]*)\),\s*body:=jsonb_build_object\(([^]*)\s*\),\s*timeout_milliseconds:=(\d+) \)/i
+ ) || []
+ }
+
// convert the header string to array of objects, clean up the values, trim them of spaces and remove the quotation marks at start and end
const headers = (matches[3] || '').split(',').map((s) => s.trim().replace(/^'|'$/g, ''))
const headersObjs: { name: string; value: string }[] = []
@@ -55,16 +65,8 @@ export const parseCronJobCommand = (originalCommand: string): CronJobType => {
}
}
- // convert the parameter string to array of objects, clean up the values, trim them of spaces and remove the quotation marks at start and end
- const parameters = (matches[4] || '').split(',').map((s) => s.trim().replace(/^'|'$/g, ''))
- const parametersObjs: { name: string; value: string }[] = []
- for (let i = 0; i < parameters.length; i += 2) {
- if (parameters[i] && parameters[i].length > 0) {
- parametersObjs.push({ name: parameters[i], value: parameters[i + 1] })
- }
- }
-
const url = matches[2] || ''
+ const body = matches[4] || ''
if (url.includes('.supabase.') && url.includes('/functions/v1/')) {
return {
@@ -72,7 +74,7 @@ export const parseCronJobCommand = (originalCommand: string): CronJobType => {
method: matches[1] === 'http_get' ? 'GET' : 'POST',
edgeFunctionName: url,
httpHeaders: headersObjs,
- httpParameters: parametersObjs,
+ httpBody: body,
timeoutMs: +matches[5] ?? 1000,
}
}
@@ -82,7 +84,7 @@ export const parseCronJobCommand = (originalCommand: string): CronJobType => {
method: matches[1] === 'http_get' ? 'GET' : 'POST',
endpoint: url,
httpHeaders: headersObjs,
- httpParameters: parametersObjs,
+ httpBody: body,
timeoutMs: +matches[5] ?? 1000,
}
}
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobsTab.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobsTab.tsx
index 2c103c43025..8ef51af2e0c 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobsTab.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobsTab.tsx
@@ -4,21 +4,32 @@ import { CreateCronJobSheet } from 'components/interfaces/Integrations/CronJobs/
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { CronJob, useCronJobsQuery } from 'data/database-cron-jobs/database-cron-jobs-query'
+import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'
import { Search } from 'lucide-react'
-import { parseAsString, useQueryState } from 'nuqs'
+import { parseAsBoolean, parseAsString, useQueryState } from 'nuqs'
import { Button, Input, Sheet, SheetContent } from 'ui'
import { CronJobCard } from '../CronJobs/CronJobCard'
import DeleteCronJob from '../CronJobs/DeleteCronJob'
-import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'
+
+const EMPTY_CRON_JOB = {
+ jobname: '',
+ schedule: '',
+ active: true,
+ command: '',
+}
export const CronjobsTab = () => {
const { project } = useProjectContext()
const [searchQuery, setSearchQuery] = useQueryState('search', parseAsString.withDefault(''))
+ const [createCronJobSheetShown, setCreateCronJobSheetShown] = useQueryState(
+ 'dialog-shown',
+ parseAsBoolean.withDefault(false).withOptions({ clearOnDefault: true })
+ )
// used for confirmation prompt in the Create Cron Job Sheet
const [isClosingCreateCronJobSheet, setIsClosingCreateCronJobSheet] = useState(false)
- const [createCronJobSheetShown, setCreateCronJobSheetShown] = useState<
+ const [cronJobForEditing, setCronJobForEditing] = useState<
Pick<CronJob, 'jobname' | 'schedule' | 'active' | 'command'> | undefined
>()
const [cronJobForDeletion, setCronJobForDeletion] = useState<CronJob | undefined>()
@@ -57,18 +68,7 @@ export const CronjobsTab = () => {
}
>
<p className="text-sm text-foreground">No cron jobs created yet</p>
- <Button
- onClick={() =>
- setCreateCronJobSheetShown({
- jobname: '',
- schedule: '',
- command: '',
- active: true,
- })
- }
- >
- Add a new cron job
- </Button>
+ <Button onClick={() => setCreateCronJobSheetShown(true)}>Create job</Button>
</div>
) : (
<div className="w-full space-y-4">
@@ -82,18 +82,7 @@ export const CronjobsTab = () => {
onChange={(e) => setSearchQuery(e.target.value)}
/>
- <Button
- onClick={() =>
- setCreateCronJobSheetShown({
- jobname: '',
- schedule: '',
- command: '',
- active: true,
- })
- }
- >
- Create a cron job
- </Button>
+ <Button onClick={() => setCreateCronJobSheetShown(true)}>Create job</Button>
</div>
{filteredCronJobs.length === 0 ? (
<div
@@ -115,7 +104,10 @@ export const CronjobsTab = () => {
<CronJobCard
key={job.jobid}
job={job}
- onEditCronJob={(job) => setCreateCronJobSheetShown(job)}
+ onEditCronJob={(job) => {
+ setCronJobForEditing(job)
+ setCreateCronJobSheetShown(true)
+ }}
onDeleteCronJob={(job) => setCronJobForDeletion(job)}
/>
))
@@ -136,11 +128,12 @@ export const CronjobsTab = () => {
>
<SheetContent size="default" tabIndex={undefined}>
<CreateCronJobSheet
- selectedCronJob={createCronJobSheetShown}
+ selectedCronJob={cronJobForEditing ?? EMPTY_CRON_JOB}
supportsSeconds={supportsSeconds}
onClose={() => {
setIsClosingCreateCronJobSheet(false)
- setCreateCronJobSheetShown(undefined)
+ setCronJobForEditing(undefined)
+ setCreateCronJobSheetShown(false)
}}
isClosing={isClosingCreateCronJobSheet}
setIsClosing={setIsClosingCreateCronJobSheet}
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx
new file mode 100644
index 00000000000..82798c330a2
--- /dev/null
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx
@@ -0,0 +1,44 @@
+import { UseFormReturn } from 'react-hook-form'
+
+import {
+ FormControl_Shadcn_,
+ FormDescription_Shadcn_,
+ FormField_Shadcn_,
+ FormItem_Shadcn_,
+ FormLabel_Shadcn_,
+ FormMessage_Shadcn_,
+ SheetSection,
+ TextArea_Shadcn_,
+} from 'ui'
+import { CreateCronJobForm } from './CreateCronJobSheet'
+
+interface HttpBodyFieldSectionProps {
+ form: UseFormReturn<CreateCronJobForm>
+}
+
+export const HttpBodyFieldSection = ({ form }: HttpBodyFieldSectionProps) => {
+ return (
+ <SheetSection>
+ <FormField_Shadcn_
+ control={form.control}
+ name="values.httpBody"
+ render={({ field }) => (
+ <FormItem_Shadcn_ className="gap-1 flex flex-col">
+ <FormLabel_Shadcn_>HTTP Request Body</FormLabel_Shadcn_>
+ <FormControl_Shadcn_>
+ <TextArea_Shadcn_
+ className="h-72 rounded-none px-4 outline-none"
+ value={field.value}
+ 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_>
+ )}
+ />
+ </SheetSection>
+ )
+}
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/HttpHeaderFieldsSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/HttpHeaderFieldsSection.tsx
index bfd46415d0b..6a76aac83d7 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/HttpHeaderFieldsSection.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/HttpHeaderFieldsSection.tsx
@@ -15,6 +15,7 @@ import {
FormControl_Shadcn_,
FormField_Shadcn_,
FormItem_Shadcn_,
+ FormLabel_Shadcn_,
FormMessage_Shadcn_,
Input_Shadcn_,
SheetSection,
@@ -38,7 +39,7 @@ export const HTTPHeaderFieldsSection = ({ variant }: HTTPHeaderFieldsSectionProp
return (
<SheetSection>
- <FormSectionLabel className="lg:!col-span-4">HTTP Headers</FormSectionLabel>
+ <FormLabel_Shadcn_>HTTP Headers</FormLabel_Shadcn_>
<div className="space-y-3 mt-1">
{fields.map((field, index) => (
<div key={field.id} className="flex items-center space-x-2">
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/HttpParameterFieldsSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/HttpParameterFieldsSection.tsx
deleted file mode 100644
index d00cb14571d..00000000000
--- a/apps/studio/components/interfaces/Integrations/CronJobs/HttpParameterFieldsSection.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import { Plus, Trash } from 'lucide-react'
-import { useFieldArray } from 'react-hook-form'
-
-import {
- Button,
- FormControl_Shadcn_,
- FormField_Shadcn_,
- FormItem_Shadcn_,
- FormMessage_Shadcn_,
- Input_Shadcn_,
- SheetSection,
-} from 'ui'
-import { CreateCronJobForm } from './CreateCronJobSheet'
-
-interface HTTPParameterFieldsSectionProps {
- variant: 'edge_function' | 'http_request'
-}
-
-export const HTTPParameterFieldsSection = ({ variant }: HTTPParameterFieldsSectionProps) => {
- // gets the fields through form context
- const { fields, append, remove } = useFieldArray<CreateCronJobForm>({
- name: 'values.httpParameters',
- })
-
- return (
- <SheetSection>
- <span>HTTP Parameters</span>
- <div className="space-y-2 mt-1">
- {fields.map((field, index) => (
- <div key={field.id} className="flex items-center space-x-2">
- <FormField_Shadcn_
- name={`values.httpParameters.${index}.name`}
- render={({ field }) => (
- <FormItem_Shadcn_ className="flex-1">
- <FormControl_Shadcn_>
- <Input_Shadcn_
- {...field}
- size="small"
- className="w-full"
- placeholder="Parameter name"
- />
- </FormControl_Shadcn_>
- <FormMessage_Shadcn_ />
- </FormItem_Shadcn_>
- )}
- />
- <FormField_Shadcn_
- name={`values.httpParameters.${index}.value`}
- render={({ field }) => (
- <FormItem_Shadcn_ className="flex-1">
- <FormControl_Shadcn_>
- <Input_Shadcn_
- {...field}
- value={field.value}
- size="small"
- className="w-full"
- placeholder="Parameter value"
- />
- </FormControl_Shadcn_>
- <FormMessage_Shadcn_ />
- </FormItem_Shadcn_>
- )}
- />
-
- <Button
- type="default"
- icon={<Trash size={12} />}
- onClick={() => remove(index)}
- className="h-[34px] w-[34px]"
- />
- </div>
- ))}
- <div>
- <Button
- type="default"
- size="tiny"
- icon={<Plus />}
- onClick={() => append({ name: '', value: '' })}
- >
- Add a new parameter
- </Button>
- </div>
- </div>
- </SheetSection>
- )
-}
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/HttpRequestSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/HttpRequestSection.tsx
index 13871ab4d7a..03d522eb626 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/HttpRequestSection.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/HttpRequestSection.tsx
@@ -51,7 +51,9 @@ export const HttpRequestSection = ({ form }: HttpRequestSectionProps) => {
name="values.endpoint"
render={({ field: { ref, ...rest } }) => (
<FormItemLayout label="Endpoint URL" className="gap-1">
- <Input {...rest} placeholder="https://api.example.com/endpoint" />
+ <FormControl_Shadcn_>
+ <Input {...rest} placeholder="https://api.example.com/endpoint" />
+ </FormControl_Shadcn_>
</FormItemLayout>
)}
/>
diff --git a/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx b/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx
index cad9403f5ea..7d84094de0a 100644
--- a/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx
+++ b/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx
@@ -113,7 +113,7 @@ const supabaseIntegrations: IntegrationDefinition[] = [
id: 'cron-jobs',
type: 'postgres_extension' as const,
requiredExtensions: ['pg_cron'],
- name: `Cron Jobs`,
+ name: `Cron`,
icon: ({ className, ...props } = {}) => (
<Clock5 className={cn('inset-0 p-2 text-black w-full h-full', className)} {...props} />
),
@@ -129,8 +129,8 @@ const supabaseIntegrations: IntegrationDefinition[] = [
label: 'Overview',
},
{
- route: 'cron-jobs',
- label: 'Cron Jobs',
+ route: 'jobs',
+ label: 'Jobs',
hasChild: true,
childIcon: (
<Timer size={12} strokeWidth={1.5} className={cn('text-foreground w-full h-full')} />
@@ -157,7 +157,7 @@ const supabaseIntegrations: IntegrationDefinition[] = [
loading: Loading,
}
)
- case 'cron-jobs':
+ case 'jobs':
return dynamic(() => import('../CronJobs/CronJobsTab').then((mod) => mod.CronjobsTab), {
loading: Loading,
})
diff --git a/apps/studio/static-data/integrations/cron-jobs/overview.md b/apps/studio/static-data/integrations/cron-jobs/overview.md
index b9cfc653dfa..dfb3bbbf833 100644
--- a/apps/studio/static-data/integrations/cron-jobs/overview.md
+++ b/apps/studio/static-data/integrations/cron-jobs/overview.md
@@ -1 +1 @@
-Cron jobs uses the `pg_cron` Postgres extension, which is a simple cron-based job scheduler for Postgres that runs inside the database. It uses the same syntax as a regular cron, but it allows you to schedule Postgres SQL commands directly from the database.
+Supabase Cron uses the `pg_cron` Postgres extension, which is a simple cron-based job scheduler for Postgres that runs inside the database. It uses the same syntax as a regular cron, but it allows you to schedule Postgres SQL commands directly from the database.