mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
* init * hovercard * adds button to install index advisor * hover card now now insert indexes * update * moved hook * align alert dialog to design syste, * Update index-advisor.utils.ts * shows all index statements now * Update query-performance.tsx * Some refactors * Clean up * Fix * One last nit refactor --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
19 lines
826 B
TypeScript
19 lines
826 B
TypeScript
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
|
import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'
|
|
import { getIndexAdvisorExtensions } from 'components/interfaces/QueryPerformance/index-advisor.utils'
|
|
|
|
/**
|
|
* Hook to check if index advisor functionality is available
|
|
* @returns boolean indicating if index advisor is available
|
|
*/
|
|
export function useIsIndexAdvisorAvailable(): boolean {
|
|
const { project } = useProjectContext()
|
|
const { data: extensions } = useDatabaseExtensionsQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
|
|
const { hypopg, indexAdvisor } = getIndexAdvisorExtensions(extensions ?? [])
|
|
return hypopg?.installed_version !== null && indexAdvisor?.installed_version !== null
|
|
}
|