The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[MUL-1347] fix(studio): hide Disk IO Burst Balance chart for HA projects (#49527)
Alaister Young0b37f0edc1f9
diff --git a/apps/studio/data/reports/database-charts.test.ts b/apps/studio/data/reports/database-charts.test.tsnew file mode 100644index 00000000000..242259bfc00--- /dev/null+++ b/apps/studio/data/reports/database-charts.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from 'vitest'++import { getReportAttributesV2 } from './database-charts'+import { Project } from '@/data/projects/project-detail-query'++const buildProject = (overrides: Partial<Project> = {}) =>+ ({+ infra_compute_size: 'micro',+ high_availability: false,+ ...overrides,+ }) as Project++const getBurstBalanceChart = (project: Project, showDiskIOBurstBalanceChart = true) =>+ getReportAttributesV2(+ [],+ project,+ undefined,+ undefined,+ undefined,+ false,+ showDiskIOBurstBalanceChart+ ).find((chart) => chart.id === 'disk-io-burst-balance')++describe('getReportAttributesV2 disk-io-burst-balance chart', () => {+ it('shows the chart for burstable non high availability projects', () => {+ expect(getBurstBalanceChart(buildProject())?.hide).toBe(false)+ })++ it('hides the chart for high availability projects', () => {+ expect(getBurstBalanceChart(buildProject({ high_availability: true }))?.hide).toBe(true)+ })++ it('hides the chart when the feature flag is off', () => {+ expect(getBurstBalanceChart(buildProject(), false)?.hide).toBe(true)+ })++ it('hides the chart for non burstable compute sizes', () => {+ expect(getBurstBalanceChart(buildProject({ infra_compute_size: '16xlarge' }))?.hide).toBe(true)+ })+})diff --git a/apps/studio/data/reports/database-charts.ts b/apps/studio/data/reports/database-charts.tsindex fff4b328a18..8b12d95e849 100644--- a/apps/studio/data/reports/database-charts.ts+++ b/apps/studio/data/reports/database-charts.ts@@ -9,6 +9,7 @@ import { ReportAttributes } from '@/components/ui/Charts/ComposedChart.utils'import { DiskAttributesData } from '@/data/config/disk-attributes-query'import { MaxConnectionsData } from '@/data/database/max-connections-query'import { Project } from '@/data/projects/project-detail-query'+import { resolveHighAvailability } from '@/hooks/misc/useHighAvailability.constants'import { DOCS_URL } from '@/lib/constants'import { formatBytes, formatBytesMinMB } from '@/lib/helpers'@@ -38,8 +39,12 @@ export const getReportAttributesV2: (typeof provisionedDiskIops === 'number' && typeof computeIopsLimit === 'number'? Math.min(provisionedDiskIops, computeIopsLimit): provisionedDiskIops+ // High Availability projects run on volumes without a burst credit pool, so the+ // Disk IO Burst Balance chart has no data to show for them.const showBurstBalanceChart =- !!showDiskIOBurstBalanceChart && hasBurstableIO(project?.infra_compute_size)+ !!showDiskIOBurstBalanceChart &&+ hasBurstableIO(project?.infra_compute_size) &&+ !resolveHighAvailability(project)const baselineThroughputMBps = COMPUTE_DISK[computeVariantId]?.baselineThroughputMBpsconst baselineThroughputLabel =typeof baselineThroughputMBps === 'number' ? `${baselineThroughputMBps} MB/s` : 'its baseline'