From dd4788bce48cbc0729faff0901fd329c476dd7fd Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Tue, 5 Nov 2024 05:55:23 -0330 Subject: [PATCH] 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 --- .../database/extensions/index_advisor.mdx | 2 +- .../guides/database/postgres/indexes.mdx | 2 +- .../guides/database/postgres/timeouts.mdx | 2 +- apps/docs/content/guides/database/prisma.mdx | 4 +-- .../AdvisorsLayout/AdvisorsMenu.utils.ts | 10 +++++-- .../layouts/DatabaseLayout/DatabaseLayout.tsx | 3 -- .../DatabaseLayout/DatabaseMenu.utils.tsx | 28 +++++++++---------- .../NavigationBar/NavigationBar.utils.tsx | 2 +- apps/studio/next.config.js | 7 ++++- .../query-performance.tsx | 4 +-- packages/shared-data/extensions.json | 4 +-- 11 files changed, 38 insertions(+), 30 deletions(-) rename apps/studio/pages/project/[ref]/{database => advisors}/query-performance.tsx (94%) diff --git a/apps/docs/content/guides/database/extensions/index_advisor.mdx b/apps/docs/content/guides/database/extensions/index_advisor.mdx index a1cf0d29d5..82ab1d1df9 100644 --- a/apps/docs/content/guides/database/extensions/index_advisor.mdx +++ b/apps/docs/content/guides/database/extensions/index_advisor.mdx @@ -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) diff --git a/apps/docs/content/guides/database/postgres/indexes.mdx b/apps/docs/content/guides/database/postgres/indexes.mdx index 9796f95273..c8d96b6cbb 100644 --- a/apps/docs/content/guides/database/postgres/indexes.mdx +++ b/apps/docs/content/guides/database/postgres/indexes.mdx @@ -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. diff --git a/apps/docs/content/guides/database/postgres/timeouts.mdx b/apps/docs/content/guides/database/postgres/timeouts.mdx index 1b41032cbd..8a735c9d7c 100644 --- a/apps/docs/content/guides/database/postgres/timeouts.mdx +++ b/apps/docs/content/guides/database/postgres/timeouts.mdx @@ -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 diff --git a/apps/docs/content/guides/database/prisma.mdx b/apps/docs/content/guides/database/prisma.mdx index 9d721a2211..af9727e9df 100644 --- a/apps/docs/content/guides/database/prisma.mdx +++ b/apps/docs/content/guides/database/prisma.mdx @@ -17,8 +17,8 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t - - 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). For security, consider using a [password generator](https://bitwarden.com/password-generator/) for the Prisma role. diff --git a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.ts b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.ts index 7fa4578140..b2a1073bb9 100644 --- a/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.ts +++ b/apps/studio/components/layouts/AdvisorsLayout/AdvisorsMenu.utils.ts @@ -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: [], + }, ], }, ] diff --git a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx index a8c31f291e..82594b1765 100644 --- a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx +++ b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx @@ -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, })} /> diff --git a/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx b/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx index ec80389df0..c80e7e5b63 100644 --- a/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx +++ b/apps/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.tsx @@ -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: , items: [], }, + { + name: 'Query Performance', + key: 'query-performance', + url: `/project/${ref}/advisors/query-performance`, + rightIcon: , + items: [], + }, ], }, ] diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx index 8b807064bc..3b92106f0d 100644 --- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx +++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx @@ -62,7 +62,7 @@ export const generateProductRoutes = ( (isProjectBuilding ? buildingUrl : isProjectActive - ? `/project/${ref}/database/tables` + ? `/project/${ref}/database/schemas` : `/project/${ref}/database/backups/scheduled`), }, ...(authEnabled diff --git a/apps/studio/next.config.js b/apps/studio/next.config.js index cd9c8737ef..75b2130114 100644 --- a/apps/studio/next.config.js +++ b/apps/studio/next.config.js @@ -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, diff --git a/apps/studio/pages/project/[ref]/database/query-performance.tsx b/apps/studio/pages/project/[ref]/advisors/query-performance.tsx similarity index 94% rename from apps/studio/pages/project/[ref]/database/query-performance.tsx rename to apps/studio/pages/project/[ref]/advisors/query-performance.tsx index 9264683fce..6ec244ce9b 100644 --- a/apps/studio/pages/project/[ref]/database/query-performance.tsx +++ b/apps/studio/pages/project/[ref]/advisors/query-performance.tsx @@ -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) => ( - {page} + {page} ) export default QueryPerformanceReport diff --git a/packages/shared-data/extensions.json b/packages/shared-data/extensions.json index 5820134741..d9aaf5bde8 100644 --- a/packages/shared-data/extensions.json +++ b/packages/shared-data/extensions.json @@ -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",