mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Feature ## Summary - Add a `useProjectHealthLintsQuery` that runs the live health checks (database down, unreachable, connection limit, service error rate, infrastructure alerts) - Surface those results on the project home advisor row alongside security and performance errors - Register health lint metadata (titles, docs links, entity icon) so homepage cards can render them Bottom of the stack. The advisor sidebar still uses tabs; health items show under All until #49662. ## To test 1. Open any project home in Studio. 2. Find the Advisor row (the cards under “Advisor found N issues”). 3. If the project has a real health problem, you should see a **HEALTH** card (for example “Database process is down” or “Database connection limit reached”), not only SECURITY / PERFORMANCE. 4. If the project is healthy, you should **not** see a HEALTH card. Existing security and performance cards should still appear as before. 5. Click a HEALTH card (or any advisor card). Advisor Center should open on that item. 6. In Advisor Center on this PR, health items only show under the **All** tab — Health is not its own tab yet. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a Health category to Advisor, with a dedicated tab and activity icon. - Added health checks for database availability, connection limits, service errors, and infrastructure alerts. - Health issues now appear alongside security and performance recommendations with relevant troubleshooting links. - **Bug Fixes** - Health-related advisor findings are now correctly categorized and displayed. - **Tests** - Added coverage for health checks, categorization, filtering, and project health query behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { ReactNode } from 'react'
|
|
|
|
import { Lint } from '@/data/lint/lint-query'
|
|
import { SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'
|
|
|
|
export enum LINTER_LEVELS {
|
|
ERROR = 'ERROR',
|
|
WARN = 'WARN',
|
|
INFO = 'INFO',
|
|
}
|
|
|
|
export type LintInfo = {
|
|
name: string
|
|
title: string
|
|
icon: ReactNode
|
|
link: (args: { projectRef: string; metadata: Lint['metadata'] }) => string
|
|
linkText: string
|
|
docsLink: string
|
|
category: 'security' | 'performance' | 'health'
|
|
}
|
|
|
|
export const LINT_TABS: ReadonlyArray<{
|
|
id: LINTER_LEVELS
|
|
label: string
|
|
description: string
|
|
descriptionShort: string
|
|
shortcutId: ShortcutId
|
|
}> = [
|
|
{
|
|
id: LINTER_LEVELS.ERROR,
|
|
label: 'Errors',
|
|
description: 'You should consider these issues urgent and fix them as soon as you can.',
|
|
descriptionShort: 'Require immediate attention',
|
|
shortcutId: SHORTCUT_IDS.ADVISORS_TAB_ERRORS,
|
|
},
|
|
{
|
|
id: LINTER_LEVELS.WARN,
|
|
label: 'Warnings',
|
|
description: 'You should try and read through these issues and fix them if necessary.',
|
|
descriptionShort: 'To resolve only if necessary',
|
|
shortcutId: SHORTCUT_IDS.ADVISORS_TAB_WARNINGS,
|
|
},
|
|
{
|
|
id: LINTER_LEVELS.INFO,
|
|
label: 'Info',
|
|
description: 'You should read through these suggestions and consider implementing them.',
|
|
descriptionShort: 'For consideration to implement',
|
|
shortcutId: SHORTCUT_IDS.ADVISORS_TAB_INFO,
|
|
},
|
|
]
|