useShowMultigresLogs.ts 886 B

123456789101112131415161718192021222324
  1. import { useFlag } from 'common'
  2. import { useIsHighAvailability } from './useSelectedProject'
  3. /**
  4. * Whether to surface the Multigres logs collection (sidebar, page, and Field
  5. * Reference source).
  6. *
  7. * Gated on both:
  8. * - the `multigresLogs` feature flag, so rollout is decoupled from HA status
  9. * and the feature ships dark until explicitly enabled, and
  10. * - the project's `high_availability` flag, since Multigres only runs on HA
  11. * projects.
  12. *
  13. * Note: `high_availability` is an existing product feature that predates
  14. * Multigres, so the flag is required to avoid showing a broken collection to
  15. * existing HA projects that don't have a `multigres_logs` table.
  16. */
  17. export const useShowMultigresLogs = () => {
  18. const multigresLogsEnabled = useFlag('multigresLogs')
  19. const isHighAvailability = useIsHighAvailability()
  20. return multigresLogsEnabled && isHighAvailability
  21. }