mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
* Show unlock icon next to views and foreign tables * Temp header actions for all entities * Add warnings for views and foreign tables * Add labels for each entity type * Cleanup * Unneeded comma * Remove unneeded useEffect * Check lints on the entities menu too * Pass exposed schemas to lint query * Type cleanup * Update * Update lint, add 0016 * Fix materialized view logic * Cleanup * Grab lint count * Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx Co-authored-by: Inian <inian1234@gmail.com> * Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx Co-authored-by: Inian <inian1234@gmail.com> * Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx Co-authored-by: Inian <inian1234@gmail.com> * Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx Co-authored-by: Inian <inian1234@gmail.com> * Language changes * Use lints for gridheaderactions * Types cleanup --------- Co-authored-by: Inian <inian1234@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
23 lines
574 B
TypeScript
23 lines
574 B
TypeScript
import { Lint } from '../../../data/lint/lint-query'
|
|
|
|
export const checkEntityForLints = (
|
|
entityName: string,
|
|
lintName: string,
|
|
lintLevels: ('ERROR' | 'WARN')[],
|
|
lints: Lint[],
|
|
schema: string
|
|
): { hasLint: boolean; count: number } => {
|
|
const matchingLints = lints?.filter(
|
|
(lint) =>
|
|
lint?.metadata?.name === entityName &&
|
|
lint?.metadata?.schema === schema &&
|
|
lint?.name === lintName &&
|
|
lintLevels.includes(lint?.level as 'ERROR' | 'WARN')
|
|
)
|
|
|
|
return {
|
|
hasLint: matchingLints.length > 0,
|
|
count: matchingLints.length,
|
|
}
|
|
}
|