mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem A custom date range in a Storage report URL could show one window in the header and another in the charts. Refresh also left Database Size and several Auth charts showing cached results. ## Fix Use the selected window for all Storage report requests, run the Database Size query on refresh, and refresh Auth Usage, Errors and Latency alongside the shared API charts. ## How to test - Open Storage with a custom start and end time in the URL. Inspect the chart requests on load and after Refresh. Both sets should use those exact timestamps. - Refresh the Database report and check that the large objects query runs again. - Open Auth with a fixed range and press Shift+R. The Usage, Errors, Latency and API charts should request fresh data for the same range. Fixes [FE-5122](https://linear.app/supabase/issue/FE-5122).
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import type { LogsEndpointParams } from '@/components/interfaces/Settings/Logs/Logs.types'
|
|
import type { SafeLogSqlFragment } from '@/data/logs/safe-analytics-sql'
|
|
|
|
export type ApiReportRequestParams = Required<
|
|
Pick<LogsEndpointParams, 'iso_timestamp_start' | 'iso_timestamp_end'>
|
|
>
|
|
|
|
type SharedApiReportMetricParams<
|
|
FilterBy extends string,
|
|
QueryName extends string,
|
|
Filters extends readonly unknown[],
|
|
> = {
|
|
filterBy: FilterBy
|
|
queryName: QueryName
|
|
source: string
|
|
filters: Filters
|
|
start: string
|
|
end: string
|
|
projectRef: string
|
|
useOtel: boolean
|
|
}
|
|
|
|
export const reportKeys = {
|
|
charts: (projectRef: string | undefined) => ['projects', projectRef, 'report-v2'] as const,
|
|
apiMetric: (
|
|
projectRef: string | undefined,
|
|
queryName: string,
|
|
params: ApiReportRequestParams,
|
|
sql: SafeLogSqlFragment,
|
|
useOtel: boolean
|
|
) => ['projects', projectRef, 'api-report', queryName, params, sql, { otel: useOtel }] as const,
|
|
allSharedApi: ['shared-api-report'] as const,
|
|
sharedApiMetric: <
|
|
FilterBy extends string,
|
|
QueryName extends string,
|
|
Filters extends readonly unknown[],
|
|
>({
|
|
filterBy,
|
|
queryName,
|
|
source,
|
|
filters,
|
|
start,
|
|
end,
|
|
projectRef,
|
|
useOtel,
|
|
}: SharedApiReportMetricParams<FilterBy, QueryName, Filters>) =>
|
|
[
|
|
...reportKeys.allSharedApi,
|
|
filterBy,
|
|
queryName,
|
|
source,
|
|
filters,
|
|
start,
|
|
end,
|
|
projectRef,
|
|
{ otel: useOtel },
|
|
] as const,
|
|
}
|