index.tsx 1.7 KB

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