index.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import {t} from 'sentry/locale';
  2. import type {Organization, TagCollection} from 'sentry/types';
  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[]) => void;
  14. organization: Organization;
  15. tags: TagCollection;
  16. widgetType: WidgetType;
  17. queryErrors?: Record<string, any>[];
  18. }
  19. export function YAxisStep({
  20. displayType,
  21. queryErrors,
  22. aggregates,
  23. onYAxisChange,
  24. tags,
  25. widgetType,
  26. }: Props) {
  27. return (
  28. <BuildStep
  29. title={
  30. displayType === DisplayType.BIG_NUMBER
  31. ? t('Choose what to plot')
  32. : t('Choose what to plot in the y-axis')
  33. }
  34. description={
  35. [DisplayType.AREA, DisplayType.BAR, DisplayType.LINE].includes(displayType)
  36. ? t(
  37. "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."
  38. )
  39. : t("This is the data you'd be visualizing in the display.")
  40. }
  41. >
  42. <YAxisSelector
  43. widgetType={widgetType}
  44. displayType={displayType}
  45. aggregates={aggregates}
  46. onChange={onYAxisChange}
  47. tags={tags}
  48. errors={queryErrors}
  49. />
  50. </BuildStep>
  51. );
  52. }