Files
supabase/apps/studio/components/interfaces/DiskManagement/ui/DiskManagement.constants.tsx
Jonathan Summers-MuirandJoshen Lim 9f420962e1 Feat/compute and disk (#30068)
* inited. added disk config to a new page

* add instances

* move moar

* moved things around. billing badges updated. compute added

* tidy

* new components

* form now dynamically updating itself

* updated compute form. moved warning panels. added collapsible for advanced options

* review dialog now only showing what is relevant

* Update DiskManagementForm.tsx

* compute sizes now a reccomendation

* fix old form

* started adding flags

* removed unused code. fixed issue with IOPS price showing on smaller compute

* moar clearning

* IOPS logic wrong way round

* type fixes

* start adding better error handling

* TIDY

* moved everything to own file

* tidy

* fix hydration issue

* moved some components around

* clean up

* inline errors

* update form message

* Update DiskManagementForm.tsx

* error fields fixed. some formatting issues. nano added as an option

* fix constants

* add some plan restrictions

* moar

* units updated. labels updated

* Update DiskManagement.schema.ts

* fix a ton of type issues

* text udpates

* add panel to suggest switching to io2

* more notice board stuff

* number formatting. moved a file

* Update DiskManagementForm.tsx

* remove console logs

* upgrade comms. more type fixes

* add empty states for the old areas

* more links

* updated some label issues

* hide labels when chart is active

* Update DiskManagement.utils.ts

* Delete next-env.d.ts

* Update DiskManagementForm.tsx

* Update DiskManagement.schema.ts

* text updates

* Update DiskManagement.constants.tsx

* Update next-env.d.ts

* Update next-env.d.ts

* Small clean uop

* Clean up empty files

* Clean up spelling

* Clean up more

* Fix typo in file name

* Clean up import statements

* Update DiskManagementForm.tsx

* fix issues

* Update ProjectLayout.tsx

* Remove unused import

* Fix

* Address nit

* Update database.tsx

* remove supress toast

* Update DiskManagement.schema.ts

* Update database.tsx

* change upgrade comms

* Update DiskManagementPanelForm.tsx

* fixes

* fix button size on old form

* Update DiskManagementForm.tsx

* Update StorageTypeField.tsx

* update labels on compute

* dont show banner when infra is FLY

* update comms. hide disk config for FLY

* Fix TS

* Last round of clean upo

* fix message state

* fix message

* Fix TS

* Update DiskManagement.utils.ts

* fix errors

* Update BillingChangeBadge.tsx

* fixed some label issues

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-04 09:05:37 +00:00

143 lines
3.1 KiB
TypeScript

import { PlanType } from 'data/subscriptions/org-subscription-query'
// Disk Storage expands automatically when the database reaches 90% of the disk size
export const AUTOSCALING_THRESHOLD = 0.9
export enum DiskType {
GP3 = 'gp3',
IO2 = 'io2',
}
export const IOPS_RANGE = {
[DiskType.GP3]: { min: 3000, max: 16000 },
[DiskType.IO2]: { min: 100, max: 256000 },
}
export const THROUGHPUT_RANGE = {
[DiskType.GP3]: { min: 125, max: 1000 },
}
export const DISK_PRICING = {
[DiskType.GP3]: {
storage: 0.125, // per GB per month
iops: 0.024, // per IOPS per month, charged after 3000 IOPS
throughput: 0.095, // per MB/s per month, charged after 125 MB/s
},
[DiskType.IO2]: {
storage: 0.195, // per GB per month
iops: 0.119, // per IOPS per month
},
}
export const DISK_LIMITS = {
[DiskType.GP3]: {
minStorage: 1,
maxStorage: 16384,
minIops: 3000,
maxIops: 16000,
minThroughput: 125,
maxThroughput: 1000,
includedIops: 3000,
includedThroughput: 125,
},
[DiskType.IO2]: {
minStorage: 4,
maxStorage: 61440,
minIops: 100,
maxIops: 256000,
includedIops: 0,
includedThroughput: 0,
},
}
export const DISK_TYPE_LABELS = {
[DiskType.GP3]: 'General Purpose SSD (gp3)',
[DiskType.IO2]: 'Provisioned IOPS SSD (io2)',
}
interface PlanDetails {
includedDiskGB: { gp3: number; io2: number }
}
export const PLAN_DETAILS: Record<PlanType, PlanDetails> = {
free: { includedDiskGB: { gp3: 1, io2: 0 } },
pro: { includedDiskGB: { gp3: 8, io2: 0 } },
team: { includedDiskGB: { gp3: 8, io2: 0 } },
enterprise: { includedDiskGB: { gp3: 8, io2: 0 } },
}
export const COMPUTE_BASELINE_IOPS = {
ci_nano: 250,
ci_micro: 500,
ci_small: 1000,
ci_medium: 2000,
ci_large: 3600,
ci_xlarge: 6000,
ci_2xlarge: 12000,
ci_4xlarge: 20000,
ci_8xlarge: 40000,
ci_12xlarge: 50000,
ci_16xlarge: 80000,
}
export const COMPUTE_MAX_IOPS = {
ci_nano: 11800,
ci_micro: 11800,
ci_small: 11800,
ci_medium: 11800,
ci_large: 20000,
ci_xlarge: 20000,
ci_2xlarge: 20000,
ci_4xlarge: 20000,
ci_8xlarge: 40000,
ci_12xlarge: 50000,
ci_16xlarge: 80000,
}
export const COMPUTE_BASELINE_THROUGHPUT = {
ci_nano: 43,
ci_micro: 87,
ci_small: 174,
ci_medium: 347,
ci_large: 630,
ci_xlarge: 1188,
ci_2xlarge: 2375,
ci_4xlarge: 4750,
ci_8xlarge: 9500,
ci_12xlarge: 14250,
ci_16xlarge: 19000,
}
export const COMPUTE_MAX_THROUGHPUT = {
ci_nano: 2085,
ci_micro: 2085,
ci_small: 2085,
ci_medium: 2085,
ci_large: 4750,
ci_xlarge: 4750,
ci_2xlarge: 4750,
ci_4xlarge: 4750,
ci_8xlarge: 9500,
ci_12xlarge: 14250,
ci_16xlarge: 19000,
}
export const RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3 = ['ci_nano', 'ci_micro', 'ci_small', 'ci_medium']
export const RESTRICTED_COMPUTE_FOR_THROUGHPUT_ON_GP3 = [
'ci_nano',
'ci_micro',
'ci_small',
'ci_medium',
]
export const DISK_TYPE_OPTIONS = [
{
type: 'gp3',
name: 'General Purpose SSD',
description: 'Balance between price and performance',
},
{
type: 'io2',
name: 'High Performance SSD',
description: 'High performance for mission critical applications',
},
]