Files
supabase/apps/studio/components/interfaces/TableGridEditor/TableEntity.utils.ts
Terry Sutton 83679e3ddf Chore/move security advisor basics (#26669)
* Start

* Start

* Move advisors

* cleanup

* Add redirects

* Check for an id

* Cleanup

* Link to the advisor from the table editor

* Cleanup

* Link to rows in performance grid
2024-05-28 16:05:21 -02:30

25 lines
638 B
TypeScript

import { Lint } from '../../../data/lint/lint-query'
export const getEntityLintDetails = (
entityName: string,
lintName: string,
lintLevels: ('ERROR' | 'WARN')[],
lints: Lint[],
schema: string
): { hasLint: boolean; count: number; matchingLint: Lint | null } => {
const matchingLint =
lints?.find(
(lint) =>
lint?.metadata?.name === entityName &&
lint?.metadata?.schema === schema &&
lint?.name === lintName &&
lintLevels.includes(lint?.level as 'ERROR' | 'WARN')
) || null
return {
hasLint: matchingLint !== null,
count: matchingLint ? 1 : 0,
matchingLint,
}
}