flamegraphViewSelectMenu.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {Fragment} from 'react';
  2. import Button from 'sentry/components/button';
  3. import ButtonBar from 'sentry/components/buttonBar';
  4. import {t} from 'sentry/locale';
  5. import {FlamegraphPreferences} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/reducers/flamegraphPreferences';
  6. interface FlamegraphViewSelectMenuProps {
  7. onSortingChange: (sorting: FlamegraphViewSelectMenuProps['sorting']) => void;
  8. onViewChange: (view: FlamegraphViewSelectMenuProps['view']) => void;
  9. sorting: FlamegraphPreferences['sorting'];
  10. view: FlamegraphPreferences['view'];
  11. }
  12. function FlamegraphViewSelectMenu({
  13. view,
  14. onViewChange,
  15. sorting,
  16. onSortingChange,
  17. }: FlamegraphViewSelectMenuProps): React.ReactElement {
  18. return (
  19. <Fragment>
  20. <ButtonBar merged active={sorting}>
  21. <Button
  22. barId="call order"
  23. size="xs"
  24. onClick={() => onSortingChange('call order')}
  25. >
  26. {t('Call Order')}
  27. </Button>
  28. <Button
  29. barId="left heavy"
  30. size="xs"
  31. onClick={() => onSortingChange('left heavy')}
  32. >
  33. {t('Left Heavy')}
  34. </Button>
  35. </ButtonBar>
  36. <ButtonBar merged active={view}>
  37. <Button barId="bottom up" size="xs" onClick={() => onViewChange('bottom up')}>
  38. {t('Bottom Up')}
  39. </Button>
  40. <Button barId="top down" size="xs" onClick={() => onViewChange('top down')}>
  41. {t('Top Down')}
  42. </Button>
  43. </ButtonBar>
  44. </Fragment>
  45. );
  46. }
  47. export {FlamegraphViewSelectMenu};