mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 14:49:10 +03:00
Merge branch 'master' into chore/settings-ui
This commit is contained in:
commit
554478d21a
103 files changed
+3966
-404
No files matched your search
@@ -1919,6 +1919,17 @@ export const Index: Record<string, any> = {
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"multi-select-combobox-creatable": {
|
||||
name: "multi-select-combobox-creatable",
|
||||
type: "components:example",
|
||||
registryDependencies: undefined,
|
||||
component: React.lazy(() => import("@/registry/default/example/multi-select-combobox-creatable")),
|
||||
source: "",
|
||||
files: ["registry/default/example/multi-select-combobox-creatable.tsx"],
|
||||
category: "undefined",
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"multi-select-deletable-badge": {
|
||||
name: "multi-select-deletable-badge",
|
||||
type: "components:example",
|
||||
|
||||
@@ -349,6 +349,11 @@ export const docsConfig: DocsConfig = {
|
||||
href: '/docs/components/slider',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: 'Sidebar',
|
||||
href: '/docs/components/sidebar',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: 'Sonner',
|
||||
href: '/docs/components/sonner',
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -47,6 +47,13 @@ Use `MultiSelectorInput`to add a search input.
|
||||
|
||||
<ComponentPreview name="multi-select-combobox" />
|
||||
|
||||
### Badge Combo Box with creatable selector
|
||||
|
||||
creatable: `boolean`
|
||||
`creatable` prop on the `MultiSelectorList` component can be used to add a new option if no items match
|
||||
|
||||
<ComponentPreview name="multi-select-combobox-creatable" />
|
||||
|
||||
### Badge Limit
|
||||
|
||||
badgeLimit: `number` | `"wrap"`.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
MultiSelector,
|
||||
MultiSelectorContent,
|
||||
MultiSelectorInput,
|
||||
MultiSelectorItem,
|
||||
MultiSelectorList,
|
||||
MultiSelectorTrigger,
|
||||
} from 'ui-patterns/multi-select'
|
||||
|
||||
export default function MultiSelectDemo() {
|
||||
const [selectedValues, setSelectedValues] = useState<string[]>([])
|
||||
|
||||
return (
|
||||
<MultiSelector values={selectedValues} onValuesChange={setSelectedValues}>
|
||||
<MultiSelectorTrigger className="w-72" label="Select fruits" badgeLimit="wrap" />
|
||||
<MultiSelectorContent>
|
||||
<MultiSelectorInput placeholder="Search fruits" showResetIcon />
|
||||
<MultiSelectorList creatable>
|
||||
<MultiSelectorItem value="Mango">Mango</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Date">Date</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Apple">Apple</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Elderberrie">Elderberrie</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Fig">Fig</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Grape">Grape</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Banana">Banana</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Kiwi">Kiwi</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Strawberry">Strawberry</MultiSelectorItem>
|
||||
<MultiSelectorItem value="Cherry">Cherry</MultiSelectorItem>
|
||||
</MultiSelectorList>
|
||||
</MultiSelectorContent>
|
||||
</MultiSelector>
|
||||
)
|
||||
}
|
||||
@@ -1091,6 +1091,11 @@ export const examples: Registry = [
|
||||
type: 'components:example',
|
||||
files: ['example/multi-select-combobox.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'multi-select-combobox-creatable',
|
||||
type: 'components:example',
|
||||
files: ['example/multi-select-combobox-creatable.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'multi-select-deletable-badge',
|
||||
type: 'components:example',
|
||||
|
||||
@@ -8,7 +8,8 @@ module.exports = config({
|
||||
// purge styles from grid library
|
||||
//
|
||||
'./../../packages/ui/src/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/!(node_modules)/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/**/*.{tsx,ts,js}',
|
||||
'!./../../packages/ui-patterns/node_modules/**/*', // ignore node_modules rule
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
|
||||
@@ -1747,6 +1747,10 @@ export const ai = {
|
||||
url: '/guides/ai/vector-indexes',
|
||||
items: vectorIndexItems,
|
||||
},
|
||||
{
|
||||
name: 'Automatic embeddings',
|
||||
url: '/guides/ai/automatic-embeddings',
|
||||
},
|
||||
{
|
||||
name: 'Engineering for scale',
|
||||
url: '/guides/ai/engineering-for-scale',
|
||||
|
||||
@@ -0,0 +1,817 @@
|
||||
---
|
||||
id: 'ai-automatic-embeddings'
|
||||
title: 'Automatic embeddings'
|
||||
description: 'Automate embedding generation and updates in Postgres'
|
||||
sidebar_label: 'Automatic embeddings'
|
||||
---
|
||||
|
||||
Vector embeddings enable powerful [semantic search](/docs/guides/ai/semantic-search) capabilities in Postgres, but managing them alongside your content has traditionally been complex. This guide demonstrates how to automate embedding generation and updates using Supabase [Edge Functions](/docs/guides/functions), [pgmq](/docs/guides/database/extensions/pgmq), [pg_net](/docs/guides/database/extensions/pg_net), and [pg_cron](/docs/guides/cron).
|
||||
|
||||
## Understanding the challenge
|
||||
|
||||
When implementing semantic search with pgvector, developers typically need to:
|
||||
|
||||
1. Generate embeddings via an external API (like OpenAI)
|
||||
2. Store these embeddings alongside the content
|
||||
3. Keep embeddings in sync when content changes
|
||||
4. Handle failures and retries in the embedding generation process
|
||||
|
||||
While Postgres [full-text search](/docs/guides/database/full-text-search) can handle this internally through synchronous calls to `to_tsvector` and [triggers](https://www.postgresql.org/docs/current/textsearch-features.html#TEXTSEARCH-UPDATE-TRIGGERS), semantic search requires asynchronous API calls to a provider like OpenAI to generate vector embeddings. This guide demonstrates how to use triggers, queues, and Supabase Edge Functions to bridge this gap.
|
||||
|
||||
## Understanding the architecture
|
||||
|
||||
We'll leverage the following Postgres and Supabase features to create the automated embedding system:
|
||||
|
||||
1. [pgvector](/docs/guides/database/extensions/pgvector): Stores and queries vector embeddings
|
||||
1. [pgmq](/docs/guides/queues): Queues embedding generation requests for processing and retries
|
||||
1. [pg_net](/docs/guides/database/extensions/pg_net): Handles asynchronous HTTP requests to Edge Functions directly from Postgres
|
||||
1. [pg_cron](/docs/guides/cron): Automatically processes and retries embedding generations
|
||||
1. [Triggers](/docs/guides/database/postgres/triggers): Detects content changes and enqueues embedding generation requests
|
||||
1. [Edge Functions](/docs/guides/functions): Generates embeddings via an API like OpenAI (customizable)
|
||||
|
||||
We'll design the system to:
|
||||
|
||||
1. Be generic, so that it can be used with any table and content. This allows you to configure embeddings in multiple places, each with the ability to customize the input used for embedding generation. These will all use the same queue infrastructure and Edge Function to generate the embeddings.
|
||||
|
||||
1. Handle failures gracefully, by retrying failed jobs and providing detailed information about the status of each job.
|
||||
|
||||
## Implementation
|
||||
|
||||
We'll start by setting up the infrastructure needed to queue and process embedding generation requests. Then we'll create an example table with triggers to enqueue these embedding requests whenever content is inserted or updated.
|
||||
|
||||
### Step 1: Enable extensions
|
||||
|
||||
First, let's enable the required extensions:
|
||||
|
||||
<Tabs
|
||||
scrollable
|
||||
size="small"
|
||||
type="underlined"
|
||||
defaultActiveId="sql"
|
||||
queryGroup="database-method"
|
||||
>
|
||||
<TabPanel id="sql" label="SQL">
|
||||
|
||||
```sql
|
||||
-- For vector operations
|
||||
create extension if not exists vector
|
||||
with
|
||||
schema extensions;
|
||||
|
||||
-- For queueing and processing jobs
|
||||
-- (pgmq will create its own schema)
|
||||
create extension if not exists pgmq;
|
||||
|
||||
-- For async HTTP requests
|
||||
create extension if not exists pg_net
|
||||
with
|
||||
schema extensions;
|
||||
|
||||
-- For scheduled processing and retries
|
||||
-- (pg_cron will create its own schema)
|
||||
create extension if not exists pg_cron;
|
||||
|
||||
-- For clearing embeddings during updates
|
||||
create extension if not exists hstore
|
||||
with
|
||||
schema extensions;
|
||||
```
|
||||
|
||||
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
|
||||
To disable an extension, call `drop extension`.
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="dashboard" label="Dashboard">
|
||||
|
||||
1. Go to the [Extensions](/dashboard/project/_/database/extensions) page in the Dashboard.
|
||||
2. Search for and enable the following extensions:
|
||||
- `vector`
|
||||
- `pgmq`
|
||||
- `pg_net`
|
||||
- `pg_cron`
|
||||
- `hstore`
|
||||
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
### Step 2: Create utility functions
|
||||
|
||||
Before we set up our embedding logic, we need to create some utility functions:
|
||||
|
||||
```sql
|
||||
-- Schema for utility functions
|
||||
create schema util;
|
||||
|
||||
-- Utility function to get the Supabase project URL (required for Edge Functions)
|
||||
create function util.project_url()
|
||||
returns text
|
||||
language plpgsql
|
||||
security definer
|
||||
as $$
|
||||
declare
|
||||
secret_value text;
|
||||
begin
|
||||
-- Retrieve the project URL from Vault
|
||||
select decrypted_secret into secret_value from vault.decrypted_secrets where name = 'project_url';
|
||||
return secret_value;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- Generic function to invoke any Edge Function
|
||||
create or replace function util.invoke_edge_function(
|
||||
name text,
|
||||
body jsonb,
|
||||
timeout_milliseconds int = 5 * 60 * 1000 -- default 5 minute timeout
|
||||
)
|
||||
returns void
|
||||
language plpgsql
|
||||
as $$
|
||||
declare
|
||||
headers_raw text;
|
||||
auth_header text;
|
||||
begin
|
||||
-- If we're in a PostgREST session, reuse the request headers for authorization
|
||||
headers_raw := current_setting('request.headers', true);
|
||||
|
||||
-- Only try to parse if headers are present
|
||||
auth_header := case
|
||||
when headers_raw is not null then
|
||||
(headers_raw::json->>'authorization')
|
||||
else
|
||||
null
|
||||
end;
|
||||
|
||||
-- Perform async HTTP request to the edge function
|
||||
perform net.http_post(
|
||||
url => util.project_url() || '/functions/v1/' || name,
|
||||
headers => jsonb_build_object(
|
||||
'Content-Type', 'application/json',
|
||||
'Authorization', auth_header
|
||||
),
|
||||
body => body,
|
||||
timeout_milliseconds => timeout_milliseconds
|
||||
);
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- Generic trigger function to clear a column on update
|
||||
create or replace function util.clear_column()
|
||||
returns trigger
|
||||
language plpgsql as $$
|
||||
declare
|
||||
clear_column text := TG_ARGV[0];
|
||||
begin
|
||||
NEW := NEW #= hstore(clear_column, NULL);
|
||||
return NEW;
|
||||
end;
|
||||
$$;
|
||||
```
|
||||
|
||||
Here we create:
|
||||
|
||||
- A schema `util` to store utility functions.
|
||||
- A function to retrieve the Supabase project URL from [Vault](/docs/guides/database/vault). We'll add this secret next.
|
||||
- A generic function to invoke any Edge Function with a given name and request body.
|
||||
- A generic trigger function to clear a column on update. This function accepts the column name as an argument and sets it to `NULL` in the `NEW` record. We'll explain how to use this function later.
|
||||
|
||||
Every project has a unique API URL that is required to invoke Edge Functions. Let's go ahead and add the project URL secret to Vault depending on your environment.
|
||||
|
||||
When working with a local Supabase stack, add the following to your `supabase/seed.sql` file:
|
||||
|
||||
```sql
|
||||
select
|
||||
vault.create_secret('http://api.supabase.internal:8000', 'project_url');
|
||||
```
|
||||
|
||||
When deploying to the cloud platform, open the [SQL editor](/dashboard/project/_/sql/new) and run the following, replacing `<project-url>` with your [project's API URL](/dashboard/project/_/settings/api):
|
||||
|
||||
```sql
|
||||
select
|
||||
vault.create_secret('<project-url>', 'project_url');
|
||||
```
|
||||
|
||||
### Step 3: Create queue and triggers
|
||||
|
||||
Our goal is to automatically generate embeddings whenever content is inserted or updated within a table. We can use triggers and queues to achieve this. Our approach is to automatically queue embedding jobs whenever records are inserted or updated in a table, then process them asynchronously using a cron job. If a job fails, it will remain in the queue and be retried in the next scheduled task.
|
||||
|
||||
First we create a `pgmq` queue for processing embedding requests:
|
||||
|
||||
```sql
|
||||
-- Queue for processing embedding jobs
|
||||
select pgmq.create('embedding_jobs');
|
||||
```
|
||||
|
||||
Next we create a trigger function to queue embedding jobs. We'll use this function to handle both insert and update events:
|
||||
|
||||
```sql
|
||||
-- Generic trigger function to queue embedding jobs
|
||||
create or replace function util.queue_embeddings()
|
||||
returns trigger
|
||||
language plpgsql
|
||||
as $$
|
||||
declare
|
||||
content_function text = TG_ARGV[0];
|
||||
embedding_column text = TG_ARGV[1];
|
||||
begin
|
||||
perform pgmq.send(
|
||||
queue_name => 'embedding_jobs',
|
||||
msg => jsonb_build_object(
|
||||
'id', NEW.id,
|
||||
'schema', TG_TABLE_SCHEMA,
|
||||
'table', TG_TABLE_NAME,
|
||||
'contentFunction', content_function,
|
||||
'embeddingColumn', embedding_column
|
||||
)
|
||||
);
|
||||
return NEW;
|
||||
end;
|
||||
$$;
|
||||
```
|
||||
|
||||
Our `util.queue_embeddings` trigger function is generic and can be used with any table and content function. It accepts two arguments:
|
||||
|
||||
1. `content_function`: The name of a function that returns the text content to be embedded. The function should accept a single row as input and return text (see the `embedding_input` example).
|
||||
|
||||
This allows you to customize the text input passed to the embedding model - for example, you could concatenate multiple columns together like `title` and `content` and use the result as input.
|
||||
|
||||
2. `embedding_column`: The name of the destination column where the embedding will be stored.
|
||||
|
||||
Note that the `util.queue_embeddings` trigger function requires a `for each row` clause to work correctly. See [Usage](#usage) for an example of how to use this trigger function with your table.
|
||||
|
||||
Next we'll create a function to process the embedding jobs. This function will read jobs from the queue, group them into batches, and invoke the Edge Function to generate embeddings. We'll use `pg_cron` to schedule this function to run every 10 seconds.
|
||||
|
||||
```sql
|
||||
-- Function to process embedding jobs from the queue
|
||||
create or replace function util.process_embeddings(
|
||||
batch_size int = 10,
|
||||
max_requests int = 10,
|
||||
timeout_milliseconds int = 5 * 60 * 1000 -- default 5 minute timeout
|
||||
)
|
||||
returns void
|
||||
language plpgsql
|
||||
as $$
|
||||
declare
|
||||
job_batches jsonb[];
|
||||
batch jsonb;
|
||||
begin
|
||||
with
|
||||
-- First get jobs and assign batch numbers
|
||||
numbered_jobs as (
|
||||
select
|
||||
message || jsonb_build_object('jobId', msg_id) as job_info,
|
||||
(row_number() over (order by 1) - 1) / batch_size as batch_num
|
||||
from pgmq.read(
|
||||
queue_name => 'embedding_jobs',
|
||||
vt => timeout_milliseconds / 1000,
|
||||
qty => max_requests * batch_size
|
||||
)
|
||||
),
|
||||
-- Then group jobs into batches
|
||||
batched_jobs as (
|
||||
select
|
||||
jsonb_agg(job_info) as batch_array,
|
||||
batch_num
|
||||
from numbered_jobs
|
||||
group by batch_num
|
||||
)
|
||||
-- Finally aggregate all batches into array
|
||||
select array_agg(batch_array)
|
||||
from batched_jobs
|
||||
into job_batches;
|
||||
|
||||
-- Invoke the embed edge function for each batch
|
||||
foreach batch in array job_batches loop
|
||||
perform util.invoke_edge_function(
|
||||
name => 'embed',
|
||||
body => batch,
|
||||
timeout_milliseconds => timeout_milliseconds
|
||||
);
|
||||
end loop;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- Schedule the embedding processing
|
||||
select
|
||||
cron.schedule(
|
||||
'process-embeddings',
|
||||
'10 seconds',
|
||||
$$
|
||||
select util.process_embeddings();
|
||||
$$
|
||||
);
|
||||
```
|
||||
|
||||
Let's discuss some common questions about this approach:
|
||||
|
||||
#### Why not generate all embeddings in a single Edge Function request?
|
||||
|
||||
While this is possible, it can lead to long processing times and potential timeouts. Batching allows us to process multiple embeddings concurrently and handle failures more effectively.
|
||||
|
||||
#### Why not one request per row?
|
||||
|
||||
This approach can lead to API rate limiting and performance issues. Batching provides a balance between efficiency and reliability.
|
||||
|
||||
#### Why queue requests instead of processing them immediately?
|
||||
|
||||
Queuing allows us to handle failures gracefully, retry requests, and manage concurrency more effectively. Specifically we are using `pgmq`'s visibility timeouts to ensure that failed requests are retried.
|
||||
|
||||
#### How do visibility timeouts work?
|
||||
|
||||
Every time we read a message from the queue, we set a visibility timeout which tells `pgmq` to hide the message from other readers for a certain period. If the Edge Function fails to process the message within this period, the message becomes visible again and will be retried by the next scheduled task.
|
||||
|
||||
#### How do we handle retries?
|
||||
|
||||
We use `pg_cron` to schedule a task that reads messages from the queue and processes them. If the Edge Function fails to process a message, it becomes visible again after a timeout and can be retried by the next scheduled task.
|
||||
|
||||
#### Is 10 seconds a good interval for processing?
|
||||
|
||||
This interval is a good starting point, but you may need to adjust it based on your workload and the time it takes to generate embeddings. You can adjust the `batch_size`, `max_requests`, and `timeout_milliseconds` parameters to optimize performance.
|
||||
|
||||
### Step 4: Create the Edge Function
|
||||
|
||||
Finally we'll create the Edge Function to generate embeddings. We'll use OpenAI's API in this example, but you can replace it with any other embedding generation service.
|
||||
|
||||
Use the Supabase CLI to create a new Edge Function:
|
||||
|
||||
```bash
|
||||
supabase functions new embed
|
||||
```
|
||||
|
||||
This will create a new directory `supabase/functions/embed` with an `index.ts` file. Replace the contents of this file with the following:
|
||||
|
||||
_supabase/functions/embed/index.ts_:
|
||||
|
||||
```typescript
|
||||
// Setup type definitions for built-in Supabase Runtime APIs
|
||||
import 'jsr:@supabase/functions-js/edge-runtime.d.ts'
|
||||
|
||||
// We'll use the OpenAI API to generate embeddings
|
||||
import OpenAI from 'jsr:@openai/openai'
|
||||
|
||||
import { z } from 'npm:zod'
|
||||
|
||||
// We'll make a direct Postgres connection to update the document
|
||||
import postgres from 'https://deno.land/x/postgresjs@v3.4.5/mod.js'
|
||||
|
||||
// Initialize OpenAI client
|
||||
const openai = new OpenAI({
|
||||
// We'll need to manually set the `OPENAI_API_KEY` environment variable
|
||||
apiKey: Deno.env.get('OPENAI_API_KEY'),
|
||||
})
|
||||
|
||||
// Initialize Postgres client
|
||||
const sql = postgres(
|
||||
// `SUPABASE_DB_URL` is a built-in environment variable
|
||||
Deno.env.get('SUPABASE_DB_URL')!
|
||||
)
|
||||
|
||||
const jobSchema = z.object({
|
||||
jobId: z.number(),
|
||||
id: z.number(),
|
||||
schema: z.string(),
|
||||
table: z.string(),
|
||||
contentFunction: z.string(),
|
||||
embeddingColumn: z.string(),
|
||||
})
|
||||
|
||||
const failedJobSchema = jobSchema.extend({
|
||||
error: z.string(),
|
||||
})
|
||||
|
||||
type Job = z.infer<typeof jobSchema>
|
||||
type FailedJob = z.infer<typeof failedJobSchema>
|
||||
|
||||
type Row = {
|
||||
id: string
|
||||
content: unknown
|
||||
}
|
||||
|
||||
const QUEUE_NAME = 'embedding_jobs'
|
||||
|
||||
// Listen for HTTP requests
|
||||
Deno.serve(async (req) => {
|
||||
if (req.method !== 'POST') {
|
||||
return new Response('expected POST request', { status: 405 })
|
||||
}
|
||||
|
||||
if (req.headers.get('content-type') !== 'application/json') {
|
||||
return new Response('expected json body', { status: 400 })
|
||||
}
|
||||
|
||||
// Use Zod to parse and validate the request body
|
||||
const parseResult = z.array(jobSchema).safeParse(await req.json())
|
||||
|
||||
if (parseResult.error) {
|
||||
return new Response(`invalid request body: ${parseResult.error.message}`, {
|
||||
status: 400,
|
||||
})
|
||||
}
|
||||
|
||||
const pendingJobs = parseResult.data
|
||||
|
||||
// Track jobs that completed successfully
|
||||
const completedJobs: Job[] = []
|
||||
|
||||
// Track jobs that failed due to an error
|
||||
const failedJobs: FailedJob[] = []
|
||||
|
||||
async function processJobs() {
|
||||
let currentJob: Job | undefined
|
||||
|
||||
while ((currentJob = pendingJobs.shift()) !== undefined) {
|
||||
try {
|
||||
await processJob(currentJob)
|
||||
completedJobs.push(currentJob)
|
||||
} catch (error) {
|
||||
failedJobs.push({
|
||||
...currentJob,
|
||||
error: error instanceof Error ? error.message : JSON.stringify(error),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Process jobs while listening for worker termination
|
||||
await Promise.race([processJobs(), catchUnload()])
|
||||
} catch (error) {
|
||||
// If the worker is terminating (e.g. wall clock limit reached),
|
||||
// add pending jobs to fail list with termination reason
|
||||
failedJobs.push(
|
||||
...pendingJobs.map((job) => ({
|
||||
...job,
|
||||
error: error instanceof Error ? error.message : JSON.stringify(error),
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
// Log completed and failed jobs for traceability
|
||||
console.log('finished processing jobs:', {
|
||||
completedJobs: completedJobs.length,
|
||||
failedJobs: failedJobs.length,
|
||||
})
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
completedJobs,
|
||||
failedJobs,
|
||||
}),
|
||||
{
|
||||
// 200 OK response
|
||||
status: 200,
|
||||
|
||||
// Custom headers to report job status
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Completed-Jobs': completedJobs.length.toString(),
|
||||
'X-Failed-Jobs': failedJobs.length.toString(),
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates an embedding for the given text.
|
||||
*/
|
||||
async function generateEmbedding(text: string) {
|
||||
const response = await openai.embeddings.create({
|
||||
model: 'text-embedding-3-small',
|
||||
input: text,
|
||||
})
|
||||
const [data] = response.data
|
||||
|
||||
if (!data) {
|
||||
throw new Error('failed to generate embedding')
|
||||
}
|
||||
|
||||
return data.embedding
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an embedding job.
|
||||
*/
|
||||
async function processJob(job: Job) {
|
||||
const { jobId, id, schema, table, contentFunction, embeddingColumn } = job
|
||||
|
||||
// Fetch content for the schema/table/row combination
|
||||
const [row]: [Row] = await sql`
|
||||
select
|
||||
id,
|
||||
${sql(contentFunction)}(t) as content
|
||||
from
|
||||
${sql(schema)}.${sql(table)} t
|
||||
where
|
||||
id = ${id}
|
||||
`
|
||||
|
||||
if (!row) {
|
||||
throw new Error(`row not found: ${schema}.${table}/${id}`)
|
||||
}
|
||||
|
||||
if (typeof row.content !== 'string') {
|
||||
throw new Error(`invalid content - expected string: ${schema}.${table}/${id}`)
|
||||
}
|
||||
|
||||
const embedding = await generateEmbedding(row.content)
|
||||
|
||||
await sql`
|
||||
update
|
||||
${sql(schema)}.${sql(table)}
|
||||
set
|
||||
${sql(embeddingColumn)} = ${JSON.stringify(embedding)}
|
||||
where
|
||||
id = ${id}
|
||||
`
|
||||
|
||||
await sql`
|
||||
select pgmq.delete(${QUEUE_NAME}, ${jobId}::bigint)
|
||||
`
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that rejects if the worker is terminating.
|
||||
*/
|
||||
function catchUnload() {
|
||||
return new Promise((reject) => {
|
||||
addEventListener('beforeunload', (ev: any) => {
|
||||
reject(new Error(ev.detail?.reason))
|
||||
})
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
The Edge Function listens for incoming HTTP requests from `pg_net` and processes each embedding job. It is a generic worker that can handle embedding jobs for any table and column. It uses OpenAI's API to generate embeddings and updates the corresponding row in the database. It also deletes the job from the queue once it has been processed.
|
||||
|
||||
The function is designed to process multiple jobs independently. If one job fails, it will not affect the processing of other jobs. The function returns a `200 OK` response with a list of completed and failed jobs. We can use this information to diagnose failed jobs. See [Troubleshooting](#troubleshooting) for more details.
|
||||
|
||||
You will need to set the `OPENAI_API_KEY` environment variable to authenticate with OpenAI. When running the Edge Function locally, you can add it to a `.env` file:
|
||||
|
||||
_.env_:
|
||||
|
||||
```
|
||||
OPENAI_API_KEY=your-api-key
|
||||
```
|
||||
|
||||
When you're ready to deploy the Edge Function, set can set the environment variable using the Supabase CLI:
|
||||
|
||||
```shell
|
||||
supabase secrets set --env-file .env
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
supabase secrets set OPENAI_API_KEY=<your-api-key>
|
||||
```
|
||||
|
||||
Alternatively, you can replace the `generateEmbedding` function with your own embedding generation logic.
|
||||
|
||||
See [Deploy to Production](/docs/guides/functions/deploy) for more information on how to deploy the Edge Function.
|
||||
|
||||
## Usage
|
||||
|
||||
Now that the infrastructure is in place, let's go through an example of how to use this system to automatically generate embeddings for a table of documents. You can use this approach with multiple tables and customize the input for each embedding generation as needed.
|
||||
|
||||
### 1. Create table to store documents with embeddings
|
||||
|
||||
We'll set up a new `documents` table that will store our content and embeddings:
|
||||
|
||||
```sql
|
||||
-- Table to store documents with embeddings
|
||||
create table documents (
|
||||
id integer primary key generated always as identity,
|
||||
title text not null,
|
||||
content text not null,
|
||||
embedding halfvec,
|
||||
created_at timestamp with time zone default now()
|
||||
);
|
||||
|
||||
-- Index for vector search over document embeddings
|
||||
create index on documents using hnsw (embedding halfvec_cosine_ops);
|
||||
```
|
||||
|
||||
Our `documents` table stores the title and content of each document along with its vector embedding. We use a `halfvec` column to store the embeddings, which is a `pgvector` data type that stores float values in half precision (16 bits) to save space.
|
||||
|
||||
We use an [HNSW index](/docs/guides/ai/vector-indexes/hnsw-indexes) on the vector column. Note that we are choosing `halfvec_cosine_ops` as the index method, which means our future queries will need to use cosine distance (`<=>`) to find similar embeddings. Also note that HNSW indexes support a maximum of 4000 dimensions for `halfvec` vectors, so keep this in mind when choosing an embedding model. If your model generates embeddings with more than 4000 dimensions, you will need to reduce the dimensionality before indexing them. See [Matryoshka embeddings](/blog/matryoshka-embeddings) for a potential solution to shortening dimensions.
|
||||
|
||||
Also note that the table must have a primary key column named `id` for our triggers to work correctly with the `util.queue_embeddings` function and for our Edge Function to update the correct row.
|
||||
|
||||
### 2. Create triggers to enqueue embedding jobs
|
||||
|
||||
Now we'll set up the triggers to enqueue embedding jobs whenever content is inserted or updated:
|
||||
|
||||
```sql
|
||||
-- Customize the input for embedding generation
|
||||
-- e.g. Concatenate title and content with a markdown header
|
||||
create or replace function embedding_input(doc documents)
|
||||
returns text
|
||||
language plpgsql
|
||||
immutable
|
||||
as $$
|
||||
begin
|
||||
return '# ' || doc.title || E'\n\n' || doc.content;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- Trigger for insert events
|
||||
create trigger embed_documents_on_insert
|
||||
after insert
|
||||
on documents
|
||||
for each row
|
||||
execute function util.queue_embeddings('embedding_input', 'embedding');
|
||||
|
||||
-- Trigger for update events
|
||||
create trigger embed_documents_on_update
|
||||
after update of title, content -- must match the columns in embedding_input()
|
||||
on documents
|
||||
for each row
|
||||
execute function util.queue_embeddings('embedding_input', 'embedding');
|
||||
```
|
||||
|
||||
We create 2 triggers:
|
||||
|
||||
1. `embed_documents_on_insert`: Enqueues embedding jobs whenever new rows are inserted into the `documents` table.
|
||||
|
||||
2. `embed_documents_on_update`: Enqueues embedding jobs whenever the `title` or `content` columns are updated in the `documents` table.
|
||||
|
||||
Both of these triggers use the same `util.queue_embeddings` function that will queue the embedding jobs for processing. They accept 2 arguments:
|
||||
|
||||
1. `embedding_input`: The name of the function that generates the input for embedding generation. This function allows you to customize the text input passed to the embedding model (e.g. concatenating the title and content). The function should accept a single row as input and return text.
|
||||
|
||||
2. `embedding`: The name of the destination column where the embedding will be stored.
|
||||
|
||||
Note that the update trigger only fires when the `title` or `content` columns are updated. This is to avoid unnecessary updates to the embedding column when other columns are updated. Make sure that these columns match the columns used in the `embedding_input` function.
|
||||
|
||||
{/* supa-mdx-lint-disable-next-line Rule001HeadingCase */}
|
||||
|
||||
#### (Optional) Clearing embeddings on update
|
||||
|
||||
Note that our trigger will enqueue new embedding jobs when content is updated, but it will not clear any existing embeddings. This means that an embedding can be temporarily out of sync with the content until the new embedding is generated and updated.
|
||||
|
||||
If it is more important to have _accurate_ embeddings than _any_ embedding, you can add another trigger to clear the existing embedding until the new one is generated:
|
||||
|
||||
```sql
|
||||
-- Trigger to clear the embedding column on update
|
||||
create trigger clear_document_embedding_on_update
|
||||
before update of title, content -- must match the columns in embedding_input()
|
||||
on documents
|
||||
for each row
|
||||
execute function util.clear_column('embedding');
|
||||
```
|
||||
|
||||
`util.clear_column` is a generic trigger function we created earlier that can be used to clear any column in a table.
|
||||
|
||||
- It accepts the column name as an argument. This column must be nullable.
|
||||
- It requires a `before` trigger with a `for each row` clause.
|
||||
- It requires the `hstore` extension we created earlier.
|
||||
|
||||
This example will clear the `embedding` column whenever the `title` or `content` columns are updated (note the `of title, content` clause). This ensures that the embedding is always in sync with the title and content, but it will result in temporary gaps in search results until the new embedding is generated.
|
||||
|
||||
We intentionally use a `before` trigger because it allows us to modify the record before it's written to disk, avoiding an extra `update` statement that would be needed with an `after` trigger.
|
||||
|
||||
### 3. Insert and update documents
|
||||
|
||||
Let's insert a new document and update its content to see the embedding generation in action:
|
||||
|
||||
```sql
|
||||
-- Insert a new document
|
||||
insert into documents (title, content)
|
||||
values
|
||||
('Understanding Vector Databases', 'Vector databases are specialized...');
|
||||
|
||||
-- Immediately check the embedding column
|
||||
select id, embedding
|
||||
from documents
|
||||
where title = 'Understanding Vector Databases';
|
||||
```
|
||||
|
||||
You should observe that the `embedding` column is initially `null` after inserting the document. This is because the embedding generation is asynchronous and will be processed by the Edge Function in the next scheduled task.
|
||||
|
||||
Wait up to 10 seconds for the next task to run, then check the `embedding` column again:
|
||||
|
||||
```sql
|
||||
select id, embedding
|
||||
from documents
|
||||
where title = 'Understanding Vector Databases';
|
||||
```
|
||||
|
||||
You should see the generated embedding for the document.
|
||||
|
||||
Next let's update the content of the document:
|
||||
|
||||
```sql
|
||||
-- Update the content of the document
|
||||
update documents
|
||||
set content = 'Vector databases allow you to query...'
|
||||
where title = 'Understanding Vector Databases';
|
||||
|
||||
-- Immediately check the embedding column
|
||||
select id, embedding
|
||||
from documents
|
||||
where title = 'Understanding Vector Databases';
|
||||
```
|
||||
|
||||
You should observe that the `embedding` column is reset to `null` after updating the content. This is because of the trigger we added to clear existing embeddings whenever the content is updated. The embedding will be regenerated by the Edge Function in the next scheduled task.
|
||||
|
||||
Wait up to 10 seconds for the next task to run, then check the `embedding` column again:
|
||||
|
||||
```sql
|
||||
select id, embedding
|
||||
from documents
|
||||
where title = 'Understanding Vector Databases';
|
||||
```
|
||||
|
||||
You should see the updated embedding for the document.
|
||||
|
||||
Finally we'll update the title of the document:
|
||||
|
||||
```sql
|
||||
-- Update the title of the document
|
||||
update documents
|
||||
set title = 'Understanding Vector Databases with Supabase'
|
||||
where title = 'Understanding Vector Databases';
|
||||
```
|
||||
|
||||
You should observe that the `embedding` column is once again reset to `null` after updating the title. This is because the trigger we added to clear existing embeddings fires when either the `content` or `title` columns are updated. The embedding will be regenerated by the Edge Function in the next scheduled task.
|
||||
|
||||
Wait up to 10 seconds for the next task to run, then check the `embedding` column again:
|
||||
|
||||
```sql
|
||||
select id, embedding
|
||||
from documents
|
||||
where title = 'Understanding Vector Databases with Supabase';
|
||||
```
|
||||
|
||||
You should see the updated embedding for the document.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
The `embed` Edge Function processes a batch of embedding jobs and returns a `200 OK` response with a list of completed and failed jobs in the body. For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"completedJobs": [
|
||||
{
|
||||
"jobId": "1",
|
||||
"id": "1",
|
||||
"schema": "public",
|
||||
"table": "documents",
|
||||
"contentFunction": "embedding_input",
|
||||
"embeddingColumn": "embedding"
|
||||
}
|
||||
],
|
||||
"failedJobs": [
|
||||
{
|
||||
"jobId": "2",
|
||||
"id": "2",
|
||||
"schema": "public",
|
||||
"table": "documents",
|
||||
"contentFunction": "embedding_input",
|
||||
"embeddingColumn": "embedding",
|
||||
"error": "error connecting to openai api"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
It also returns the number of completed and failed jobs in the response headers. For example:
|
||||
|
||||
```
|
||||
X-Completed-Jobs: 1
|
||||
X-Failed-Jobs: 1
|
||||
```
|
||||
|
||||
You can also use the `X-Deno-Execution-Id` header to trace the execution of the Edge Function within the [dashboard](/dashboard/project/_/functions) logs.
|
||||
|
||||
Each failed job includes an `error` field with a description of the failure. Reasons for a job failing could include:
|
||||
|
||||
- An error generating the embedding via external API
|
||||
- An error connecting to the database
|
||||
- The edge function being terminated (e.g. due to a wall clock limit)
|
||||
- Any other error thrown during processing
|
||||
|
||||
`pg_net` stores HTTP responses in the `net._http_response` table, which can be queried to diagnose issues with the embedding generation process.
|
||||
|
||||
```sql
|
||||
select
|
||||
*
|
||||
from
|
||||
net._http_response
|
||||
where
|
||||
(headers->>'X-Failed-Jobs')::int > 0;
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
Automating embedding generation and updates in Postgres allow you to build powerful semantic search capabilities without the complexity of managing embeddings manually.
|
||||
|
||||
By combining Postgres features like triggers, queues, and other extensions with Supabase Edge Functions, we can create a robust system that handles embedding generation asynchronously and retries failed jobs automatically.
|
||||
|
||||
This system can be customized to work with any content and embedding generation service, providing a flexible and scalable solution for semantic search in Postgres.
|
||||
|
||||
## See also
|
||||
|
||||
- [What are embeddings?](/docs/guides/ai/concepts)
|
||||
- [Semantic search](/docs/guides/ai/semantic-search)
|
||||
- [Vector indexes](/docs/guides/ai/vector-indexes)
|
||||
- [Supabase Edge Functions](/docs/guides/functions)
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
id: automatic-retries-in-supabase-js
|
||||
title: 'How to do automatic retries with `supabase-js`'
|
||||
subtitle: 'Learn how to add automatic retries to your Supabase API requests using `fetch-retry`.'
|
||||
---
|
||||
|
||||
<Admonition type="danger" title="Important">
|
||||
|
||||
You should only enable retries if your requests fail with network errors (e.g. 520 status from Cloudflare). A high number of retries have the potential to exhaust the Data API connection pool, which could result in lower throughput and failed requests.
|
||||
|
||||
</Admonition>
|
||||
|
||||
The `fetch-retry` package allows you to add retry logic to `fetch` requests, making it a useful tool for enhancing the resilience of API calls in your Supabase applications. Here's a step-by-step guide on how to integrate `fetch-retry` with the `supabase-js` library.
|
||||
|
||||
## 1. Install dependencies
|
||||
|
||||
To get started, ensure you have both `supabase-js` and `fetch-retry` installed in your project:
|
||||
|
||||
```bash
|
||||
npm install @supabase/supabase-js fetch-retry
|
||||
```
|
||||
|
||||
## 2. Wrap the fetch function
|
||||
|
||||
The `fetch-retry` package works by wrapping the native `fetch` function. You can create a custom fetch instance with retry logic and pass it to the `supabase-js` client.
|
||||
|
||||
```javascript
|
||||
import { createClient } from '@supabase/supabase-js'
|
||||
import fetchRetry from 'fetch-retry'
|
||||
|
||||
// Wrap the global fetch with fetch-retry
|
||||
const fetchWithRetry = fetchRetry(fetch)
|
||||
|
||||
// Create a Supabase client instance with the custom fetch
|
||||
const supabase = createClient('https://your-supabase-url.supabase.co', 'your-anon-key', {
|
||||
global: {
|
||||
fetch: fetchWithRetry,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
## 3. Configure retry options
|
||||
|
||||
You can configure `fetch-retry` options to control retry behavior, such as the number of retries, retry delay, and which errors should trigger a retry.
|
||||
|
||||
Here is an example with custom retry options:
|
||||
|
||||
```javascript
|
||||
const fetchWithRetry = fetchRetry(fetch, {
|
||||
retries: 3, // Number of retry attempts
|
||||
retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000), // Exponential backoff
|
||||
retryOn: [520], // Retry only on Cloudflare errors
|
||||
})
|
||||
```
|
||||
|
||||
In this example, the `retryDelay` function implements an exponential backoff strategy, and retries are triggered only for specific HTTP status codes.
|
||||
|
||||
## 4. Using the Supabase client
|
||||
|
||||
With `fetch-retry` integrated, you can use the Supabase client as usual. The retry logic will automatically apply to all network requests made by `supabase-js`.
|
||||
|
||||
```javascript
|
||||
async function fetchData() {
|
||||
const { data, error } = await supabase.from('your_table').select('*')
|
||||
|
||||
if (error) {
|
||||
console.error('Error fetching data:', error)
|
||||
} else {
|
||||
console.log('Fetched data:', data)
|
||||
}
|
||||
}
|
||||
|
||||
fetchData()
|
||||
```
|
||||
|
||||
## 5. Fine-Tuning retries for specific requests
|
||||
|
||||
If you need different retry logic for certain requests, you can use the `retryOn` with a custom function to inspect the URL or response and decide whether to retry the request.
|
||||
|
||||
```javascript
|
||||
const fetchWithRetry = fetchRetry(fetch, {
|
||||
retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 30000),
|
||||
retryOn: (attempt, error, response) => {
|
||||
const shouldRetry
|
||||
= (attempt: number, error: Error | null, response: Response | null) =>
|
||||
attempt < 3
|
||||
&& response
|
||||
&& response.status == 520 // Cloudflare errors
|
||||
&& response.url.includes('rpc/your_stored_procedure')
|
||||
|
||||
if (shouldRetry(attempt, error, response)) {
|
||||
console.log(`Retrying request... Attempt #${attempt}`, response)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
async function yourStoredProcedure() {
|
||||
const { data, error } = await supabase
|
||||
.rpc('your_stored_procedure', { param1: 'value1' });
|
||||
|
||||
if (error) {
|
||||
console.log('Error executing RPC:', error);
|
||||
} else {
|
||||
console.log('Response:', data);
|
||||
}
|
||||
}
|
||||
|
||||
yourStoredProcedure();
|
||||
```
|
||||
|
||||
By using `retryOn` with a custom function, you can define specific conditions for retrying requests. In this example, the retry logic is applied only to requests targeting a specific stored procedure.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Integrating `fetch-retry` with `supabase-js` is a straightforward way to add robustness to your Supabase API requests. By handling transient errors and implementing retry strategies, you can improve the reliability of your application while maintaining a seamless user experience.
|
||||
@@ -72,7 +72,7 @@ hideToc: true
|
||||
|
||||
Start the development server, go to http://localhost:3000 in a browser, and you should see the contents of `app/page.tsx`.
|
||||
|
||||
To sign up a new user, navigate to http://localhost:3000/login, and click `Sign Up Now`.
|
||||
To sign up a new user, navigate to http://localhost:3000/sign-up, and click `Sign up`. *NOTE: .env.example must be renamed to .env.local before this route becomes available*
|
||||
|
||||
</StepHikeCompact.Details>
|
||||
|
||||
|
||||
@@ -98,11 +98,11 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
<TabPanel id="yarn_initiate" label="yarn">
|
||||
```bash
|
||||
yarn init -y
|
||||
yarn install prisma typescript ts-node @types/node --save-dev
|
||||
yarn add prisma typescript ts-node @types/node --save-dev
|
||||
|
||||
yarn dlx tsc --init
|
||||
npx tsc --init
|
||||
|
||||
yarn dlx prisma init
|
||||
npx prisma init
|
||||
```
|
||||
</TabPanel>
|
||||
<TabPanel id="bun_initiate" label="bun">
|
||||
@@ -241,7 +241,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
</TabPanel>
|
||||
<TabPanel id="yarn_migrate" label="yarn">
|
||||
```bash
|
||||
yarn dlx prisma migrate dev --name first_prisma_migration
|
||||
npx prisma migrate dev --name first_prisma_migration
|
||||
|
||||
```
|
||||
</TabPanel>
|
||||
@@ -318,7 +318,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
|
||||
<TabPanel id="yarn_sync" label="yarn">
|
||||
```bash
|
||||
yarn dlx prisma db pull
|
||||
npx prisma db pull
|
||||
```
|
||||
|
||||
Create a migration file
|
||||
@@ -328,7 +328,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
|
||||
Synchronize the migrations
|
||||
```bash
|
||||
yarn dlx prisma migrate diff \
|
||||
npx prisma migrate diff \
|
||||
--from-empty \
|
||||
--to-schema-datamodel prisma/schema.prisma \
|
||||
--script > prisma/migrations/0_init_supabase/migration.sql
|
||||
@@ -338,7 +338,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
</Admonition>
|
||||
|
||||
```bash
|
||||
yarn dlx prisma migrate resolve --applied 0_init_supabase
|
||||
npx prisma migrate resolve --applied 0_init_supabase
|
||||
```
|
||||
</TabPanel>
|
||||
|
||||
@@ -403,8 +403,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
</TabPanel>
|
||||
<TabPanel id="yarn_client" label="yarn">
|
||||
```sh
|
||||
yarn install @prisma/client
|
||||
yarn dlx prisma generate
|
||||
yarn add @prisma/client
|
||||
npx prisma generate
|
||||
```
|
||||
</TabPanel>
|
||||
<TabPanel id="bun_client" label="bun">
|
||||
|
||||
@@ -6,7 +6,7 @@ description: 'Deploy Supabase projects on the Fly.io platform'
|
||||
|
||||
Fly Postgres databases are deployed on the Fly.io edge network. Fly Postgres is supported in [every region](https://fly.io/docs/reference/regions/) where Fly.io operates.
|
||||
|
||||
<Admonition type="note">
|
||||
<Admonition type="deprecation">
|
||||
|
||||
Fly Postgres is being deprecated on March 14, 2025. Head over to the [announcement](https://github.com/orgs/supabase/discussions/33413) for more information.
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ExternalLink } from 'lucide-react'
|
||||
import { type SerializeOptions } from 'next-mdx-remote/dist/types'
|
||||
import { type ReactNode } from 'react'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
|
||||
import { cn } from 'ui'
|
||||
|
||||
@@ -78,9 +79,13 @@ const GuideTemplate = ({ meta, content, children, editLink, mdxOptions }: GuideT
|
||||
id="sb-docs-guide-main-article"
|
||||
className="prose max-w-none"
|
||||
>
|
||||
<h1 className="mb-0">{meta?.title || 'Supabase Docs'}</h1>
|
||||
<h1 className="mb-0">
|
||||
<ReactMarkdown>{meta?.title || 'Supabase Docs'}</ReactMarkdown>
|
||||
</h1>
|
||||
{meta?.subtitle && (
|
||||
<h2 className="mt-3 text-xl text-foreground-light">{meta.subtitle}</h2>
|
||||
<h2 className="mt-3 text-xl text-foreground-light">
|
||||
<ReactMarkdown>{meta.subtitle}</ReactMarkdown>
|
||||
</h2>
|
||||
)}
|
||||
<hr className="not-prose border-t-0 border-b my-8" />
|
||||
<MDXProviderGuides>
|
||||
|
||||
@@ -89,7 +89,7 @@ const getGuidesMarkdownInternal = async (slug: string[]) => {
|
||||
const getGuidesMarkdown = cache_fullProcess_withDevCacheBust(
|
||||
getGuidesMarkdownInternal,
|
||||
GUIDES_DIRECTORY,
|
||||
(filename: string) => JSON.stringify([{ slug: filename.replace(/\.mdx$/, '').split(sep) }])
|
||||
(filename: string) => JSON.stringify([filename.replace(/\.mdx$/, '').split(sep)])
|
||||
)
|
||||
|
||||
const genGuidesStaticParams = (directory?: string) => async () => {
|
||||
|
||||
@@ -4501,7 +4501,7 @@
|
||||
"type": "string",
|
||||
"enum": ["internal", "alpha", "beta", "ga", "withdrawn", "preview"]
|
||||
},
|
||||
"postgres_engine": { "type": "string", "enum": ["13", "14", "15", "17-oriole"] }
|
||||
"postgres_engine": { "type": "string", "enum": ["13", "14", "15", "17", "17-oriole"] }
|
||||
},
|
||||
"required": ["version", "release_channel", "postgres_engine"]
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
clispec: '001'
|
||||
info:
|
||||
id: cli
|
||||
version: 2.9.6
|
||||
version: 2.12.0
|
||||
title: Supabase CLI
|
||||
language: sh
|
||||
source: https://github.com/supabase/cli
|
||||
@@ -3006,7 +3006,7 @@ commands:
|
||||
Linked project is up to date.
|
||||
- id: self-hosted
|
||||
name: Self hosted
|
||||
code: supabase db push --db-url "postgres://user:pass@127.0.0.1:5432/postgres"
|
||||
code: supabase db push --db-url "postgres://user.tenant:pass@127.0.0.1:5432"
|
||||
response: |
|
||||
Pushing migration 20230410135622_create_employees_table.sql...
|
||||
Finished supabase db push.
|
||||
|
||||
@@ -2883,7 +2883,7 @@ functions:
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```kotlin
|
||||
val supabase = createSupabaseClient(supabaseURL = "https://xyzcompany.supabase.co'", supabaseKey = "public-anon-key") { ... }
|
||||
val supabase = createSupabaseClient(supabaseUrl = "https://xyzcompany.supabase.co'", supabaseKey = "public-anon-key") { ... }
|
||||
val auth = supabase.auth
|
||||
```
|
||||
- id: sign-up
|
||||
|
||||
@@ -8234,7 +8234,7 @@
|
||||
},
|
||||
"postgres_engine": {
|
||||
"type": "string",
|
||||
"enum": ["13", "14", "15", "17-oriole"]
|
||||
"enum": ["13", "14", "15", "17", "17-oriole"]
|
||||
}
|
||||
},
|
||||
"required": ["version", "release_channel", "postgres_engine"]
|
||||
@@ -14521,7 +14521,7 @@
|
||||
},
|
||||
"postgres_engine": {
|
||||
"type": "string",
|
||||
"enum": ["13", "14", "15", "17-oriole"]
|
||||
"enum": ["13", "14", "15", "17", "17-oriole"]
|
||||
}
|
||||
},
|
||||
"required": ["version", "release_channel", "postgres_engine"]
|
||||
@@ -14543,7 +14543,7 @@
|
||||
},
|
||||
"postgres_engine": {
|
||||
"type": "string",
|
||||
"enum": ["13", "14", "15", "17-oriole"]
|
||||
"enum": ["13", "14", "15", "17", "17-oriole"]
|
||||
}
|
||||
},
|
||||
"required": ["version", "release_channel", "postgres_engine"]
|
||||
|
||||
@@ -10,7 +10,8 @@ module.exports = config({
|
||||
'./layouts/**/*.tsx',
|
||||
'./pages/**/*.{tsx,mdx}',
|
||||
'./../../packages/ui/src/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/!(node_modules)/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/**/*.{tsx,ts,js}',
|
||||
'!./../../packages/ui-patterns/node_modules/**/*', // ignore node_modules rule
|
||||
],
|
||||
plugins: [
|
||||
function ({ addUtilities, addVariant }) {
|
||||
|
||||
@@ -41,3 +41,6 @@ export function urlRegex(
|
||||
'i'
|
||||
)
|
||||
}
|
||||
|
||||
// Use a const string to represent no chars option. Represented as empty string on the backend side.
|
||||
export const NO_REQUIRED_CHARACTERS = 'NO_REQUIRED_CHARS'
|
||||
@@ -7,6 +7,7 @@ import ReactMarkdown from 'react-markdown'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { Markdown } from 'components/interfaces/Markdown'
|
||||
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
|
||||
import { DocsButton } from 'components/ui/DocsButton'
|
||||
import { ResourceItem } from 'components/ui/Resource/ResourceItem'
|
||||
@@ -30,10 +31,10 @@ import {
|
||||
SheetTitle,
|
||||
WarningIcon,
|
||||
} from 'ui'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
import { NO_REQUIRED_CHARACTERS } from '../Auth.constants'
|
||||
import type { Provider } from './AuthProvidersForm.types'
|
||||
import FormField from './FormField'
|
||||
import { Markdown } from 'components/interfaces/Markdown'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
|
||||
export interface ProviderFormProps {
|
||||
config: components['schemas']['GoTrueConfigResponse']
|
||||
@@ -154,6 +155,11 @@ const ProviderForm = ({ config, provider, isActive }: ProviderFormProps) => {
|
||||
if (payload[x] === '') payload[x] = null
|
||||
})
|
||||
|
||||
// The backend uses empty string to represent no required characters in the password
|
||||
if (payload.PASSWORD_REQUIRED_CHARACTERS === NO_REQUIRED_CHARACTERS) {
|
||||
payload.PASSWORD_REQUIRED_CHARACTERS = ''
|
||||
}
|
||||
|
||||
updateAuthConfig(
|
||||
{ projectRef: projectRef!, config: payload },
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { boolean, number, object, string } from 'yup'
|
||||
import { urlRegex } from 'components/interfaces/Auth/Auth.constants'
|
||||
import { NO_REQUIRED_CHARACTERS, urlRegex } from 'components/interfaces/Auth/Auth.constants'
|
||||
import { ProjectAuthConfigData } from 'data/auth/auth-config-query'
|
||||
import { boolean, number, object, string } from 'yup'
|
||||
|
||||
const parseBase64URL = (b64url: string) => {
|
||||
return atob(b64url.replace(/[-]/g, '+').replace(/[_]/g, '/'))
|
||||
@@ -56,7 +56,7 @@ const PROVIDER_EMAIL = {
|
||||
enum: [
|
||||
{
|
||||
label: 'No required characters (default)',
|
||||
value: 'NO_REQUIRED_CHARS',
|
||||
value: NO_REQUIRED_CHARACTERS,
|
||||
},
|
||||
{
|
||||
label: 'Letters and digits',
|
||||
|
||||
+5
-2
@@ -10,6 +10,10 @@ import { yupResolver } from '@hookform/resolvers/yup'
|
||||
import { useParams } from 'common'
|
||||
import { Markdown } from 'components/interfaces/Markdown'
|
||||
import { FormFieldWrapper } from 'components/ui/Forms'
|
||||
import { FormActions } from 'components/ui/Forms/FormActions'
|
||||
import { FormHeader } from 'components/ui/Forms/FormHeader'
|
||||
import { FormPanel } from 'components/ui/Forms/FormPanel'
|
||||
import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
|
||||
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
|
||||
@@ -30,8 +34,7 @@ import {
|
||||
} from 'ui'
|
||||
import { SectionHeader } from 'components/layouts/PageLayout'
|
||||
|
||||
// Use a const string to represent no chars option. Represented as empty string on the backend side.
|
||||
const NO_REQUIRED_CHARACTERS = 'NO_REQUIRED_CHARS'
|
||||
import { NO_REQUIRED_CHARACTERS } from '../Auth.constants'
|
||||
|
||||
const schema = object({
|
||||
DISABLE_SIGNUP: boolean().required(),
|
||||
|
||||
+2
-7
@@ -6,15 +6,13 @@ import { boolean, number, object, string } from 'yup'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { FormActions } from 'components/ui/Forms/FormActions'
|
||||
import { FormHeader } from 'components/ui/Forms/FormHeader'
|
||||
import { FormPanel } from 'components/ui/Forms/FormPanel'
|
||||
import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
|
||||
import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'
|
||||
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
|
||||
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { IS_PLATFORM } from 'lib/constants'
|
||||
import {
|
||||
AlertDescription_Shadcn_,
|
||||
AlertTitle_Shadcn_,
|
||||
@@ -25,11 +23,8 @@ import {
|
||||
Toggle,
|
||||
WarningIcon,
|
||||
} from 'ui'
|
||||
import { NO_REQUIRED_CHARACTERS } from '../Auth.constants'
|
||||
import FormField from '../AuthProvidersForm/FormField'
|
||||
import { FormHeader } from 'components/ui/Forms/FormHeader'
|
||||
|
||||
// Use a const string to represent no chars option. Represented as empty string on the backend side.
|
||||
const NO_REQUIRED_CHARACTERS = 'NO_REQUIRED_CHARS'
|
||||
|
||||
const schema = object({
|
||||
DISABLE_SIGNUP: boolean().required(),
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { ChevronRight, FileCode, X } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import Panel from 'components/ui/Panel'
|
||||
import { usePoolingConfigurationQuery } from 'data/database/pooling-configuration-query'
|
||||
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
|
||||
import {
|
||||
Button,
|
||||
cn,
|
||||
@@ -11,6 +15,7 @@ import {
|
||||
CollapsibleTrigger_Shadcn_,
|
||||
WarningIcon,
|
||||
} from 'ui'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
import { ConnectionParameters } from './ConnectionParameters'
|
||||
import { DirectConnectionIcon, TransactionIcon } from './PoolerIcons'
|
||||
|
||||
@@ -105,6 +110,13 @@ export const ConnectionPanel = ({
|
||||
fileTitle,
|
||||
onCopyCallback,
|
||||
}: ConnectionPanelProps) => {
|
||||
const { ref: projectRef } = useParams()
|
||||
const state = useDatabaseSelectorStateSnapshot()
|
||||
|
||||
const { data: poolingInfo } = usePoolingConfigurationQuery({ projectRef })
|
||||
const poolingConfiguration = poolingInfo?.find((x) => x.identifier === state.selectedDatabaseId)
|
||||
const isSessionMode = poolingConfiguration?.pool_mode === 'session'
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-5 lg:grid lg:grid-cols-2 lg:gap-20 w-full">
|
||||
<div className="flex flex-col">
|
||||
@@ -112,27 +124,59 @@ export const ConnectionPanel = ({
|
||||
<p className="text-sm text-foreground-light mb-4">{description}</p>
|
||||
<div className="flex flex-col -space-y-px">
|
||||
{fileTitle && <CodeBlockFileHeader title={fileTitle} />}
|
||||
<CodeBlock
|
||||
wrapperClassName={cn(
|
||||
'[&_pre]:rounded-b-none [&_pre]:px-4 [&_pre]:py-3',
|
||||
fileTitle && '[&_pre]:rounded-t-none'
|
||||
)}
|
||||
language={lang}
|
||||
value={connectionString}
|
||||
className="[&_code]:text-[12px] [&_code]:text-foreground"
|
||||
hideLineNumbers
|
||||
onCopyCallback={onCopyCallback}
|
||||
/>
|
||||
{notice && (
|
||||
<div className="border px-4 py-1 w-full justify-start rounded-t-none !last:rounded-b group-data-[state=open]:rounded-b-none border-light">
|
||||
{notice?.map((text: string) => (
|
||||
<p key={text} className="text-xs text-foreground-lighter">
|
||||
{text}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
{type === 'transaction' && isSessionMode ? (
|
||||
<Admonition
|
||||
showIcon={false}
|
||||
type="default"
|
||||
className="[&>h5]:text-xs [&>div]:text-xs"
|
||||
title="Transaction pooler is unavailable as pool mode is set to Session"
|
||||
description="If you'd like to use transaction mode, update your pool mode to Transaction for the connection pooler in your project's Database Settings."
|
||||
>
|
||||
<Button asChild type="default" className="mt-2">
|
||||
<Link
|
||||
href={`/project/${projectRef}/settings/database#connection-pooler`}
|
||||
className="text-xs text-light hover:text-foreground"
|
||||
>
|
||||
Database Settings
|
||||
</Link>
|
||||
</Button>
|
||||
</Admonition>
|
||||
) : (
|
||||
<>
|
||||
{/* [Joshen] Can probably remove this after Feb 28 */}
|
||||
{type === 'session' && isSessionMode && (
|
||||
<Panel.Notice
|
||||
layout="vertical"
|
||||
className="border rounded mb-2"
|
||||
title="Deprecating Session Mode on Port 6543"
|
||||
description="Please use port 5432 for Session Mode as Supavisor will be deprecating Session Mode on port 6543 on February 28, 2025."
|
||||
href="https://github.com/orgs/supabase/discussions/32755"
|
||||
buttonText="Read the announcement"
|
||||
/>
|
||||
)}
|
||||
<CodeBlock
|
||||
wrapperClassName={cn(
|
||||
'[&_pre]:rounded-b-none [&_pre]:px-4 [&_pre]:py-3',
|
||||
fileTitle && '[&_pre]:rounded-t-none'
|
||||
)}
|
||||
language={lang}
|
||||
value={connectionString}
|
||||
className="[&_code]:text-[12px] [&_code]:text-foreground"
|
||||
hideLineNumbers
|
||||
onCopyCallback={onCopyCallback}
|
||||
/>
|
||||
{notice && (
|
||||
<div className="border px-4 py-1 w-full justify-start rounded-t-none !last:rounded-b group-data-[state=open]:rounded-b-none border-light">
|
||||
{notice?.map((text: string) => (
|
||||
<p key={text} className="text-xs text-foreground-lighter">
|
||||
{text}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{parameters.length > 0 && <ConnectionParameters parameters={parameters} />}
|
||||
</>
|
||||
)}
|
||||
{parameters.length > 0 && <ConnectionParameters parameters={parameters} />}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col items-end">
|
||||
|
||||
@@ -11,6 +11,7 @@ import { usePoolingConfigurationQuery } from 'data/database/pooling-configuratio
|
||||
import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
|
||||
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
|
||||
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { pluckObjectFields } from 'lib/helpers'
|
||||
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
|
||||
import {
|
||||
@@ -36,7 +37,6 @@ import {
|
||||
import { CodeBlockFileHeader, ConnectionPanel } from './ConnectionPanel'
|
||||
import { getConnectionStrings } from './DatabaseSettings.utils'
|
||||
import examples, { Example } from './DirectConnectionExamples'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
|
||||
const StepLabel = ({
|
||||
number,
|
||||
|
||||
@@ -127,7 +127,9 @@ export const CollectionForm = ({
|
||||
className="mt-2"
|
||||
type="primary"
|
||||
onClick={() =>
|
||||
router.push(`/org/${currentOrg?.slug}/billing?panel=subscriptionPlan`)
|
||||
router.push(
|
||||
`/org/${currentOrg?.slug}/billing?panel=subscriptionPlan&source=dataWarehouseIncreaseRetention`
|
||||
)
|
||||
}
|
||||
>
|
||||
Upgrade plan
|
||||
|
||||
@@ -62,6 +62,7 @@ const BackupsList = () => {
|
||||
icon={<Clock size={20} />}
|
||||
primaryText="Free Plan does not include project backups."
|
||||
secondaryText="Upgrade to the Pro Plan for up to 7 days of scheduled backups."
|
||||
source="backups"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import type { PostgresSchema } from '@supabase/postgres-meta'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { useTheme } from 'next-themes'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import ReactFlow, { Background, BackgroundVariant, MiniMap, useReactFlow } from 'reactflow'
|
||||
import 'reactflow/dist/style.css'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
||||
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
|
||||
import AlertError from 'components/ui/AlertError'
|
||||
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
|
||||
import SchemaSelector from 'components/ui/SchemaSelector'
|
||||
import { useSchemasQuery } from 'data/database/schemas-query'
|
||||
import { useTablesQuery } from 'data/tables/tables-query'
|
||||
import { useLocalStorage } from 'hooks/misc/useLocalStorage'
|
||||
import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
|
||||
import { LOCAL_STORAGE_KEYS } from 'lib/constants'
|
||||
import { SchemaGraphLegend } from './SchemaGraphLegend'
|
||||
import { getGraphDataFromTables, getLayoutedElementsViaDagre } from './Schemas.utils'
|
||||
@@ -24,7 +26,7 @@ export const SchemaGraph = () => {
|
||||
const { ref } = useParams()
|
||||
const { resolvedTheme } = useTheme()
|
||||
const { project } = useProjectContext()
|
||||
const [selectedSchema, setSelectedSchema] = useState<string>('public')
|
||||
const { selectedSchema, setSelectedSchema } = useQuerySchemaState()
|
||||
|
||||
const miniMapNodeColor = '#111318'
|
||||
const miniMapMaskColor = resolvedTheme?.includes('dark')
|
||||
@@ -147,42 +149,58 @@ export const SchemaGraph = () => {
|
||||
</div>
|
||||
)}
|
||||
{isSuccessTables && (
|
||||
<div className="w-full h-full">
|
||||
<ReactFlow
|
||||
defaultNodes={[]}
|
||||
defaultEdges={[]}
|
||||
defaultEdgeOptions={{
|
||||
type: 'smoothstep',
|
||||
animated: true,
|
||||
deletable: false,
|
||||
style: {
|
||||
stroke: 'hsl(var(--border-stronger))',
|
||||
strokeWidth: 0.5,
|
||||
},
|
||||
}}
|
||||
nodeTypes={nodeTypes}
|
||||
fitView
|
||||
minZoom={0.8}
|
||||
maxZoom={1.8}
|
||||
proOptions={{ hideAttribution: true }}
|
||||
onNodeDragStop={() => saveNodePositions()}
|
||||
>
|
||||
<Background
|
||||
gap={16}
|
||||
className="[&>*]:stroke-foreground-muted opacity-[25%]"
|
||||
variant={BackgroundVariant.Dots}
|
||||
color={'inherit'}
|
||||
/>
|
||||
<MiniMap
|
||||
pannable
|
||||
zoomable
|
||||
nodeColor={miniMapNodeColor}
|
||||
maskColor={miniMapMaskColor}
|
||||
className="border rounded-md shadow-sm"
|
||||
/>
|
||||
<SchemaGraphLegend />
|
||||
</ReactFlow>
|
||||
</div>
|
||||
<>
|
||||
{tables.length === 0 ? (
|
||||
<div className="h-full flex items-center justify-center">
|
||||
<ProductEmptyState
|
||||
title="No tables created yet"
|
||||
ctaButtonLabel="Create a new table"
|
||||
ctaUrl={`/project/${ref}/editor?create=table`}
|
||||
>
|
||||
<p className="text-sm text-foreground-light">
|
||||
There are no tables found in the schema "{selectedSchema}"
|
||||
</p>
|
||||
</ProductEmptyState>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full h-full">
|
||||
<ReactFlow
|
||||
defaultNodes={[]}
|
||||
defaultEdges={[]}
|
||||
defaultEdgeOptions={{
|
||||
type: 'smoothstep',
|
||||
animated: true,
|
||||
deletable: false,
|
||||
style: {
|
||||
stroke: 'hsl(var(--border-stronger))',
|
||||
strokeWidth: 1,
|
||||
},
|
||||
}}
|
||||
nodeTypes={nodeTypes}
|
||||
fitView
|
||||
minZoom={0.8}
|
||||
maxZoom={1.8}
|
||||
proOptions={{ hideAttribution: true }}
|
||||
onNodeDragStop={() => saveNodePositions()}
|
||||
>
|
||||
<Background
|
||||
gap={16}
|
||||
className="[&>*]:stroke-foreground-muted opacity-[25%]"
|
||||
variant={BackgroundVariant.Dots}
|
||||
color={'inherit'}
|
||||
/>
|
||||
<MiniMap
|
||||
pannable
|
||||
zoomable
|
||||
nodeColor={miniMapNodeColor}
|
||||
maskColor={miniMapMaskColor}
|
||||
className="border rounded-md shadow-sm"
|
||||
/>
|
||||
<SchemaGraphLegend />
|
||||
</ReactFlow>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -314,7 +314,11 @@ export function DiskManagementForm() {
|
||||
title="Compute and Disk configuration is not available on the Free Plan"
|
||||
actions={
|
||||
<Button type="default" asChild>
|
||||
<Link href={`/org/${org?.slug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>
|
||||
<Link
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan&source=diskManagementConfigure`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
</Button>
|
||||
}
|
||||
description="You will need to upgrade to at least the Pro Plan to configure compute and disk"
|
||||
|
||||
@@ -316,7 +316,7 @@ export function DiskManagementPanelForm() {
|
||||
<Link
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan`}
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan&source=diskManagementPanelDiskSize`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function Introduction({ selectedLang }: Props) {
|
||||
const { ref: projectRef } = useParams()
|
||||
|
||||
const { data: settings } = useProjectSettingsV2Query({ projectRef })
|
||||
const { data: config } = useProjectPostgrestConfigQuery({ projectRef })
|
||||
const { data: config, isSuccess } = useProjectPostgrestConfigQuery({ projectRef })
|
||||
|
||||
const protocol = settings?.app_config?.protocol ?? 'https'
|
||||
const hostEndpoint = settings?.app_config?.endpoint
|
||||
@@ -42,9 +42,9 @@ export default function Introduction({ selectedLang }: Props) {
|
||||
the easiest way to interact with everything we offer within the Supabase ecosystem.
|
||||
</p>
|
||||
</article>
|
||||
<article className="code">
|
||||
<article className="code flex flex-col gap-y-2">
|
||||
<CodeSnippet selectedLang={selectedLang} snippet={Snippets.init(endpoint)} />
|
||||
{!isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
|
||||
{isSuccess && !isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
|
||||
</article>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -13,7 +13,7 @@ interface IntroductionProps {
|
||||
const Introduction = ({ selectedLang }: IntroductionProps) => {
|
||||
const { ref: projectRef } = useParams()
|
||||
|
||||
const { data: config } = useProjectPostgrestConfigQuery({ projectRef })
|
||||
const { data: config, isSuccess } = useProjectPostgrestConfigQuery({ projectRef })
|
||||
|
||||
const isPublicSchemaEnabled = config?.db_schema
|
||||
.split(',')
|
||||
@@ -24,13 +24,14 @@ const Introduction = ({ selectedLang }: IntroductionProps) => {
|
||||
<>
|
||||
<h2 className="doc-heading">Introduction</h2>
|
||||
<div className="doc-section">
|
||||
<article className="code-column text-foreground">
|
||||
<article className="code-column text-foreground flex flex-col gap-y-2">
|
||||
<p>
|
||||
All views and tables in the <code>public</code> schema and accessible by the active
|
||||
database role for a request are available for querying.
|
||||
</p>
|
||||
|
||||
{!isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
|
||||
</article>
|
||||
<article className="code">
|
||||
{isSuccess && !isPublicSchemaEnabled && <PublicSchemaNotEnabledAlert />}
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,36 +1,28 @@
|
||||
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
|
||||
import { Info } from 'lucide-react'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import Link from 'next/link'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { Button } from 'ui'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
|
||||
const PublicSchemaNotEnabledAlert = () => {
|
||||
const { ref: projectRef } = useParams()
|
||||
|
||||
return (
|
||||
<Alert_Shadcn_ variant="default">
|
||||
<Info className="h-4 w-4" />
|
||||
<AlertTitle_Shadcn_ className="!-mt-4">
|
||||
<ReactMarkdown>The `public` schema for this project is not exposed</ReactMarkdown>
|
||||
</AlertTitle_Shadcn_>
|
||||
<AlertDescription_Shadcn_ className="grid gap-3 !-mt-7">
|
||||
<ReactMarkdown>
|
||||
You will not be able to query tables and views in the `public` schema via supabase-js or
|
||||
HTTP clients.
|
||||
</ReactMarkdown>
|
||||
|
||||
<div className="!-mt-4 inline-block">
|
||||
<Button asChild type="default">
|
||||
<Link
|
||||
href={`/project/${projectRef}/settings/api#postgrest-config`}
|
||||
className="!no-underline !hover:bg-surface-100 !text-foreground"
|
||||
>
|
||||
View schema settings
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</AlertDescription_Shadcn_>
|
||||
</Alert_Shadcn_>
|
||||
<Admonition type="default">
|
||||
<p className="!mt-0 !mb-1.5">The public schema for this project is not exposed</p>
|
||||
<p className="!mt-0 !mb-1.5 text-foreground-light">
|
||||
You will not be able to query tables and views in the public schema via supabase-js or HTTP
|
||||
clients. Configure this behavior in your project's Data API settings.
|
||||
</p>
|
||||
<Button asChild type="default" className="mt-1">
|
||||
<Link
|
||||
href={`/project/${projectRef}/settings/api#postgrest-config`}
|
||||
className="!no-underline"
|
||||
>
|
||||
View API settings
|
||||
</Link>
|
||||
</Button>
|
||||
</Admonition>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ const AuditLogs = () => {
|
||||
|
||||
<div className="flex items-center">
|
||||
<Button type="primary" asChild>
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan&source=auditLogs`}>
|
||||
Upgrade subscription
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
+5
-1
@@ -143,7 +143,11 @@ const BillingMetric = ({
|
||||
) : (
|
||||
<div>
|
||||
<Button type="default" asChild>
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan`}>Upgrade</Link>
|
||||
<Link
|
||||
href={`/org/${slug}/billing?panel=subscriptionPlan&source=billingBreakdownUsage${metric.anchor}`}
|
||||
>
|
||||
Upgrade
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { toast } from 'sonner'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { Form, FormControl, FormField } from '@ui/components/shadcn/ui/form'
|
||||
import { useParams } from 'common'
|
||||
import {
|
||||
ScaffoldSection,
|
||||
@@ -12,29 +15,56 @@ import {
|
||||
import { FormActions } from 'components/ui/Forms/FormActions'
|
||||
import { FormPanel } from 'components/ui/Forms/FormPanel'
|
||||
import { FormSection, FormSectionContent } from 'components/ui/Forms/FormSection'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import { useOrganizationCustomerProfileQuery } from 'data/organizations/organization-customer-profile-query'
|
||||
import { useOrganizationUpdateMutation } from 'data/organizations/organization-update-mutation'
|
||||
import { invalidateOrganizationsQuery } from 'data/organizations/organizations-query'
|
||||
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { Form, Input } from 'ui'
|
||||
import { FormMessage_Shadcn_, Input_Shadcn_ } from 'ui'
|
||||
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
||||
import { InfoTooltip } from 'ui-patterns/info-tooltip'
|
||||
import {
|
||||
MultiSelector,
|
||||
MultiSelectorContent,
|
||||
MultiSelectorList,
|
||||
MultiSelectorTrigger,
|
||||
} from 'ui-patterns/multi-select'
|
||||
|
||||
const FORM_ID = 'org-billing-email'
|
||||
const formSchema = z.object({
|
||||
billingEmail: z.string().email('Please provide a valid email address').optional(),
|
||||
additionalBillingEmails: z.string().email({ message: 'invalid_email' }).array().default([]),
|
||||
})
|
||||
|
||||
const BillingEmail = () => {
|
||||
const { slug } = useParams()
|
||||
const queryClient = useQueryClient()
|
||||
const selectedOrganization = useSelectedOrganization()
|
||||
const { name, billing_email } = selectedOrganization ?? {}
|
||||
|
||||
const formId = 'org-billing-email'
|
||||
const initialValues = { billing_email: billing_email ?? '' }
|
||||
const { name, billing_email } = selectedOrganization ?? {}
|
||||
|
||||
const canUpdateOrganization = useCheckPermissions(PermissionAction.UPDATE, 'organizations')
|
||||
const canReadBillingEmail = useCheckPermissions(
|
||||
PermissionAction.BILLING_READ,
|
||||
'stripe.subscriptions'
|
||||
)
|
||||
|
||||
const { data: billingCustomer, isLoading: loadingBillingCustomer } =
|
||||
useOrganizationCustomerProfileQuery({ slug }, { enabled: canReadBillingEmail })
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
billingEmail: billing_email ?? '',
|
||||
additionalBillingEmails: billingCustomer?.additional_emails ?? [],
|
||||
},
|
||||
})
|
||||
const { additionalBillingEmails } = form.watch()
|
||||
const { errors } = form.formState
|
||||
const additionalEmailsError = errors.additionalBillingEmails ?? []
|
||||
|
||||
const { mutate: updateOrganization, isLoading: isUpdating } = useOrganizationUpdateMutation()
|
||||
|
||||
const onUpdateOrganizationEmail = async (values: any, { resetForm }: any) => {
|
||||
const onUpdateOrganizationEmail = async (values: z.infer<typeof formSchema>) => {
|
||||
if (!canUpdateOrganization) {
|
||||
return toast.error('You do not have the required permissions to update this organization')
|
||||
}
|
||||
@@ -45,19 +75,26 @@ const BillingEmail = () => {
|
||||
{
|
||||
slug,
|
||||
name,
|
||||
billing_email: values.billing_email,
|
||||
billing_email: values.billingEmail,
|
||||
additional_billing_emails: values.additionalBillingEmails,
|
||||
},
|
||||
{
|
||||
onSuccess: ({ billing_email }) => {
|
||||
resetForm({ values: { billing_email }, initialValues: { billing_email } })
|
||||
invalidateOrganizationsQuery(queryClient)
|
||||
onSuccess: () => {
|
||||
toast.success('Successfully saved settings')
|
||||
form.reset(values)
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (!canReadBillingEmail) return null
|
||||
useEffect(() => {
|
||||
if (billingCustomer) {
|
||||
form.reset({
|
||||
billingEmail: billing_email,
|
||||
additionalBillingEmails: billingCustomer.additional_emails ?? [],
|
||||
})
|
||||
}
|
||||
}, [billingCustomer])
|
||||
|
||||
return (
|
||||
<ScaffoldSection>
|
||||
@@ -70,31 +107,23 @@ const BillingEmail = () => {
|
||||
</div>
|
||||
</ScaffoldSectionDetail>
|
||||
<ScaffoldSectionContent>
|
||||
<Form id={formId} initialValues={initialValues} onSubmit={onUpdateOrganizationEmail}>
|
||||
{({ handleReset, values, initialValues, resetForm }: any) => {
|
||||
const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
|
||||
|
||||
// [Alaister] although this "technically" is breaking the rules of React hooks
|
||||
// it won't error because the hooks are always rendered in the same order
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useEffect(() => {
|
||||
const values = { billing_email: billing_email ?? '' }
|
||||
resetForm({ values, initialValues: values })
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [slug])
|
||||
|
||||
return (
|
||||
{!canReadBillingEmail ? (
|
||||
<NoPermission resourceText="view this organization's email recipients" />
|
||||
) : (
|
||||
<Form {...form}>
|
||||
<form id={FORM_ID} onSubmit={form.handleSubmit(onUpdateOrganizationEmail)}>
|
||||
<FormPanel
|
||||
footer={
|
||||
<div className="flex py-4 px-8">
|
||||
<FormActions
|
||||
form={formId}
|
||||
form={FORM_ID}
|
||||
isSubmitting={isUpdating}
|
||||
hasChanges={hasChanges}
|
||||
handleReset={handleReset}
|
||||
hasChanges={form.formState.isDirty}
|
||||
handleReset={form.reset}
|
||||
disabled={!canUpdateOrganization}
|
||||
helper={
|
||||
!canUpdateOrganization
|
||||
? "You need additional permissions to manage this organization's settings"
|
||||
? 'You need additional permissions to update billing emails'
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
@@ -102,20 +131,79 @@ const BillingEmail = () => {
|
||||
}
|
||||
>
|
||||
<FormSection>
|
||||
<FormSectionContent fullWidth loading={false}>
|
||||
<Input
|
||||
id="billing_email"
|
||||
size="small"
|
||||
label="Email address"
|
||||
type="text"
|
||||
disabled={!canUpdateOrganization}
|
||||
<FormSectionContent fullWidth loading={loadingBillingCustomer}>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="billingEmail"
|
||||
render={({ field }) => (
|
||||
<FormItemLayout label="Email address">
|
||||
<FormControl>
|
||||
<Input_Shadcn_
|
||||
type="email"
|
||||
{...field}
|
||||
placeholder="Email"
|
||||
disabled={!canUpdateOrganization}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage_Shadcn_ />
|
||||
</FormItemLayout>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="additionalBillingEmails"
|
||||
render={({ field }) => (
|
||||
<FormItemLayout
|
||||
hideMessage
|
||||
label={
|
||||
<div className="flex items-center gap-x-1">
|
||||
<span>Additional emails</span>
|
||||
<InfoTooltip side="bottom">
|
||||
These email addresses will be CC'd in automated invoice or payment
|
||||
failure emails. Payment receipts will still only go to the primary
|
||||
billing address.
|
||||
</InfoTooltip>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<FormControl>
|
||||
<MultiSelector values={field.value} onValuesChange={field.onChange}>
|
||||
<MultiSelectorTrigger
|
||||
deletableBadge
|
||||
showIcon={false}
|
||||
mode="inline-combobox"
|
||||
label="Add additional recipients"
|
||||
badgeLimit="wrap"
|
||||
/>
|
||||
<MultiSelectorContent>
|
||||
<MultiSelectorList creatable />
|
||||
</MultiSelectorContent>
|
||||
</MultiSelector>
|
||||
</FormControl>
|
||||
{/* [Joshen] Manually construct the message here as MultiSelector doesn't handle array errors from RHF atm */}
|
||||
{Array.isArray(additionalEmailsError) &&
|
||||
additionalEmailsError.length > 0 && (
|
||||
<div className="flex flex-col gap-y-1 mt-2">
|
||||
{additionalEmailsError.map((x, idx) => (
|
||||
<p
|
||||
key={`email-error-${idx}`}
|
||||
className="text-sm text-destructive"
|
||||
>
|
||||
"{additionalBillingEmails[idx]}" is not a valid email address
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</FormItemLayout>
|
||||
)}
|
||||
/>
|
||||
</FormSectionContent>
|
||||
</FormSection>
|
||||
</FormPanel>
|
||||
)
|
||||
}}
|
||||
</Form>
|
||||
</form>
|
||||
</Form>
|
||||
)}
|
||||
</ScaffoldSectionContent>
|
||||
</ScaffoldSection>
|
||||
)
|
||||
|
||||
@@ -97,7 +97,11 @@ export const Restriction = () => {
|
||||
</p>
|
||||
<div className="flex items-center gap-x-2 mt-3">
|
||||
<Button asChild key="upgrade-button" type="default">
|
||||
<Link href={`/org/${org?.slug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>
|
||||
<Link
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan&source=fairUseGracePeriodStarted`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild type="default" icon={<ExternalLink />}>
|
||||
<a href="https://supabase.com/docs/guides/platform/billing-faq#fair-use-policy">
|
||||
@@ -124,7 +128,11 @@ export const Restriction = () => {
|
||||
</p>
|
||||
<div className="flex items-center gap-x-2 mt-3">
|
||||
<Button key="upgrade-button" asChild type="default">
|
||||
<Link href={`/org/${org?.slug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>
|
||||
<Link
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan&source=fairUseGracePeriodOver`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild type="default" icon={<ExternalLink />}>
|
||||
<a href="https://supabase.com/docs/guides/platform/billing-faq#fair-use-policy">
|
||||
@@ -151,7 +159,11 @@ export const Restriction = () => {
|
||||
</p>
|
||||
<div className="flex items-center gap-x-2 mt-3">
|
||||
<Button key="upgrade-button" asChild type="default">
|
||||
<Link href={`/org/${org?.slug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>
|
||||
<Link
|
||||
href={`/org/${org?.slug}/billing?panel=subscriptionPlan&source=fairUseRestricted`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild type="default" icon={<ExternalLink />}>
|
||||
<a href="https://supabase.com/docs/guides/platform/billing-faq#fair-use-policy">
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ const PaymentMethodSelection = ({
|
||||
|
||||
<AddNewPaymentMethodModal
|
||||
visible={showAddNewPaymentMethodModal}
|
||||
returnUrl={`${getURL()}/org/${selectedOrganization?.slug}/billing?panel=subscriptionPlan`}
|
||||
returnUrl={`${getURL()}/org/${selectedOrganization?.slug}/billing?panel=subscriptionPlan&source=paymentMethod`}
|
||||
onCancel={() => setShowAddNewPaymentMethodModal(false)}
|
||||
autoMarkAsDefaultPaymentMethod={true}
|
||||
onConfirm={async () => {
|
||||
|
||||
+11
-4
@@ -7,7 +7,7 @@ import { useRouter } from 'next/router'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
import { TelemetryActions } from 'common/telemetry-constants'
|
||||
import { StudioPricingSidePanelOpenedEvent, TelemetryActions } from 'common/telemetry-constants'
|
||||
import { billingPartnerLabel } from 'components/interfaces/Billing/Subscription/Subscription.utils'
|
||||
import Table from 'components/to-be-cleaned/Table'
|
||||
import AlertError from 'components/ui/AlertError'
|
||||
@@ -126,11 +126,18 @@ const PlanUpdateSidePanel = () => {
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setSelectedTier(undefined)
|
||||
const source = Array.isArray(router.query.source)
|
||||
? router.query.source[0]
|
||||
: router.query.source
|
||||
const properties: StudioPricingSidePanelOpenedEvent['properties'] = {
|
||||
currentPlan: subscription?.plan?.name,
|
||||
}
|
||||
if (source) {
|
||||
properties.origin = source
|
||||
}
|
||||
sendEvent({
|
||||
action: TelemetryActions.STUDIO_PRICING_SIDE_PANEL_OPENED,
|
||||
properties: {
|
||||
currentPlan: subscription?.plan?.name,
|
||||
},
|
||||
properties,
|
||||
groups: { organization: slug ?? 'Unknown' },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ const SOC2 = () => {
|
||||
{isSuccess && (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
{currentPlan?.id === 'free' || currentPlan?.id === 'pro' ? (
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan&source=soc2`}>
|
||||
<Button type="default">Upgrade to Team</Button>
|
||||
</Link>
|
||||
) : (
|
||||
|
||||
@@ -74,7 +74,9 @@ const SecurityQuestionnaire = () => {
|
||||
{isSuccess && (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
{currentPlan?.id === 'free' || currentPlan?.id === 'pro' ? (
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${slug}/billing?panel=subscriptionPlan&source=securityQuestionnaire`}
|
||||
>
|
||||
<Button type="default">Upgrade to Team</Button>
|
||||
</Link>
|
||||
) : (
|
||||
|
||||
@@ -305,7 +305,10 @@ const NewOrgForm = ({ onPaymentMethodReset }: NewOrgFormProps) => {
|
||||
<p>
|
||||
The plan applies only to this new organization. To upgrade an existing
|
||||
organization,{' '}
|
||||
<Link className="underline" href="/org/_/billing?panel=subscriptionPlan">
|
||||
<Link
|
||||
className="underline"
|
||||
href="/org/_/billing?panel=subscriptionPlan&source=newOrgUpgradeExisting"
|
||||
>
|
||||
click here
|
||||
</Link>
|
||||
.
|
||||
|
||||
+5
-1
@@ -38,7 +38,11 @@ const FreeProjectLimitWarning = ({
|
||||
|
||||
<div>
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>Upgrade plan</Link>
|
||||
<Link
|
||||
href={`/org/${orgSlug}/billing?panel=subscriptionPlan&source=freeProjectLimitWarning`}
|
||||
>
|
||||
Upgrade plan
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -408,7 +408,9 @@ export const InviteMemberButton = () => {
|
||||
{isSuccessSubscription &&
|
||||
(currentPlan?.id === 'free' || currentPlan?.id === 'pro') && (
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${slug}/billing?panel=subscriptionPlan&source=inviteMemberSSO`}
|
||||
>
|
||||
Upgrade to Team
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ArrowRight, Check, Minus, User, X } from 'lucide-react'
|
||||
import Image from 'next/legacy/image'
|
||||
import { useState } from 'react'
|
||||
|
||||
import Table from 'components/to-be-cleaned/Table'
|
||||
import PartnerIcon from 'components/ui/PartnerIcon'
|
||||
import { ProfileImage } from 'components/ui/ProfileImage'
|
||||
import { useOrganizationRolesV2Query } from 'data/organization-members/organization-roles-query'
|
||||
import { OrganizationMember } from 'data/organizations/organization-members-query'
|
||||
import { useProjectsQuery } from 'data/projects/projects-query'
|
||||
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
||||
import { getGitHubProfileImgUrl } from 'lib/github'
|
||||
import { useProfile } from 'lib/profile'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
@@ -33,7 +33,6 @@ const MEMBER_ORIGIN_TO_MANAGED_BY = {
|
||||
export const MemberRow = ({ member }: MemberRowProps) => {
|
||||
const { profile } = useProfile()
|
||||
const selectedOrganization = useSelectedOrganization()
|
||||
const [hasInvalidImg, setHasInvalidImg] = useState(false)
|
||||
|
||||
const { data: projects } = useProjectsQuery()
|
||||
const { data: roles, isLoading: isLoadingRoles } = useOrganizationRolesV2Query({
|
||||
@@ -47,6 +46,9 @@ export const MemberRow = ({ member }: MemberRowProps) => {
|
||||
const isEmailUser = member.username === member.primary_email
|
||||
const isFlyUser = Boolean(member.primary_email?.endsWith('customer.fly.io'))
|
||||
|
||||
const profileImageUrl =
|
||||
isInvitedUser || isEmailUser || isFlyUser ? undefined : getGitHubProfileImgUrl(member.username)
|
||||
|
||||
// [Joshen] From project role POV, mask any roles for other projects
|
||||
const isObfuscated =
|
||||
member.role_ids.filter((id) => {
|
||||
@@ -69,25 +71,22 @@ export const MemberRow = ({ member }: MemberRowProps) => {
|
||||
return (
|
||||
<Table.tr>
|
||||
<Table.td>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="w-[32px] h-[32px] md:w-[40px] md:h-[40px]">
|
||||
{isInvitedUser || isEmailUser || isFlyUser || hasInvalidImg ? (
|
||||
<div className="w-[32px] h-[32px] md:w-[40px] md:h-[40px] bg-surface-100 border border-overlay rounded-full text-foreground-lighter flex items-center justify-center">
|
||||
<div className="flex items-center gap-x-4">
|
||||
<ProfileImage
|
||||
alt={member.username}
|
||||
src={profileImageUrl}
|
||||
className="border rounded-full w-[32px] h-[32px] md:w-[40px] md:h-[40px]"
|
||||
placeholder={
|
||||
<div
|
||||
className={cn(
|
||||
'w-[32px] h-[32px] md:w-[40px] md:h-[40px]',
|
||||
'bg-surface-100 border border-overlay rounded-full text-foreground-lighter flex items-center justify-center'
|
||||
)}
|
||||
>
|
||||
<User size={20} strokeWidth={1.5} />
|
||||
</div>
|
||||
) : (
|
||||
<Image
|
||||
alt={member.username}
|
||||
src={`https://github.com/${member.username}.png?size=80`}
|
||||
width="40"
|
||||
height="40"
|
||||
className="border rounded-full w-[32px] h-[32px] md:w-[40px] md:h-[40px]"
|
||||
onError={() => {
|
||||
setHasInvalidImg(true)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="flex item-center gap-x-2">
|
||||
{isInvitedUser === undefined ? (
|
||||
<p className="text-foreground-light truncate">{member.primary_email}</p>
|
||||
|
||||
@@ -13,14 +13,14 @@ export const generateUsageData = (attribute: string, days: number): DataPoint[]
|
||||
})
|
||||
}
|
||||
|
||||
export const getUpgradeUrl = (slug: string, subscription?: OrgSubscription) => {
|
||||
export const getUpgradeUrl = (slug: string, subscription?: OrgSubscription, source?: string) => {
|
||||
if (!subscription) {
|
||||
return `/org/${slug}/billing`
|
||||
}
|
||||
|
||||
return subscription?.plan?.id === 'pro' && subscription?.usage_billing_enabled === false
|
||||
? `/org/${slug}/billing#cost-control`
|
||||
: `/org/${slug}/billing?panel=subscriptionPlan`
|
||||
: `/org/${slug}/billing?panel=subscriptionPlan&source=usage${source}`
|
||||
}
|
||||
|
||||
const compactNumberFormatter = new Intl.NumberFormat('en-US', {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ const AttributeUsage = ({
|
||||
isSuccess,
|
||||
currentBillingCycleSelected,
|
||||
}: AttributeUsageProps) => {
|
||||
const upgradeUrl = getUpgradeUrl(slug ?? '', subscription)
|
||||
const upgradeUrl = getUpgradeUrl(slug ?? '', subscription, attribute.key)
|
||||
const usageRatio = (usageMeta?.usage ?? 0) / (usageMeta?.pricing_free_units ?? 0)
|
||||
const usageExcess = (usageMeta?.usage ?? 0) - (usageMeta?.pricing_free_units ?? 0)
|
||||
const usageBasedBilling = subscription?.usage_billing_enabled
|
||||
|
||||
@@ -141,7 +141,7 @@ export const QueryPerformance = ({
|
||||
tab.id !== QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT
|
||||
? tabMax > 1000
|
||||
? (tabMax / 1000).toFixed(2)
|
||||
: tabMax.toLocaleString()
|
||||
: tabMax.toFixed(0)
|
||||
: tabMax.toLocaleString()
|
||||
|
||||
return (
|
||||
@@ -180,7 +180,6 @@ export const QueryPerformance = ({
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs text-foreground-muted group-hover:text-foreground-lighter group-data-[state=active]:text-foreground-lighter transition">
|
||||
{/* {Number(tab.max).toLocaleString()} */}
|
||||
{maxValue}
|
||||
{tab.id !== QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT
|
||||
? tabMax > 1000
|
||||
|
||||
@@ -71,9 +71,7 @@ export const QueryPerformanceGrid = ({ queryPerformanceQuery }: QueryPerformance
|
||||
renderCell: (props) => {
|
||||
const value = props.row?.[col.id]
|
||||
const isTime = col.name.includes('time')
|
||||
const formattedValue = isTime
|
||||
? `${Number(value.toFixed(2)).toLocaleString()}ms`
|
||||
: value.toLocaleString()
|
||||
const formattedValue = isTime ? `${value.toFixed(0)}ms` : value.toLocaleString()
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
|
||||
@@ -282,7 +282,9 @@ const ComputeInstanceSidePanel = () => {
|
||||
title="Changing your compute size is only available on the Pro Plan"
|
||||
actions={
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=computeInstanceSidePanel`}
|
||||
>
|
||||
View available plans
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -229,7 +229,9 @@ const CustomDomainSidePanel = () => {
|
||||
title="Custom domains are unavailable on the Free Plan"
|
||||
actions={
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=customDomainSidePanel`}
|
||||
>
|
||||
View available plans
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -222,7 +222,9 @@ const IPv4SidePanel = () => {
|
||||
<Admonition type="note" title="IPv4 add-on is unavailable on the Free Plan">
|
||||
<p>Upgrade your plan to enable a IPv4 address for your project</p>
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=ipv4SidePanel`}
|
||||
>
|
||||
View available plans
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -279,7 +279,9 @@ const PITRSidePanel = () => {
|
||||
title="Changing your Point-In-Time-Recovery is only available on the Pro Plan"
|
||||
actions={
|
||||
<Button asChild type="default">
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=pitrSidePanel`}
|
||||
>
|
||||
View available plans
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
+23
-19
@@ -36,6 +36,7 @@ import {
|
||||
Listbox,
|
||||
Separator,
|
||||
} from 'ui'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
import { SESSION_MODE_DESCRIPTION, TRANSACTION_MODE_DESCRIPTION } from '../Database.constants'
|
||||
import { POOLING_OPTIMIZATIONS } from './ConnectionPooling.constants'
|
||||
import { useAuthConfigQuery } from 'data/auth/auth-config-query'
|
||||
@@ -98,7 +99,7 @@ export const ConnectionPooling = () => {
|
||||
isLoading,
|
||||
isError,
|
||||
isSuccess,
|
||||
} = usePoolingConfigurationQuery({ projectRef: projectRef })
|
||||
} = usePoolingConfigurationQuery({ projectRef })
|
||||
|
||||
const { data: authConfig } = useAuthConfigQuery({ projectRef })
|
||||
|
||||
@@ -297,29 +298,32 @@ export const ConnectionPooling = () => {
|
||||
<>
|
||||
{field.value === 'transaction' ? (
|
||||
<FormDescription_Shadcn_ className="col-start-5 col-span-8 flex flex-col gap-y-2">
|
||||
<Alert_Shadcn_>
|
||||
<AlertTitle_Shadcn_ className="text-foreground">
|
||||
Pool mode will be set to transaction permanently on port 6543
|
||||
</AlertTitle_Shadcn_>
|
||||
<AlertDescription_Shadcn_>
|
||||
This will take into effect once saved. You can use session mode by
|
||||
pointing the pooler connection to use port 5432.
|
||||
</AlertDescription_Shadcn_>
|
||||
</Alert_Shadcn_>
|
||||
<Admonition
|
||||
type="warning"
|
||||
title="Pool mode will be set to transaction permanently on port 6543"
|
||||
description="This will take into effect once saved. If you are using Session mode with port 6543 in your applications, please update to use port 5432 instead before saving."
|
||||
/>
|
||||
</FormDescription_Shadcn_>
|
||||
) : (
|
||||
<FormDescription_Shadcn_ className="col-start-5 col-span-8 flex flex-col gap-y-2">
|
||||
<Alert_Shadcn_>
|
||||
<AlertTitle_Shadcn_ className="text-foreground">
|
||||
Set to transaction mode to use both pooling modes concurrently
|
||||
</AlertTitle_Shadcn_>
|
||||
<AlertDescription_Shadcn_>
|
||||
Session mode can be used concurrently with transaction mode by
|
||||
{/* [Joshen] Can probably remove this after Feb 28 */}
|
||||
<Panel.Notice
|
||||
layout="vertical"
|
||||
className="border rounded-lg"
|
||||
title="Deprecating Session Mode on Port 6543"
|
||||
description="On February 28, 2025, Supavisor is deprecating Session Mode on port 6543. Please update your application/database clients to use port 5432 for Session Mode."
|
||||
href="https://github.com/orgs/supabase/discussions/32755"
|
||||
buttonText="Read the announcement"
|
||||
/>
|
||||
<Admonition
|
||||
showIcon={false}
|
||||
type="default"
|
||||
title="Set to transaction mode to use both pooling modes concurrently"
|
||||
description="Session mode can be used concurrently with transaction mode by
|
||||
using 5432 for session and 6543 for transaction. However, by
|
||||
configuring the pooler mode to session here, you will not be able
|
||||
to use transaction mode at the same time.
|
||||
</AlertDescription_Shadcn_>
|
||||
</Alert_Shadcn_>
|
||||
to use transaction mode at the same time."
|
||||
/>
|
||||
</FormDescription_Shadcn_>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -39,14 +39,18 @@ export const DatabaseReadOnlyAlert = () => {
|
||||
</li>
|
||||
{subscription?.plan.id === 'free' ? (
|
||||
<li>
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=databaseReadOnlyAlertUpgradePlan`}
|
||||
>
|
||||
<a className="text underline">Upgrade to the Pro Plan</a>
|
||||
</Link>{' '}
|
||||
to increase your database size limit to 8GB.
|
||||
</li>
|
||||
) : subscription?.plan.id === 'pro' && subscription?.usage_billing_enabled ? (
|
||||
<li>
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=databaseReadOnlyAlertSpendCap`}
|
||||
>
|
||||
<a className="text-foreground underline">Disable your Spend Cap</a>
|
||||
</Link>{' '}
|
||||
to allow your project to auto-scale and expand beyond the 8GB database size limit
|
||||
|
||||
+1
@@ -90,6 +90,7 @@ const CustomDomainConfig = () => {
|
||||
: 'To configure a custom domain for your project, please enable the add-on'
|
||||
}
|
||||
addon="customDomain"
|
||||
source="customDomain"
|
||||
disabled={customDomainsDisabledDueToQuota}
|
||||
/>
|
||||
) : (
|
||||
|
||||
+2
-2
@@ -301,7 +301,7 @@ const DeployNewReplicaPanel = ({
|
||||
<Link
|
||||
href={
|
||||
isFreePlan
|
||||
? `/org/${org?.slug}/billing?panel=subscriptionPlan`
|
||||
? `/org/${org?.slug}/billing?panel=subscriptionPlan&source=deployNewReplicaPanelSmallCompute`
|
||||
: diskAndComputeFormEnabled
|
||||
? `/project/${projectRef}/settings/compute-and-disk`
|
||||
: `/project/${projectRef}/settings/addons?panel=computeInstance`
|
||||
@@ -400,7 +400,7 @@ const DeployNewReplicaPanel = ({
|
||||
<Link
|
||||
href={
|
||||
isFreePlan
|
||||
? `/org/${org?.slug}/billing?panel=subscriptionPlan`
|
||||
? `/org/${org?.slug}/billing?panel=subscriptionPlan&source=deployNewReplicaPanelMaxReplicas`
|
||||
: diskAndComputeFormEnabled
|
||||
? `/project/${projectRef}/settings/compute-and-disk`
|
||||
: `/project/${projectRef}/settings/addons?panel=computeInstance`
|
||||
|
||||
@@ -59,7 +59,11 @@ const UpgradePrompt: React.FC<Props> = ({ show, setShowUpgradePrompt }) => {
|
||||
Close
|
||||
</Button>
|
||||
<Button asChild size="tiny">
|
||||
<Link href={`/org/${organization?.slug}/billing?panel=subscriptionPlan`}>Upgrade</Link>
|
||||
<Link
|
||||
href={`/org/${organization?.slug}/billing?panel=subscriptionPlan&source=logsRetentionUpgradePrompt`}
|
||||
>
|
||||
Upgrade
|
||||
</Link>
|
||||
</Button>
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
|
||||
@@ -56,7 +56,11 @@ export const PlanExpectationInfoBox = ({
|
||||
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-y-2 sm:gap-x-2">
|
||||
<Button asChild>
|
||||
<Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>Upgrade project</Link>
|
||||
<Link
|
||||
href={`/org/${orgSlug}/billing?panel=subscriptionPlan&source=planSupportExpectationInfoBox`}
|
||||
>
|
||||
Upgrade project
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild type="default" icon={<ExternalLink />}>
|
||||
<Link
|
||||
|
||||
+2
-2
@@ -2,8 +2,6 @@ import type { PostgresTable } from '@supabase/postgres-meta'
|
||||
import { isEmpty, isUndefined, noop } from 'lodash'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { Badge, Checkbox, Input, SidePanel } from 'ui'
|
||||
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
|
||||
|
||||
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
||||
import { DocsButton } from 'components/ui/DocsButton'
|
||||
@@ -23,7 +21,9 @@ import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
|
||||
import { useUrlState } from 'hooks/ui/useUrlState'
|
||||
import { PROTECTED_SCHEMAS_WITHOUT_EXTENSIONS } from 'lib/constants/schemas'
|
||||
import { useTableEditorStateSnapshot } from 'state/table-editor'
|
||||
import { Badge, Checkbox, Input, SidePanel } from 'ui'
|
||||
import { Admonition } from 'ui-patterns'
|
||||
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
|
||||
import ActionBar from '../ActionBar'
|
||||
import type { ForeignKey } from '../ForeignKeySelector/ForeignKeySelector.types'
|
||||
import { formatForeignKeys } from '../ForeignKeySelector/ForeignKeySelector.utils'
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ const BranchingPlanNotice = () => {
|
||||
<AlertDescription_Shadcn_>
|
||||
<Button size="tiny" type="default" className="mt-4">
|
||||
<Link
|
||||
href={`/org/${selectedOrg?.slug}/billing?panel=subscriptionPlan`}
|
||||
href={`/org/${selectedOrg?.slug}/billing?panel=subscriptionPlan&source=enableBranchingButton`}
|
||||
onClick={() => snap.setShowEnableBranchingModal(false)}
|
||||
>
|
||||
Upgrade to Pro
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { PropsWithChildren } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { AppBannerWrapper } from 'components/interfaces/App'
|
||||
import { AppBannerContextProvider } from 'components/interfaces/App/AppBannerWrapperContext'
|
||||
import { PropsWithChildren, ReactNode } from 'react'
|
||||
import { LayoutHeader } from './ProjectLayout/LayoutHeader'
|
||||
import NavigationBar from './ProjectLayout/NavigationBar/NavigationBar'
|
||||
import MobileNavigationBar from './ProjectLayout/NavigationBar/MobileNavigationBar'
|
||||
import NavigationBar from './ProjectLayout/NavigationBar/NavigationBar'
|
||||
import { ProjectContextProvider } from './ProjectLayout/ProjectContext'
|
||||
import { useParams } from 'common'
|
||||
|
||||
export interface DefaultLayoutProps {
|
||||
title?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
import Link from 'next/link'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import { useEffect, type PropsWithChildren } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { useIsAPIDocsSidePanelEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
||||
@@ -12,6 +12,8 @@ import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'
|
||||
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { withAuth } from 'hooks/misc/withAuth'
|
||||
import { Code } from 'lucide-react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { toast } from 'sonner'
|
||||
import { Button, cn } from 'ui'
|
||||
import FunctionsNav from '../../interfaces/Functions/FunctionsNav'
|
||||
import ProjectLayout from '../ProjectLayout/ProjectLayout'
|
||||
@@ -21,12 +23,36 @@ interface FunctionsLayoutProps {
|
||||
}
|
||||
|
||||
const FunctionsLayout = ({ title, children }: PropsWithChildren<FunctionsLayoutProps>) => {
|
||||
const router = useRouter()
|
||||
const { functionSlug, ref } = useParams()
|
||||
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
|
||||
|
||||
const { data: functions, isLoading } = useEdgeFunctionsQuery({ projectRef: ref })
|
||||
const { data: selectedFunction } = useEdgeFunctionQuery({ projectRef: ref, slug: functionSlug })
|
||||
const {
|
||||
data: selectedFunction,
|
||||
error,
|
||||
isError,
|
||||
} = useEdgeFunctionQuery({ projectRef: ref, slug: functionSlug })
|
||||
|
||||
const canReadFunctions = useCheckPermissions(PermissionAction.FUNCTIONS_READ, '*')
|
||||
|
||||
const name = selectedFunction?.name || ''
|
||||
const hasFunctions = (functions ?? []).length > 0
|
||||
const centered = !hasFunctions
|
||||
|
||||
useEffect(() => {
|
||||
let cancel = false
|
||||
|
||||
if (!!functionSlug && isError && error.code === 404 && !cancel) {
|
||||
toast('Edge function cannot be found in your project')
|
||||
router.push(`/project/${ref}/functions`)
|
||||
}
|
||||
|
||||
return () => {
|
||||
cancel = true
|
||||
}
|
||||
}, [isError])
|
||||
|
||||
if (!canReadFunctions) {
|
||||
return (
|
||||
<ProjectLayout title={title || 'Edge Functions'} product="Edge Functions">
|
||||
@@ -35,10 +61,6 @@ const FunctionsLayout = ({ title, children }: PropsWithChildren<FunctionsLayoutP
|
||||
)
|
||||
}
|
||||
|
||||
const name = selectedFunction?.name || ''
|
||||
const hasFunctions = (functions ?? []).length > 0
|
||||
const centered = !hasFunctions
|
||||
|
||||
return (
|
||||
<ProjectLayout isLoading={isLoading} title={title || 'Edge Functions'} product="Edge Functions">
|
||||
{centered ? (
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import { Menu, Search } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { Search, Menu } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { IS_PLATFORM } from 'lib/constants'
|
||||
import { useAppStateSnapshot } from 'state/app-state'
|
||||
|
||||
import { buttonVariants, cn, Sheet, SheetContent } from 'ui'
|
||||
import { buttonVariants, cn } from 'ui'
|
||||
import { CommandMenuTrigger } from 'ui-patterns'
|
||||
import { NavContent } from './NavigationBar'
|
||||
import { useState } from 'react'
|
||||
import MobileSheetNav from 'ui-patterns/MobileSheetNav/MobileSheetNav'
|
||||
|
||||
export const ICON_SIZE = 20
|
||||
export const ICON_STROKE_WIDTH = 1.5
|
||||
import { NavContent } from './NavigationBar'
|
||||
|
||||
const MobileNavigationBar = () => {
|
||||
const router = useRouter()
|
||||
|
||||
@@ -2,9 +2,6 @@ import { PropsWithChildren } from 'react'
|
||||
import { useAppStateSnapshot } from 'state/app-state'
|
||||
import { cn } from 'ui'
|
||||
|
||||
export const ICON_SIZE = 20
|
||||
export const ICON_STROKE_WIDTH = 1.5
|
||||
|
||||
interface Props {
|
||||
title?: string
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Home, User } from 'icons'
|
||||
import { Home } from 'icons'
|
||||
import { isUndefined } from 'lodash'
|
||||
import { Command, FileText, FlaskConical, Search, Settings } from 'lucide-react'
|
||||
import { useTheme } from 'next-themes'
|
||||
@@ -8,6 +8,7 @@ import { useState } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { useIsAPIDocsSidePanelEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
||||
import { ProfileImage } from 'components/ui/ProfileImage'
|
||||
import { useProjectLintsQuery } from 'data/lint/lint-query'
|
||||
import { ProjectIndexPageLink } from 'data/prefetchers/project.$ref'
|
||||
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
||||
@@ -58,8 +59,6 @@ export const ICON_STROKE_WIDTH = 1.5
|
||||
const NavigationBar = () => {
|
||||
const snap = useAppStateSnapshot()
|
||||
|
||||
const [userDropdownOpen, setUserDropdownOpenState] = useState(false)
|
||||
|
||||
const [storedAllowNavPanel] = useLocalStorageQuery(
|
||||
LOCAL_STORAGE_KEYS.EXPAND_NAVIGATION_PANEL,
|
||||
true
|
||||
@@ -78,9 +77,7 @@ const NavigationBar = () => {
|
||||
'hide-scrollbar flex flex-col justify-between overflow-y-auto'
|
||||
)}
|
||||
onMouseEnter={() => allowNavPanelToExpand && snap.setNavigationPanelOpen(true)}
|
||||
onMouseLeave={() => {
|
||||
if (!userDropdownOpen && allowNavPanelToExpand) snap.setNavigationPanelOpen(false)
|
||||
}}
|
||||
onMouseLeave={() => allowNavPanelToExpand && snap.setNavigationPanelOpen(false)}
|
||||
>
|
||||
<NavContent />
|
||||
</nav>
|
||||
@@ -100,6 +97,7 @@ export const NavContent = () => {
|
||||
const signOut = useSignOut()
|
||||
|
||||
const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
|
||||
const [hasInvalidImg, setHasInvalidImg] = useState(false)
|
||||
const [userDropdownOpen, setUserDropdownOpenState] = useState(false)
|
||||
|
||||
const [storedAllowNavPanel] = useLocalStorageQuery(
|
||||
@@ -189,17 +187,19 @@ export const NavContent = () => {
|
||||
|
||||
const UserAccountButton = (
|
||||
<Button
|
||||
block
|
||||
type="text"
|
||||
size="tiny"
|
||||
className={cn(
|
||||
'mt-3 h-10 [&>span]:relative [&>span]:flex [&>span]:w-full [&>span]:h-full p-0'
|
||||
)}
|
||||
block
|
||||
>
|
||||
<div className="relative w-full h-full flex items-center justify-center">
|
||||
<figure className="absolute left-1.5 min-h-6 min-w-6 bg-foreground rounded-full flex items-center justify-center">
|
||||
<User size={ICON_SIZE - 2} strokeWidth={ICON_STROKE_WIDTH} className="text-background" />
|
||||
</figure>
|
||||
<ProfileImage
|
||||
alt={profile?.username}
|
||||
src={profile?.profileImageUrl}
|
||||
className="absolute left-1.5 w-6 h-6"
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
'w-full md:w-[8rem] flex flex-col items-start text-sm truncate',
|
||||
|
||||
@@ -290,7 +290,9 @@ export const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {
|
||||
</ButtonTooltip>
|
||||
{isFreePlan ? (
|
||||
<Button asChild type="primary">
|
||||
<Link href={`/org/${orgSlug}/billing?panel=subscriptionPlan`}>
|
||||
<Link
|
||||
href={`/org/${orgSlug}/billing?panel=subscriptionPlan&source=projectPausedStateRestore`}
|
||||
>
|
||||
Upgrade to Pro
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import saveAs from 'file-saver'
|
||||
import { Clipboard, Copy, Download, Edit, Lock, MoreHorizontal, Trash, Unlock } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import Papa from 'papaparse'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
import { IS_PLATFORM } from 'common'
|
||||
import {
|
||||
MAX_EXPORT_ROW_COUNT,
|
||||
@@ -17,14 +23,8 @@ import { EditorTablePageLink } from 'data/prefetchers/project.$ref.editor.$id'
|
||||
import { getTableEditor } from 'data/table-editor/table-editor-query'
|
||||
import { isTableLike } from 'data/table-editor/table-editor-types'
|
||||
import { fetchAllTableRows } from 'data/table-rows/table-rows-query'
|
||||
import saveAs from 'file-saver'
|
||||
import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
|
||||
import { LOCAL_STORAGE_KEYS } from 'lib/constants'
|
||||
import { copyToClipboard } from 'lib/helpers'
|
||||
import { Clipboard, Copy, Download, Edit, Lock, MoreHorizontal, Trash, Unlock } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import Papa from 'papaparse'
|
||||
import { toast } from 'sonner'
|
||||
import { useTableEditorStateSnapshot } from 'state/table-editor'
|
||||
import {
|
||||
cn,
|
||||
@@ -41,7 +41,6 @@ import {
|
||||
TooltipTrigger,
|
||||
TreeViewItemVariant,
|
||||
} from 'ui'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { useProjectContext } from '../ProjectLayout/ProjectContext'
|
||||
|
||||
export interface EntityListItemProps {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
import { partition } from 'lodash'
|
||||
import { Filter, Plus } from 'lucide-react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
import { useParams } from 'common'
|
||||
import { useBreakpoint } from 'common/hooks/useBreakpoint'
|
||||
import { ProtectedSchemaModal } from 'components/interfaces/Database/ProtectedSchemaWarning'
|
||||
@@ -15,10 +20,6 @@ import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { useLocalStorage } from 'hooks/misc/useLocalStorage'
|
||||
import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
|
||||
import { PROTECTED_SCHEMAS } from 'lib/constants/schemas'
|
||||
import { partition } from 'lodash'
|
||||
import { Filter, Plus } from 'lucide-react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useTableEditorStateSnapshot } from 'state/table-editor'
|
||||
import {
|
||||
AlertDescription_Shadcn_,
|
||||
@@ -123,7 +124,7 @@ const TableEditorMenu = () => {
|
||||
onSelectSchema={(name: string) => {
|
||||
setSearchText('')
|
||||
setSelectedSchema(name)
|
||||
router.push(`/project/${project?.ref}/editor`)
|
||||
router.push(`/project/${project?.ref}/editor?schema=${name}`)
|
||||
}}
|
||||
onSelectCreateSchema={() => snap.onAddSchema()}
|
||||
/>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ExternalLink } from 'lucide-react'
|
||||
import { PropsWithChildren } from 'react'
|
||||
|
||||
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
|
||||
import Link from 'next/link'
|
||||
import { Button } from 'ui'
|
||||
|
||||
interface ProductEmptyStateProps {
|
||||
@@ -14,6 +15,7 @@ interface ProductEmptyStateProps {
|
||||
loading?: boolean
|
||||
disabled?: boolean
|
||||
disabledMessage?: string
|
||||
ctaUrl?: string
|
||||
}
|
||||
|
||||
const ProductEmptyState = ({
|
||||
@@ -27,6 +29,7 @@ const ProductEmptyState = ({
|
||||
loading = false,
|
||||
disabled = false,
|
||||
disabledMessage = '',
|
||||
ctaUrl,
|
||||
}: PropsWithChildren<ProductEmptyStateProps>) => {
|
||||
const hasAction = (ctaButtonLabel && onClickCta) || (infoButtonUrl && infoButtonLabel)
|
||||
|
||||
@@ -40,7 +43,11 @@ const ProductEmptyState = ({
|
||||
<div className="flex flex-col space-y-2 text-foreground-light">{children}</div>
|
||||
{hasAction && (
|
||||
<div className="flex items-center space-x-2">
|
||||
{ctaButtonLabel && onClickCta && (
|
||||
{ctaButtonLabel && !!ctaUrl ? (
|
||||
<Button asChild type="primary">
|
||||
<Link href={ctaUrl}>{ctaButtonLabel}</Link>
|
||||
</Button>
|
||||
) : ctaButtonLabel && !!onClickCta ? (
|
||||
<ButtonTooltip
|
||||
type="primary"
|
||||
onClick={onClickCta}
|
||||
@@ -55,7 +62,7 @@ const ProductEmptyState = ({
|
||||
>
|
||||
{ctaButtonLabel}
|
||||
</ButtonTooltip>
|
||||
)}
|
||||
) : null}
|
||||
{infoButtonUrl && infoButtonLabel ? (
|
||||
<Button type="default" icon={<ExternalLink strokeWidth={1.5} />}>
|
||||
<a target="_blank" rel="noreferrer" href={infoButtonUrl}>
|
||||
|
||||
@@ -268,6 +268,7 @@ const StorageSettings = () => {
|
||||
icon={<Clock size={14} className="text-foreground-muted" />}
|
||||
primaryText="Free Plan has a fixed upload file size limit of 50 MB."
|
||||
secondaryText="Upgrade to the Pro Plan for a configurable upload file size limit of up to 50 GB."
|
||||
source="storageSizeLimit"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Megaphone } from 'lucide-react'
|
||||
import { forwardRef, PropsWithChildren, ReactNode } from 'react'
|
||||
import { Badge, Button, Loading, cn } from 'ui'
|
||||
|
||||
import { Badge, Button, cn, Loading } from 'ui'
|
||||
|
||||
interface PanelProps {
|
||||
className?: string
|
||||
@@ -62,71 +63,78 @@ const PanelNotice = forwardRef<
|
||||
description?: string
|
||||
href?: string
|
||||
buttonText?: string
|
||||
layout?: 'horizontal' | 'vertical'
|
||||
badgeLabel?: string
|
||||
}
|
||||
>(({ className, title, description, href, buttonText, badgeLabel, ...props }, ref) => {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
'relative px-4 md:px-6 py-5 bg-studio flex flex-col lg:flex-row lg:justify-between gap-6 overflow-hidden lg:items-center',
|
||||
className
|
||||
)}
|
||||
>
|
||||
>(
|
||||
(
|
||||
{
|
||||
className,
|
||||
title,
|
||||
description,
|
||||
href,
|
||||
buttonText,
|
||||
layout = 'horizontal',
|
||||
badgeLabel,
|
||||
...props
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
return (
|
||||
<div
|
||||
className="absolute inset-0 -mt-[5px]"
|
||||
style={{
|
||||
backgroundImage: `
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
'relative px-4 md:px-6 py-5 bg-studio flex flex-col lg:flex-row lg:justify-between gap-6 overflow-hidden lg:items-center',
|
||||
layout === 'vertical' && '!flex-col !items-start gap-y-2',
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className="absolute inset-0 -mt-[5px]"
|
||||
style={{
|
||||
backgroundImage: `
|
||||
linear-gradient(to right, hsl(var(--background-200)/1) 0%, hsl(var(--background-200)/1) 30%, hsl(var(--background-200)/0) 100%),
|
||||
linear-gradient(to right, hsl(var(--border-default)/0.33) 1px, transparent 1px),
|
||||
linear-gradient(to bottom, hsl(var(--border-default)/0.33) 1px, transparent 1px)
|
||||
`,
|
||||
backgroundSize: '100% 100%, 15px 15px, 15px 15px',
|
||||
backgroundPosition: '0 0, 0 0, 0 0',
|
||||
}}
|
||||
></div>
|
||||
<div className="relative flex flex-col gap-1">
|
||||
<div className="flex flex-row items-center -space-x-px">
|
||||
<Badge
|
||||
variant={'default'}
|
||||
className="
|
||||
rounded-r-none
|
||||
pr-2
|
||||
flex-shrink-0 gap-1.5 border-dashed bg-opacity-0 bg-surface-400 text-foreground-lighter"
|
||||
>
|
||||
<Megaphone size={16} strokeWidth={1.2} />
|
||||
<span className="text-foreground-lighter">{badgeLabel ?? 'Upcoming change'}</span>
|
||||
</Badge>
|
||||
<Badge
|
||||
variant={'default'}
|
||||
className="
|
||||
rounded-l-none
|
||||
flex-shrink-0 gap-1.5 bg-opacity-0 bg-surface-400 text-foreground-lighter border-l-0"
|
||||
>
|
||||
<span className="text-foreground text-xs">{title}</span>
|
||||
</Badge>
|
||||
{/* <span className="font-medium text-foreground text-sm">{title}</span> */}
|
||||
</div>
|
||||
{description && (
|
||||
<div className="text-foreground-light text-sm flex flex-col gap-0">
|
||||
<div className="prose text-xs max-w-none [&_p]:mt-2 [&_p]:mb-0">{description}</div>
|
||||
backgroundSize: '100% 100%, 15px 15px, 15px 15px',
|
||||
backgroundPosition: '0 0, 0 0, 0 0',
|
||||
}}
|
||||
/>
|
||||
<div className="relative flex flex-col gap-y-2">
|
||||
<div className="flex flex-row items-center -space-x-px">
|
||||
<Badge
|
||||
variant={'default'}
|
||||
className="rounded-r-none pr-2 flex-shrink-0 gap-1.5 border-dashed bg-opacity-0 bg-surface-400 text-foreground-lighter"
|
||||
>
|
||||
<Megaphone size={16} strokeWidth={1.2} />
|
||||
<span className="text-foreground-lighter">{badgeLabel ?? 'Upcoming change'}</span>
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="default"
|
||||
className="rounded-l-none flex-shrink-0 gap-1.5 bg-opacity-0 bg-surface-400 text-foreground-lighter border-l-0"
|
||||
>
|
||||
<span className="text-foreground text-xs">{title}</span>
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{href && (
|
||||
<div>
|
||||
{description && (
|
||||
<div className="text-foreground-light text-sm flex flex-col gap-0">
|
||||
<div className="prose text-xs max-w-none [&_p]:mt-2 [&_p]:mb-0">{description}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{href && (
|
||||
<Button size="tiny" type="default" className="text-xs" asChild>
|
||||
<a href={href} target="_blank" rel="noreferrer noopener">
|
||||
{buttonText ?? 'Read the accouncement'}
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
PanelNotice.displayName = 'PanelNotice'
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import Image from 'next/image'
|
||||
import { ReactNode, useState } from 'react'
|
||||
|
||||
import { User } from 'icons'
|
||||
import { cn } from 'ui'
|
||||
|
||||
interface ProfileImageProps {
|
||||
alt?: string
|
||||
src?: string
|
||||
placeholder?: ReactNode
|
||||
className?: string
|
||||
}
|
||||
|
||||
export const ProfileImage = ({ alt, src, placeholder, className }: ProfileImageProps) => {
|
||||
const [hasInvalidImg, setHasInvalidImg] = useState(false)
|
||||
|
||||
return !!src && !hasInvalidImg ? (
|
||||
<Image
|
||||
alt={alt ?? ''}
|
||||
src={src}
|
||||
width="24"
|
||||
height="24"
|
||||
className={cn('bg-foreground rounded-full', className)}
|
||||
onError={() => setHasInvalidImg(true)}
|
||||
/>
|
||||
) : (
|
||||
placeholder ?? (
|
||||
<figure
|
||||
className={cn('bg-foreground rounded-full flex items-center justify-center', className)}
|
||||
>
|
||||
<User size={18} strokeWidth={1.5} className="text-background" />
|
||||
</figure>
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
import { Check, ChevronsUpDown, Plus } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
||||
import { useSchemasQuery } from 'data/database/schemas-query'
|
||||
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { Check, ChevronsUpDown, Plus } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
AlertDescription_Shadcn_,
|
||||
AlertTitle_Shadcn_,
|
||||
|
||||
@@ -16,6 +16,7 @@ interface UpgradeToProProps {
|
||||
secondaryText: string
|
||||
addon?: 'pitr' | 'customDomain' | 'computeInstance'
|
||||
buttonText?: string
|
||||
source?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
@@ -25,6 +26,7 @@ const UpgradeToPro = ({
|
||||
secondaryText,
|
||||
addon,
|
||||
buttonText,
|
||||
source = 'upgrade',
|
||||
disabled = false,
|
||||
}: UpgradeToProProps) => {
|
||||
const project = useSelectedProject()
|
||||
@@ -80,8 +82,8 @@ const UpgradeToPro = ({
|
||||
<Link
|
||||
href={
|
||||
plan === 'free'
|
||||
? `/org/${organization?.slug ?? '_'}/billing?panel=subscriptionPlan`
|
||||
: `/project/${project?.ref ?? '_'}/settings/addons?panel=${addon}`
|
||||
? `/org/${organization?.slug ?? '_'}/billing?panel=subscriptionPlan&source=${source}`
|
||||
: `/project/${project?.ref ?? '_'}/settings/addons?panel=${addon}&source=${source}`
|
||||
}
|
||||
>
|
||||
{buttonText || (plan === 'free' ? 'Upgrade to Pro' : 'Enable add on')}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { components } from 'api-types'
|
||||
import { get, handleError } from 'data/fetchers'
|
||||
import { IS_PLATFORM } from 'lib/constants'
|
||||
import { ResponseError } from 'types'
|
||||
import { edgeFunctionsKeys } from './keys'
|
||||
|
||||
export type EdgeFunctionVariables = {
|
||||
@@ -28,7 +29,7 @@ export async function getEdgeFunction(
|
||||
}
|
||||
|
||||
export type EdgeFunctionData = Awaited<ReturnType<typeof getEdgeFunction>>
|
||||
export type EdgeFunctionError = unknown
|
||||
export type EdgeFunctionError = ResponseError
|
||||
|
||||
export const useEdgeFunctionQuery = <TData = EdgeFunctionData>(
|
||||
{ projectRef, slug }: EdgeFunctionVariables,
|
||||
|
||||
@@ -10,6 +10,7 @@ export type OrganizationUpdateVariables = {
|
||||
slug: string
|
||||
name?: string
|
||||
billing_email?: string
|
||||
additional_billing_emails?: string[]
|
||||
opt_in_tags?: string[]
|
||||
}
|
||||
|
||||
@@ -18,12 +19,14 @@ export async function updateOrganization({
|
||||
name,
|
||||
billing_email,
|
||||
opt_in_tags,
|
||||
additional_billing_emails,
|
||||
}: OrganizationUpdateVariables) {
|
||||
// @ts-ignore [Joshen] API spec is wrong
|
||||
const payload: components['schemas']['UpdateOrganizationBody'] = {}
|
||||
if (name) payload.name = name
|
||||
if (billing_email) payload.billing_email = billing_email
|
||||
if (opt_in_tags) payload.opt_in_tags = opt_in_tags
|
||||
if (additional_billing_emails) payload.additional_billing_emails = additional_billing_emails
|
||||
|
||||
const { data, error } = await patch('/platform/organizations/{slug}', {
|
||||
params: { path: { slug } },
|
||||
@@ -50,8 +53,57 @@ export const useOrganizationUpdateMutation = ({
|
||||
(vars) => updateOrganization(vars),
|
||||
{
|
||||
async onSuccess(data, variables, context) {
|
||||
// [Joshen] Not sure if necessary to refresh the organizations list though
|
||||
await queryClient.invalidateQueries(organizationKeys.list())
|
||||
queryClient.setQueriesData(
|
||||
{
|
||||
queryKey: organizationKeys.list(),
|
||||
exact: true,
|
||||
},
|
||||
(prev: components['schemas']['OrganizationResponse'][] | undefined) => {
|
||||
if (!prev) return prev
|
||||
|
||||
return prev.map((org) => {
|
||||
if (org.slug !== variables.slug) return org
|
||||
|
||||
return {
|
||||
...org,
|
||||
name: variables.name || org.name,
|
||||
billing_email: variables.billing_email || org.billing_email,
|
||||
opt_in_tags: variables.opt_in_tags || org.opt_in_tags,
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
queryClient.setQueriesData(
|
||||
{
|
||||
queryKey: organizationKeys.customerProfile(data.slug),
|
||||
exact: true,
|
||||
},
|
||||
(prev: components['schemas']['CustomerResponse'] | undefined) => {
|
||||
if (!prev) return prev
|
||||
return {
|
||||
...prev,
|
||||
additional_emails: variables.additional_billing_emails || prev.additional_emails,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
queryClient.setQueriesData(
|
||||
{
|
||||
queryKey: organizationKeys.detail(data.slug),
|
||||
exact: true,
|
||||
},
|
||||
(prev: components['schemas']['OrganizationSlugResponse'] | undefined) => {
|
||||
if (!prev) return prev
|
||||
return {
|
||||
...prev,
|
||||
name: variables.name || prev.name,
|
||||
billing_email: variables.billing_email || prev.billing_email,
|
||||
opt_in_tags: variables.opt_in_tags || prev.opt_in_tags,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
await onSuccess?.(data, variables, context)
|
||||
},
|
||||
async onError(data, variables, context) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { components } from 'data/api'
|
||||
|
||||
export type Profile = components['schemas']['ProfileResponse']
|
||||
export type Profile = components['schemas']['ProfileResponse'] & {
|
||||
profileImageUrl?: string
|
||||
}
|
||||
|
||||
export type Feature = Profile['disabled_features'][number]
|
||||
@@ -63,3 +63,7 @@ export function openInstallGitHubIntegrationWindow(type: 'install' | 'authorize'
|
||||
newWindow.focus()
|
||||
}
|
||||
}
|
||||
|
||||
export const getGitHubProfileImgUrl = (username: string) => {
|
||||
return `https://github.com/${username}.png?size=80`
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import type { Profile } from 'data/profile/types'
|
||||
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
|
||||
import type { ResponseError } from 'types'
|
||||
import { useSignOut } from './auth'
|
||||
import { getGitHubProfileImgUrl } from './github'
|
||||
|
||||
export type ProfileContextType = {
|
||||
profile: Profile | undefined
|
||||
@@ -74,10 +75,12 @@ export const ProfileProvider = ({ children }: PropsWithChildren<{}>) => {
|
||||
|
||||
const value = useMemo(() => {
|
||||
const isLoading = isLoadingProfile || isCreatingProfile || isLoadingPermissions
|
||||
const isGHUser = !!profile && 'auth0_id' in profile && profile?.auth0_id.startsWith('github')
|
||||
const profileImageUrl = isGHUser ? getGitHubProfileImgUrl(profile.username) : undefined
|
||||
|
||||
return {
|
||||
error,
|
||||
profile,
|
||||
profile: !!profile ? { ...profile, profileImageUrl } : undefined,
|
||||
isLoading,
|
||||
isError,
|
||||
isSuccess,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
|
||||
import { AdvancedAuthSettingsForm, SmtpForm, ThirdPartyAuthForm } from 'components/interfaces/Auth'
|
||||
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
import {
|
||||
ScaffoldContainer,
|
||||
ScaffoldDescription,
|
||||
@@ -13,7 +14,7 @@ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
|
||||
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
|
||||
const AdvancedAuthSettings: NextPageWithLayout = () => {
|
||||
const PageLayout: NextPageWithLayout = () => {
|
||||
const isPermissionsLoaded = usePermissionsLoaded()
|
||||
// TODO: check if these permissions cover third party auth as well
|
||||
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
|
||||
@@ -40,7 +41,11 @@ const AdvancedAuthSettings: NextPageWithLayout = () => {
|
||||
)
|
||||
}
|
||||
|
||||
AdvancedAuthSettings.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
PageLayout.getLayout = (page) => {
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
export default AdvancedAuthSettings
|
||||
export default PageLayout
|
||||
@@ -2,6 +2,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
|
||||
import { MfaAuthSettingsForm } from 'components/interfaces/Auth'
|
||||
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
import {
|
||||
ScaffoldContainer,
|
||||
ScaffoldDescription,
|
||||
@@ -13,7 +14,7 @@ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
|
||||
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
|
||||
const AuthSettings: NextPageWithLayout = () => {
|
||||
const PageLayout: NextPageWithLayout = () => {
|
||||
const isPermissionsLoaded = usePermissionsLoaded()
|
||||
// TODO: check if these permissions cover third party auth as well
|
||||
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
|
||||
@@ -43,7 +44,11 @@ const AuthSettings: NextPageWithLayout = () => {
|
||||
)
|
||||
}
|
||||
|
||||
AuthSettings.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
PageLayout.getLayout = (page) => {
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
export default AuthSettings
|
||||
export default PageLayout
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
ThirdPartyAuthForm,
|
||||
} from 'components/interfaces/Auth'
|
||||
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
import { ScaffoldHeader, ScaffoldContainer, ScaffoldTitle } from 'components/layouts/Scaffold'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
|
||||
@@ -35,7 +36,10 @@ const PageLayout: NextPageWithLayout = () => {
|
||||
}
|
||||
|
||||
PageLayout.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageLayout
|
||||
@@ -2,13 +2,14 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
|
||||
import { SessionsAuthSettingsForm, SmtpForm, ThirdPartyAuthForm } from 'components/interfaces/Auth'
|
||||
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
import { ScaffoldContainer, ScaffoldHeader, ScaffoldTitle } from 'components/layouts/Scaffold'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
|
||||
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
|
||||
const AuthSettings: NextPageWithLayout = () => {
|
||||
const PageLayout: NextPageWithLayout = () => {
|
||||
const isPermissionsLoaded = usePermissionsLoaded()
|
||||
// TODO: check if these permissions cover third party auth as well
|
||||
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
|
||||
@@ -33,7 +34,11 @@ const AuthSettings: NextPageWithLayout = () => {
|
||||
)
|
||||
}
|
||||
|
||||
AuthSettings.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
PageLayout.getLayout = (page) => {
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
export default AuthSettings
|
||||
export default PageLayout
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
} from 'components/layouts/Scaffold'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
|
||||
const PageLayout: NextPageWithLayout = () => {
|
||||
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
|
||||
@@ -69,7 +70,10 @@ const PageLayout: NextPageWithLayout = () => {
|
||||
}
|
||||
|
||||
PageLayout.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageLayout
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
} from 'components/layouts/Scaffold'
|
||||
import NoPermission from 'components/ui/NoPermission'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
import DefaultLayout from 'components/layouts/DefaultLayout'
|
||||
|
||||
const PageLayout: NextPageWithLayout = () => {
|
||||
const canReadAuthSettings = useCheckPermissions(PermissionAction.READ, 'custom_config_gotrue')
|
||||
@@ -69,7 +70,10 @@ const PageLayout: NextPageWithLayout = () => {
|
||||
}
|
||||
|
||||
PageLayout.getLayout = (page) => {
|
||||
return <AuthLayout>{page}</AuthLayout>
|
||||
return (
|
||||
<DefaultLayout>
|
||||
<AuthLayout>{page}</AuthLayout>
|
||||
</DefaultLayout>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageLayout
|
||||
@@ -89,6 +89,7 @@ const PITR = () => {
|
||||
{!isEnabled ? (
|
||||
<UpgradeToPro
|
||||
addon="pitr"
|
||||
source="pitr"
|
||||
primaryText="Point in Time Recovery is a Pro Plan add-on."
|
||||
secondaryText={
|
||||
plan === 'free'
|
||||
|
||||
@@ -195,6 +195,7 @@ const RestoreToNewProject = () => {
|
||||
return (
|
||||
<UpgradeToPro
|
||||
buttonText="Upgrade"
|
||||
source="backupsRestoreToNewProject"
|
||||
primaryText="Restore to a new project requires a pro plan or above."
|
||||
secondaryText="To restore to a new project, you need to upgrade to a Pro plan and have physical backups enabled."
|
||||
/>
|
||||
|
||||
@@ -6,7 +6,8 @@ module.exports = config({
|
||||
'./components/**/*.{js,ts,jsx,tsx}',
|
||||
// purge styles from grid library
|
||||
'./../../packages/ui/src/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/!(node_modules)/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/**/*.{tsx,ts,js}',
|
||||
'!./../../packages/ui-patterns/node_modules/**/*', // ignore node_modules rule
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
|
||||
@@ -64,7 +64,7 @@ List the Storage buckets in your Supabase project.
|
||||
|
||||
We're excited to continue adding more features that will make your development experience with Supabase even more delightful - and for this we need your help! If you have any feedback, feature requests, or bug reports, please [open an issue on GitHub](https://github.com/supabase-community/supabase-vscode-extension/issues).
|
||||
|
||||
The extension requires you to have the Supabase CLI installed and have your project running locally. In a future release, we will integrate the [Supabase Managamenet API](/docs/reference/api/introduction) into the extension to make connecting to your hosted Supabase projects as seamless as possible.
|
||||
The extension requires you to have the Supabase CLI installed and have your project running locally. In a future release, we will integrate the [Supabase Management API](/docs/reference/api/introduction) into the extension to make connecting to your hosted Supabase projects as seamless as possible.
|
||||
|
||||
## Contributing to Supabase
|
||||
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ Realtime uses the private flag client's define when creating channel, takes the
|
||||
light:
|
||||
'/images/blog/2024-08-13-supabase-realtime-broadcast-and-presence-authorization/one-user-connection--light.png',
|
||||
}}
|
||||
alt="Flow of checks done against the databse to determine the policies for a user connection."
|
||||
alt="Flow of checks done against the database to determine the policies for a user connection."
|
||||
/>
|
||||
|
||||
## How is this approach performant?
|
||||
|
||||
@@ -35,7 +35,7 @@ A feature tri-fecta: Edge Functions now support Websockets for things like OpenA
|
||||
|
||||
## #4: CLI v2: Config as Code
|
||||
|
||||
We realeased v2 of the CLI, adding support for Configuration as Code. You can now use the CLI in your GitHub actions to keep all of your project configuration in sync.
|
||||
We released v2 of the CLI, adding support for Configuration as Code. You can now use the CLI in your GitHub actions to keep all of your project configuration in sync.
|
||||
|
||||
## #5: High Performance Disks
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ module.exports = config({
|
||||
'./lib/mdx/mdxComponents.tsx',
|
||||
'./pages/**/*.{tsx,mdx}',
|
||||
'./../../packages/ui/src/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/!(node_modules)/**/*.{tsx,ts,js}',
|
||||
'./../../packages/ui-patterns/**/*.{tsx,ts,js}',
|
||||
'!./../../packages/ui-patterns/node_modules/**/*', // ignore node_modules rule
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
|
||||
Vendored
+2
@@ -8255,6 +8255,7 @@ export interface components {
|
||||
walg_enabled: boolean
|
||||
}
|
||||
BillingCustomerUpdateBody: {
|
||||
additional_emails?: string[] | undefined
|
||||
address?: components['schemas']['CustomerBillingAddress']
|
||||
}
|
||||
/** @enum {string} */
|
||||
@@ -8791,6 +8792,7 @@ export interface components {
|
||||
state?: string
|
||||
}
|
||||
CustomerResponse: {
|
||||
additional_emails: string[] | null
|
||||
address: components['schemas']['CustomerBillingAddress'] | null
|
||||
balance: number
|
||||
billing_via_partner: boolean
|
||||
|
||||
@@ -1069,7 +1069,13 @@ export interface StudioPricingPlanCtaClickedEvent {
|
||||
*/
|
||||
export interface StudioPricingSidePanelOpenedEvent {
|
||||
action: TelemetryActions.STUDIO_PRICING_SIDE_PANEL_OPENED
|
||||
properties: { currentPlan?: string }
|
||||
properties: {
|
||||
currentPlan?: string
|
||||
/**
|
||||
* Tracks how user landed on the Pricing side panel, e.g. diskManagementPanelDiskSize, backupsRestoreToNewProject
|
||||
*/
|
||||
origin?: string
|
||||
}
|
||||
groups: { organization: string }
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ const WarningIcon = () => (
|
||||
const admonitionSVG = cva('', {
|
||||
variants: {
|
||||
type: {
|
||||
default: `[&>svg]:bg-foreground-muted [&>svg]:text-background-muted`,
|
||||
warning: `[&>svg]:bg-warning [&>svg]:text-warning-100`,
|
||||
destructive: `[&>svg]:bg-destructive [&>svg]:text-white`,
|
||||
default: `[&>svg]:bg-foreground-muted`,
|
||||
warning: ``,
|
||||
destructive: ``,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -80,7 +80,7 @@ const admonitionBase = cva('', {
|
||||
variants: {
|
||||
type: {
|
||||
default: `bg-surface-200/25 border border-default`,
|
||||
warning: `bg-alternative border border-default ![&_p]:text-background-muted`,
|
||||
warning: `bg-alternative border border-default`,
|
||||
destructive: `bg-alternative border border-default`,
|
||||
},
|
||||
},
|
||||
@@ -96,13 +96,13 @@ export const Admonition = forwardRef<
|
||||
) => {
|
||||
const typeMapped = variant ? admonitionToAlertMapping[variant] : admonitionToAlertMapping[type]
|
||||
|
||||
|
||||
return (
|
||||
<Alert_Shadcn_
|
||||
ref={ref}
|
||||
variant={typeMapped}
|
||||
{...props}
|
||||
className={cn(
|
||||
'not-prose',
|
||||
'mb-2',
|
||||
'[&_a]:underline',
|
||||
admonitionSVG({ type: typeMapped }),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import React, { useEffect } from 'react'
|
||||
import { Check, ChevronsUpDown, X as RemoveIcon } from 'lucide-react'
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
import { SIZE_VARIANTS, SIZE_VARIANTS_DEFAULT } from 'ui/src/lib/constants'
|
||||
import { VariantProps, cva } from 'class-variance-authority'
|
||||
import { SIZE_VARIANTS, SIZE_VARIANTS_DEFAULT } from 'ui/src/lib/constants'
|
||||
|
||||
import { cn, Badge, useOnClickOutside } from 'ui'
|
||||
import { Badge, cn, useOnClickOutside } from 'ui'
|
||||
import {
|
||||
Command,
|
||||
CommandEmpty,
|
||||
@@ -31,6 +31,12 @@ interface MultiSelectContextProps {
|
||||
|
||||
const MultiSelectContext = React.createContext<MultiSelectContextProps | null>(null)
|
||||
|
||||
const commandItemClass = cn(
|
||||
'relative text-foreground-lighter text-left px-2 py-1.5 rounded',
|
||||
'hover:text-foreground hover:!bg-overlay-hover w-full flex items-center space-x-2',
|
||||
'peer-data-[value=true]:bg-overlay-hover peer-data-[value=true]:text-strong'
|
||||
)
|
||||
|
||||
function useMultiSelect() {
|
||||
const context = React.useContext(MultiSelectContext)
|
||||
if (!context) {
|
||||
@@ -211,6 +217,7 @@ const MultiSelectorTrigger = React.forwardRef<HTMLButtonElement, MultiSelectorTr
|
||||
const handleTriggerClick: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(
|
||||
(event) => {
|
||||
setOpen(true)
|
||||
setInputValue('')
|
||||
|
||||
if (IS_INLINE_MODE) {
|
||||
event.stopPropagation()
|
||||
@@ -229,6 +236,7 @@ const MultiSelectorTrigger = React.forwardRef<HTMLButtonElement, MultiSelectorTr
|
||||
ref={inputRef}
|
||||
onClick={(e) => !isDeleteHovered && handleTriggerClick(e)}
|
||||
disabled={disabled}
|
||||
type="button"
|
||||
role="combobox"
|
||||
className={cn(
|
||||
'flex w-full min-w-[200px] min-h-[40px] items-center justify-between rounded-md border',
|
||||
@@ -257,7 +265,8 @@ const MultiSelectorTrigger = React.forwardRef<HTMLButtonElement, MultiSelectorTr
|
||||
<div
|
||||
onMouseEnter={() => setIsDeleteHovered(true)}
|
||||
onMouseLeave={() => setIsDeleteHovered(false)}
|
||||
onClick={() => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
toggleValue(value)
|
||||
setIsDeleteHovered(false)
|
||||
}}
|
||||
@@ -419,21 +428,55 @@ MultiSelector.Content = MultiSelectorContent
|
||||
|
||||
const MultiSelectorList = React.forwardRef<
|
||||
React.ElementRef<typeof CommandList>,
|
||||
React.ComponentPropsWithoutRef<typeof CommandList>
|
||||
>(({ className, children }, ref) => {
|
||||
React.ComponentPropsWithoutRef<typeof CommandList> & {
|
||||
creatable?: boolean
|
||||
}
|
||||
>(({ className, children, creatable = false }, ref) => {
|
||||
const { open, inputValue, setInputValue, toggleValue } = useMultiSelect()
|
||||
|
||||
const options = !!children
|
||||
? Array.isArray(children)
|
||||
? (children as React.ReactNode[])
|
||||
: typeof children === 'object' && 'props' in children
|
||||
? children.props.children
|
||||
: []
|
||||
: []
|
||||
const availableOptions = options
|
||||
.filter((x: any) => !!x.props.value)
|
||||
.map((x: any) => x.props.value.toLowerCase())
|
||||
const isOptionExists = availableOptions.some((x: string) => x === inputValue.toLowerCase())
|
||||
|
||||
return (
|
||||
<CommandList
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'p-2 flex flex-col gap-2 scrollbar-thin scrollbar-track-transparent transition-colors scrollbar-thumb-muted-foreground dark:scrollbar-thumb-muted scrollbar-thumb-rounded-lg w-full',
|
||||
'max-h-[300px] overflow-y-auto',
|
||||
'p-2 flex flex-col gap-2 scrollbar-thin scrollbar-track-transparent transition-colors',
|
||||
'scrollbar-thumb-muted-foreground dark:scrollbar-thumb-muted',
|
||||
'scrollbar-thumb-rounded-lg w-full max-h-[300px] overflow-y-auto',
|
||||
className
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
<CommandEmpty>
|
||||
<span className="text-foreground-muted">No results found</span>
|
||||
</CommandEmpty>
|
||||
{creatable && inputValue.length > 0 && !isOptionExists ? (
|
||||
<CommandItem
|
||||
role="option"
|
||||
onSelect={() => {
|
||||
open && toggleValue(inputValue)
|
||||
setInputValue('')
|
||||
}}
|
||||
className={commandItemClass}
|
||||
>
|
||||
Create "{inputValue}"
|
||||
</CommandItem>
|
||||
) : creatable && options.length === 0 ? (
|
||||
<div className="p-2 py-1.5 text-xs text-foreground-lighter font-italic">
|
||||
Type to add a value
|
||||
</div>
|
||||
) : (
|
||||
<CommandEmpty>
|
||||
<span className="text-foreground-muted">No results found</span>
|
||||
</CommandEmpty>
|
||||
)}
|
||||
</CommandList>
|
||||
)
|
||||
})
|
||||
@@ -457,15 +500,7 @@ const MultiSelectorItem = React.forwardRef<
|
||||
open && toggleValue(value)
|
||||
setInputValue('')
|
||||
}}
|
||||
className={cn(
|
||||
'relative',
|
||||
'text-foreground-lighter text-left',
|
||||
'px-2 py-1.5 rounded',
|
||||
'hover:text-foreground hover:!bg-overlay-hover',
|
||||
'w-full flex items-center space-x-2',
|
||||
'peer-data-[value=true]:bg-overlay-hover peer-data-[value=true]:text-strong',
|
||||
className
|
||||
)}
|
||||
className={cn(commandItemClass, className)}
|
||||
{...props}
|
||||
>
|
||||
<div
|
||||
|
||||
@@ -250,6 +250,7 @@ export * from './src/components/radio-group-card'
|
||||
export * from './src/components/TreeView'
|
||||
|
||||
export * from './src/components/shadcn/ui/chart'
|
||||
export * from './src/components/shadcn/ui/sidebar'
|
||||
|
||||
// links
|
||||
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user