mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-30 03:53:34 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import { IS_PLATFORM } from 'common'
|
|
import type { components } from 'data/api'
|
|
import { get, handleError } from 'data/fetchers'
|
|
import type { ResponseError, UseCustomQueryOptions } from 'types'
|
|
import { usageKeys } from './keys'
|
|
|
|
export type ResourceWarningsVariables = {
|
|
ref?: string
|
|
slug?: string
|
|
}
|
|
|
|
export async function getResourceWarnings(
|
|
variables?: ResourceWarningsVariables,
|
|
signal?: AbortSignal
|
|
) {
|
|
const { data, error } = await get(`/platform/projects-resource-warnings`, {
|
|
params: {
|
|
query: {
|
|
ref: variables?.ref,
|
|
slug: variables?.slug,
|
|
},
|
|
},
|
|
signal,
|
|
})
|
|
if (error) handleError(error)
|
|
|
|
return data
|
|
}
|
|
|
|
export type ResourceWarning = components['schemas']['ProjectResourceWarningsResponse']
|
|
export type ResourceWarningsData = Awaited<ReturnType<typeof getResourceWarnings>>
|
|
export type ResourceWarningsError = ResponseError
|
|
|
|
export const useResourceWarningsQuery = <TData = ResourceWarningsData>(
|
|
variables: ResourceWarningsVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<ResourceWarningsData, ResourceWarningsError, TData> = {}
|
|
) =>
|
|
useQuery<ResourceWarningsData, ResourceWarningsError, TData>({
|
|
queryKey: usageKeys.resourceWarnings(variables.slug, variables.ref),
|
|
queryFn: ({ signal }) => getResourceWarnings(variables, signal),
|
|
enabled:
|
|
IS_PLATFORM && enabled && (variables.ref !== undefined || variables.slug !== undefined),
|
|
staleTime: 1000 * 60 * 60,
|
|
...options,
|
|
})
|