Skip to content

Commit

Permalink
override feature flag for FLY (#30578)
Browse files Browse the repository at this point in the history
  • Loading branch information
MildTomato authored Nov 21, 2024
1 parent acfbc8a commit 5cd436a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 [
{
Expand All @@ -38,7 +39,7 @@ export const generateSettingsMenu = (
url: `/project/${ref}/settings/general`,
items: [],
},
...(IS_PLATFORM && features?.diskAndCompute
...(IS_PLATFORM && newDiskComputeEnabled
? [
{
name: 'Compute and Disk',
Expand Down
8 changes: 7 additions & 1 deletion apps/studio/hooks/ui/useFlag.ts
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down

0 comments on commit 5cd436a

Please sign in to comment.