index.tsx 1.5 KB

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