features.tsx 892 B

1234567891011121314151617181920212223242526
  1. import type {Organization} from 'sentry/types';
  2. import {Dataset} from 'sentry/views/alerts/rules/metric/types';
  3. export function hasDDMExperimentalFeature(organization: Organization) {
  4. return organization.features.includes('ddm-experimental');
  5. }
  6. export function hasDDMFeature(organization: Organization) {
  7. return organization.features.includes('ddm-ui');
  8. }
  9. /**
  10. * Returns the forceMetricsLayer query param for the alert
  11. * wrapped in an object so it can be spread into existing query params
  12. * @param organization current organization
  13. * @param alertDataset dataset of the alert
  14. */
  15. export function getForceMetricsLayerQueryExtras(
  16. organization: Organization,
  17. alertDataset: Dataset
  18. ): {forceMetricsLayer: 'true'} | Record<string, never> {
  19. return hasDDMExperimentalFeature(organization) &&
  20. alertDataset === Dataset.GENERIC_METRICS
  21. ? {forceMetricsLayer: 'true'}
  22. : {};
  23. }