index.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {t} from 'sentry/locale';
  2. import type {TagCollection} from 'sentry/types/group';
  3. import type {Organization} from 'sentry/types/organization';
  4. import type {QueryFieldValue} from 'sentry/utils/discover/fields';
  5. import type {WidgetType} from 'sentry/views/dashboards/types';
  6. import {DisplayType} from 'sentry/views/dashboards/types';
  7. import type {DataSet} from '../../utils';
  8. import {BuildStep} from '../buildStep';
  9. import {YAxisSelector} from './yAxisSelector';
  10. interface Props {
  11. aggregates: QueryFieldValue[];
  12. dataSet: DataSet;
  13. displayType: DisplayType;
  14. onYAxisChange: (newFields: QueryFieldValue[], newSelectedAggregate?: number) => void;
  15. organization: Organization;
  16. tags: TagCollection;
  17. widgetType: WidgetType;
  18. queryErrors?: Record<string, any>[];
  19. selectedAggregate?: number;
  20. }
  21. export function YAxisStep({
  22. displayType,
  23. queryErrors,
  24. aggregates,
  25. onYAxisChange,
  26. tags,
  27. widgetType,
  28. selectedAggregate,
  29. }: Props) {
  30. return (
  31. <BuildStep
  32. title={
  33. displayType === DisplayType.BIG_NUMBER
  34. ? t('Choose what to plot')
  35. : t('Choose what to plot in the y-axis')
  36. }
  37. description={
  38. [DisplayType.AREA, DisplayType.BAR, DisplayType.LINE].includes(displayType)
  39. ? t(
  40. "This is the data you'd be visualizing in the display. If the overlay units conflict, the charts will always base it off of the first line."
  41. )
  42. : t("This is the data you'd be visualizing in the display.")
  43. }
  44. >
  45. <YAxisSelector
  46. widgetType={widgetType}
  47. displayType={displayType}
  48. aggregates={aggregates}
  49. onChange={onYAxisChange}
  50. tags={tags}
  51. errors={queryErrors}
  52. selectedAggregate={selectedAggregate}
  53. />
  54. </BuildStep>
  55. );
  56. }