Chore/move advisors (#30283)

* Move advisory things to Advisors page, move schema visualizer to top of database section

* Tiny clean up

* Tiny clean up

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
Terry Sutton
2024-11-05 05:55:23 -03:30
committed by GitHub
parent 3f10a9f812
commit dd4788bce4
11 changed files with 38 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ Features:
- Identifies tables/columns obfuscated by views
- Skips duplicate indexes
`index_advisor` is accessible directly through Supabase Studio by navigating to the [Query Performance Report](/dashboard/project/_/database/query-performance) and selecting a query and then the "indexes" tab.
`index_advisor` is accessible directly through Supabase Studio by navigating to the [Query Performance Report](/dashboard/project/_/advisors/query-performance) and selecting a query and then the "indexes" tab.
![Supabase Studio index_advisor integration.](/docs/img/index_advisor_studio.png)

View File

@@ -121,7 +121,7 @@ For more information on the Index Advisor and its suggestions, see the [`index_a
To use the Dashboard Index Advisor:
1. Go to the [Query Performance](/dashboard/project/_/database/query-performance) page.
1. Go to the [Query Performance](/dashboard/project/_/advisors/query-performance) page.
1. Click on a query to bring up the Details side panel.
1. Select the Indexes tab.
1. Enable Index Advisor if prompted.

View File

@@ -153,7 +153,7 @@ limit 100;
### Using the Query Performance page
Go to the [Query Performance page](/dashboard/project/_/database/query-performance?preset=slowest_execution) and filter by relevant role and query speeds. This only identifies slow-running but successful queries. Unlike the Log Explorer, it does not show you timed-out queries.
Go to the [Query Performance page](/dashboard/project/_/advisors/query-performance?preset=slowest_execution) and filter by relevant role and query speeds. This only identifies slow-running but successful queries. Unlike the Log Explorer, it does not show you timed-out queries.
### Understanding roles in logs

View File

@@ -17,8 +17,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
<StepHikeCompact>
<StepHikeCompact.Step step={1}>
<StepHikeCompact.Details title="Create a custom user for Prisma">
- In the [SQL Editor](https://supabase.com/dashboard/project/_/sql/new), create a Prisma db-user with full privileges on the public schema.
- This gives you better control over Prisma's access and makes it easier to monitor using Supabase tools like the [Query Performance Dashboard](https://supabase.com/dashboard/project/_/database/query-performance) and [Log Explorer](https://supabase.com/dashboard/project/_/logs/explorer).
- In the [SQL Editor](https://supabase.com/dashboard/project/_/sql/new), create a Prisma db-user with full privileges on the public schema.
- This gives you better control over Prisma's access and makes it easier to monitor using Supabase tools like the [Query Performance Dashboard](https://supabase.com/dashboard/project/_/advisors/query-performance) and [Log Explorer](https://supabase.com/dashboard/project/_/logs/explorer).
<Admonition type="note" label="password manager">
For security, consider using a [password generator](https://bitwarden.com/password-generator/) for the Prisma role.

View File

@@ -9,17 +9,23 @@ export const generateAdvisorsMenu = (project?: Project): ProductMenuGroup[] => {
title: 'Advisors',
items: [
{
name: 'Security',
name: 'Security Advisor',
key: 'security',
url: `/project/${ref}/advisors/security`,
items: [],
},
{
name: 'Performance',
name: 'Performance Advisor',
key: 'performance',
url: `/project/${ref}/advisors/performance`,
items: [],
},
{
name: 'Query Performance',
key: 'query-performance',
url: `/project/${ref}/advisors/query-performance`,
items: [],
},
],
},
]

View File

@@ -7,7 +7,6 @@ import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-ex
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
import { useFlag } from 'hooks/ui/useFlag'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
import { generateDatabaseMenu } from './DatabaseMenu.utils'
@@ -30,7 +29,6 @@ const DatabaseProductMenu = () => {
const pgNetExtensionExists = (data ?? []).find((ext) => ext.name === 'pg_net') !== undefined
const pitrEnabled = addons?.selected_addons.find((addon) => addon.type === 'pitr') !== undefined
const columnLevelPrivileges = useIsColumnLevelPrivilegesEnabled()
const cronUiEnabled = useFlag('cronUi')
return (
<>
@@ -40,7 +38,6 @@ const DatabaseProductMenu = () => {
pgNetExtensionExists,
pitrEnabled,
columnLevelPrivileges,
cronUiEnabled,
})}
/>
</>

View File

@@ -9,16 +9,21 @@ export const generateDatabaseMenu = (
pgNetExtensionExists: boolean
pitrEnabled: boolean
columnLevelPrivileges: boolean
cronUiEnabled: boolean
}
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
const { pgNetExtensionExists, pitrEnabled, columnLevelPrivileges, cronUiEnabled } = flags || {}
const { pgNetExtensionExists, pitrEnabled, columnLevelPrivileges } = flags || {}
return [
{
title: 'Database Management',
items: [
{
name: 'Schema Visualizer',
key: 'schemas',
url: `/project/${ref}/database/schemas`,
items: [],
},
{ name: 'Tables', key: 'tables', url: `/project/${ref}/database/tables`, items: [] },
{
name: 'Functions',
@@ -127,18 +132,6 @@ export const generateDatabaseMenu = (
{
title: 'Tools',
items: [
{
name: 'Schema Visualizer',
key: 'schemas',
url: `/project/${ref}/database/schemas`,
items: [],
},
{
name: 'Query Performance',
key: 'query-performance',
url: `/project/${ref}/database/query-performance`,
items: [],
},
{
name: 'Security Advisor',
key: 'security-advisor',
@@ -153,6 +146,13 @@ export const generateDatabaseMenu = (
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
items: [],
},
{
name: 'Query Performance',
key: 'query-performance',
url: `/project/${ref}/advisors/query-performance`,
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
items: [],
},
],
},
]

View File

@@ -62,7 +62,7 @@ export const generateProductRoutes = (
(isProjectBuilding
? buildingUrl
: isProjectActive
? `/project/${ref}/database/tables`
? `/project/${ref}/database/schemas`
: `/project/${ref}/database/backups/scheduled`),
},
...(authEnabled

View File

@@ -372,7 +372,12 @@ const nextConfig = {
{
permanent: true,
source: '/project/:ref/reports/query-performance',
destination: '/project/:ref/database/query-performance',
destination: '/project/:ref/advisors/query-performance',
},
{
permanent: true,
source: '/project/:ref/database/query-performance',
destination: '/project/:ref/advisors/query-performance',
},
{
permanent: true,

View File

@@ -10,7 +10,7 @@ import {
} from 'components/interfaces/Reports/Reports.queries'
import { Presets } from 'components/interfaces/Reports/Reports.types'
import { queriesFactory } from 'components/interfaces/Reports/Reports.utils'
import DatabaseLayout from 'components/layouts/DatabaseLayout/DatabaseLayout'
import AdvisorsLayout from 'components/layouts/AdvisorsLayout/AdvisorsLayout'
import DatabaseSelector from 'components/ui/DatabaseSelector'
import { FormHeader } from 'components/ui/Forms/FormHeader'
import type { NextPageWithLayout } from 'types'
@@ -58,7 +58,7 @@ const QueryPerformanceReport: NextPageWithLayout = () => {
}
QueryPerformanceReport.getLayout = (page) => (
<DatabaseLayout title="Query performance">{page}</DatabaseLayout>
<AdvisorsLayout title="Query performance">{page}</AdvisorsLayout>
)
export default QueryPerformanceReport

View File

@@ -177,7 +177,7 @@
"link": "/guides/database/extensions/index_advisor",
"github_url": "https://github.com/supabase/index_advisor",
"product": "Index Advisor Report",
"product_url": "/project/{ref}/database/query-performance"
"product_url": "/project/{ref}/advisors/query-performance"
},
{
"name": "intarray",
@@ -303,7 +303,7 @@
"link": "/guides/database/extensions/pg_stat_statements",
"github_url": null,
"product": "Query Performance",
"product_url": "/project/{ref}/database/query-performance"
"product_url": "/project/{ref}/advisors/query-performance"
},
{
"name": "pg_surgery",