Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: add title to cache misses, add tooltip, adjust widget title

TzeYiing9938efd61a40
diff --git a/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx b/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx
index 0cc73886f19..5c2d72afc88 100644
--- a/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx
+++ b/studio/components/interfaces/Reports/renderers/StorageRenderers.tsx
@@ -11,6 +11,13 @@ export const CacheHitRateChartRenderer = (
miss_count: number
}>
) => {
+ props.data = [
+ {
+ timestamp: new Date().toISOString(),
+ hit_count: 123,
+ miss_count: 123,
+ },
+ ]
const stackedData = props.data.flatMap((datum) => [
{
timestamp: datum.timestamp,
@@ -44,40 +51,50 @@ export const TopCacheMissesRenderer = (
count: number
}>
) => {
+ props.data = [
+ {
+ path: '123',
+ search: '?123',
+ count: 123,
+ },
+ ]
if (props.data.length === 0) return null
const headerClasses = '!text-xs !py-2 p-0 font-bold !bg-scale-400'
const cellClasses = '!text-xs !py-2'
return (
- <Table
- head={
- <>
- <Table.th className={headerClasses}>Request</Table.th>
- <Table.th className={headerClasses + ' text-right'}>Count</Table.th>
- </>
- }
- body={
- <>
- {props.data.map((datum) => (
- <Fragment key={datum.path + (datum.search || '')}>
- <Table.tr className="p-0">
- <Table.td className={[cellClasses].join(' ')}>
- <div className=" truncate max-w-sm lg:max-w-lg">
- <TextFormatter className="text-scale-1100" value={datum.path} />
- <TextFormatter
- className="max-w-sm text-scale-900 truncate "
- value={decodeURIComponent(datum.search || '')}
- />
- </div>
- </Table.td>
- <Table.td className={[cellClasses, 'text-right align-top'].join(' ')}>
- {datum.count}
- </Table.td>
- </Table.tr>
- </Fragment>
- ))}
- </>
- }
- />
+ <>
+ <h4>Top Cache Misses</h4>
+ <Table
+ head={
+ <>
+ <Table.th className={headerClasses}>Request</Table.th>
+ <Table.th className={headerClasses + ' text-right'}>Count</Table.th>
+ </>
+ }
+ body={
+ <>
+ {props.data.map((datum) => (
+ <Fragment key={datum.path + (datum.search || '')}>
+ <Table.tr className="p-0">
+ <Table.td className={[cellClasses].join(' ')}>
+ <div className=" truncate max-w-sm lg:max-w-lg">
+ <TextFormatter className="text-scale-1100" value={datum.path} />
+ <TextFormatter
+ className="max-w-sm text-scale-900 truncate "
+ value={decodeURIComponent(datum.search || '')}
+ />
+ </div>
+ </Table.td>
+ <Table.td className={[cellClasses, 'text-right align-top'].join(' ')}>
+ {datum.count}
+ </Table.td>
+ </Table.tr>
+ </Fragment>
+ ))}
+ </>
+ }
+ />
+ </>
)
}
diff --git a/studio/pages/project/[ref]/reports/storage.tsx b/studio/pages/project/[ref]/reports/storage.tsx
index 80047336e38..fe49c1fe7e5 100644
--- a/studio/pages/project/[ref]/reports/storage.tsx
+++ b/studio/pages/project/[ref]/reports/storage.tsx
@@ -63,7 +63,8 @@ export const StorageReport: NextPageWithLayout = () => {
<ReportWidget
isLoading={report.isLoading}
params={report.params.cacheHitRate}
- title="Cache Hits"
+ title="Request Caching"
+ tooltip="The number of storage requests that are cached at the edge level. A higher number of hits is better."
data={report.data.cacheHitRate || []}
renderer={CacheHitRateChartRenderer}
append={TopCacheMissesRenderer}