override feature flag for FLY (#30578)

This commit is contained in:
Jonathan Summers-Muir authored and GitHub committed 2024-11-21 11:49:50 +08:00
1 parent acfbc8a5e5
commit 5cd436a16f
2 files changed
+11 -4

No files matched your search

@@ -1,9 +1,9 @@
import { ArrowUpRight } from 'lucide-react'
import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import type { Project } from 'data/projects/project-detail-query'
import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
import type { Organization } from 'types'
import { ArrowUpRight } from 'lucide-react'
import { useFlag } from 'hooks/ui/useFlag'
export const generateSettingsMenu = (
ref?: string,
@@ -27,6 +27,7 @@ export const generateSettingsMenu = (
const storageEnabled = features?.storage ?? true
const warehouseEnabled = features?.warehouse ?? false
const logDrainsEnabled = features?.logDrains ?? false
const newDiskComputeEnabled = features?.diskAndCompute ?? false
return [
{
@@ -38,7 +39,7 @@ export const generateSettingsMenu = (
url: `/project/${ref}/settings/general`,
items: [],
},
...(IS_PLATFORM && features?.diskAndCompute
...(IS_PLATFORM && newDiskComputeEnabled
? [
{
name: 'Compute and Disk',
+7 -1
View File
@@ -1,10 +1,16 @@
import { useContext } from 'react'
import FlagContext from 'components/ui/Flag/FlagContext'
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
export function useFlag<T = boolean>(name: string) {
const project = useSelectedProject()
const store: any = useContext(FlagContext)
// Temporary override as Fly projects are cant seem to upgrade their compute with the new disk UI
if (name === 'diskAndComputeForm' && project?.cloud_provider === 'FLY') {
return false
}
const isObjectEmpty = (objectName: Object) => {
return Object.keys(objectName).length === 0
}