chore(studio): remove dead code from reports utils

STATUS_CODE_COLORS was an exact unused duplicate of
REPORT_STATUS_CODE_COLORS, useEdgeFnIdToName had zero callers,
AUTH_ERROR_CODE_VALUES and createAuthReportConfig had zero callers
(auth.tsx calls the three report-config creators directly), and
extractDistinctValuesFromData/generateCategoryAttributes were never
wired up (transformCategoricalCountData is the one actually used).
This commit is contained in:
Jordi Enric committed 2026-08-05 12:38:57 +02:00
1 parent 93b9726a7e
commit ea25098e8e
2 files changed
-58

No files matched your search

@@ -156,32 +156,6 @@ export function transformStatusCodeData(data: any[], statusCodes: string[]) {
return Object.values(pivotedData)
}
/**
* Extract distinct string values for a given field from data rows
*/
export function extractDistinctValuesFromData(data: any[], field: string): string[] {
const values = new Set<string>()
data.forEach((item: any) => {
if (item[field] !== undefined && item[field] !== null) {
values.add(String(item[field]))
}
})
return Array.from(values).sort()
}
/**
* Generates chart attributes from a list of category values
*/
export function generateCategoryAttributes(
values: string[],
labelResolver?: (v: string) => string
) {
return values.map((v) => ({
attribute: v,
label: labelResolver ? labelResolver(v) : v,
}))
}
/**
* Pivot rows of { timestamp, [categoryField], count } into { timestamp, [category]: count }
*/
-32
View File
@@ -1,6 +1,5 @@
import { type ComparisonOperator } from '@/components/interfaces/Reports/v2/ReportsNumericFilter'
import { AnalyticsInterval } from '@/data/analytics/constants'
import { useEdgeFunctionsQuery } from '@/data/edge-functions/edge-functions-query'
import { executeAnalyticsSql } from '@/data/logs/execute-analytics-sql'
import { logsAllEndpointUrl } from '@/data/logs/logs-endpoint'
import { safeSql, type SafeLogSqlFragment } from '@/data/logs/safe-analytics-sql'
@@ -67,21 +66,6 @@ export const REPORT_STATUS_CODE_COLORS: { [key: string]: { light: string; dark:
default: { light: '#757575', dark: '#9E9E9E' },
}
export const useEdgeFnIdToName = ({ projectRef }: { projectRef: string }) => {
const { data: edgeFunctions, isPending: isLoading } = useEdgeFunctionsQuery({
projectRef,
})
function edgeFnIdToName(id: string) {
return edgeFunctions?.find((fn) => fn.id === id)?.name
}
return {
edgeFnIdToName,
isLoading,
}
}
export async function fetchLogs(
projectRef: string,
sql: SafeLogSqlFragment,
@@ -98,19 +82,3 @@ export async function fetchLogs(
method: 'get',
})
}
export const STATUS_CODE_COLORS: { [key: string]: { light: string; dark: string } } = {
'400': { light: '#FFD54F', dark: '#FFF176' },
'401': { light: '#FF8A65', dark: '#FFAB91' },
'403': { light: '#FFB74D', dark: '#FFCC80' },
'404': { light: '#90A4AE', dark: '#B0BEC5' },
'409': { light: '#BA68C8', dark: '#CE93D8' },
'410': { light: '#A1887F', dark: '#BCAAA4' },
'422': { light: '#FF9800', dark: '#FFB74D' },
'429': { light: '#E65100', dark: '#F57C00' },
'500': { light: '#B71C1C', dark: '#D32F2F' },
'502': { light: '#9575CD', dark: '#B39DDB' },
'503': { light: '#0097A7', dark: '#4DD0E1' },
'504': { light: '#C0CA33', dark: '#D4E157' },
default: { light: '#757575', dark: '#9E9E9E' },
}