The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: move typings around, remove unused imports, improve type safety
TzeYiing1f55321a4dd8
diff --git a/studio/components/interfaces/Home/ChartData.types.ts b/studio/components/interfaces/Home/ChartData.types.tsindex 52e728baccc..14ab6fbb637 100644--- a/studio/components/interfaces/Home/ChartData.types.ts+++ b/studio/components/interfaces/Home/ChartData.types.ts@@ -1,16 +1,4 @@-export interface StatusCodesDatum {- timestamp: number- status_code: number- count: number-}-export interface PathsDatum {- timestamp: number- path: string- query_params: string- count: number- method: string- avg_origin_time: number-}+export interface EndpointResponse<T> {result: Array<T>diff --git a/studio/components/interfaces/Home/ProjectUsage.tsx b/studio/components/interfaces/Home/ProjectUsage.tsxindex 89ca4e7f65f..0f01960d267 100644--- a/studio/components/interfaces/Home/ProjectUsage.tsx+++ b/studio/components/interfaces/Home/ProjectUsage.tsx@@ -10,11 +10,7 @@ import {} from '@supabase/ui'import ChartHandler from 'components/to-be-cleaned/Charts/ChartHandler'import Panel from 'components/ui/Panel'-import Table from 'components/to-be-cleaned/Table'-import { USAGE_COLORS } from 'components/ui/Charts/Charts.constants'-import StackedAreaChart from 'components/ui/Charts/StackedAreaChart'import dayjs from 'dayjs'-import { useFlag } from 'hooks'import { get } from 'lib/common/fetch'import { API_URL, DATE_FORMAT, METRICS } from 'lib/constants'import Link from 'next/link'diff --git a/studio/components/interfaces/Reports/ReportWidget.tsx b/studio/components/interfaces/Reports/ReportWidget.tsxindex 500fe1108e1..8dea9510a38 100644--- a/studio/components/interfaces/Reports/ReportWidget.tsx+++ b/studio/components/interfaces/Reports/ReportWidget.tsx@@ -7,8 +7,8 @@ import Panel from 'components/ui/Panel'import { useRouter } from 'next/router'import { LogsEndpointParams } from '../Settings/Logs'-export interface ReportWidgetProps {- data: any[]+export interface ReportWidgetProps<T = any> {+ data: T[]title: stringdescription: stringclassName?: stringdiff --git a/studio/components/interfaces/Reports/Reports.types.ts b/studio/components/interfaces/Reports/Reports.types.tsindex 8d6efa7627e..70d14852f8d 100644--- a/studio/components/interfaces/Reports/Reports.types.ts+++ b/studio/components/interfaces/Reports/Reports.types.ts@@ -1,3 +1,17 @@export enum Presets {- OVERVIEW = "overview"-}\ No newline at end of file+ OVERVIEW = 'overview',+}+export interface StatusCodesDatum {+ timestamp: number+ status_code: number+ count: number+}+export interface PathsDatum {+ timestamp: number+ path: string+ query_params: string+ count: number+ sum: number+ method: string+ avg_origin_time: number+}diff --git a/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx b/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsxindex a372812711f..dcd67dfa377 100644--- a/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx+++ b/studio/components/interfaces/Reports/renderers/OverviewRenderers.tsx@@ -4,10 +4,11 @@ import Table from 'components/to-be-cleaned/Table'import { USAGE_COLORS } from 'components/ui/Charts/Charts.constants'import StackedAreaChart from 'components/ui/Charts/StackedAreaChart'import { DATETIME_FORMAT } from '../Reports.constants'+import { PathsDatum, StatusCodesDatum } from '../Reports.types'import { queryParamsToObject } from '../Reports.utils'import { ReportWidgetProps } from '../ReportWidget'-export const renderStatusCodesChart = (props: ReportWidgetProps) => (+export const renderStatusCodesChart = (props: ReportWidgetProps<StatusCodesDatum>) => (<StackedAreaChartdateFormat={DATETIME_FORMAT}data={props.data}@@ -28,7 +29,7 @@ export const renderStatusCodesChart = (props: ReportWidgetProps) => (/>)-export const renderRequestsPathsTable = (props: ReportWidgetProps) => {+export const renderRequestsPathsTable = (props: ReportWidgetProps<PathsDatum>) => {const requestPathsSums = props.data.map((v) => v.sum) as number[]const requestPathsSumMax = Math.max(...requestPathsSums)const requestPathsSumMin = Math.min(...requestPathsSums)