index.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {useDataset} from 'sentry/views/explore/hooks/useDataset';
  2. import {useResultMode} from 'sentry/views/explore/hooks/useResultsMode';
  3. import {useSampleFields} from 'sentry/views/explore/hooks/useSampleFields';
  4. import {useSorts} from 'sentry/views/explore/hooks/useSorts';
  5. import {ToolbarDataset} from 'sentry/views/explore/toolbar/toolbarDataset';
  6. import {ToolbarGroupBy} from 'sentry/views/explore/toolbar/toolbarGroupBy';
  7. import {ToolbarLimitTo} from 'sentry/views/explore/toolbar/toolbarLimitTo';
  8. import {ToolbarResults} from 'sentry/views/explore/toolbar/toolbarResults';
  9. import {ToolbarSortBy} from 'sentry/views/explore/toolbar/toolbarSortBy';
  10. import {ToolbarVisualize} from 'sentry/views/explore/toolbar/toolbarVisualize';
  11. import {useVisualize} from '../hooks/useVisualize';
  12. type Extras = 'dataset toggle';
  13. interface ExploreToolbarProps {
  14. extras?: Extras[];
  15. }
  16. export function ExploreToolbar({extras}: ExploreToolbarProps) {
  17. const [dataset, setDataset] = useDataset();
  18. const [resultMode, setResultMode] = useResultMode();
  19. const [sampleFields] = useSampleFields();
  20. const [sorts, setSorts] = useSorts({fields: sampleFields});
  21. const [visualize, setVisualize] = useVisualize();
  22. return (
  23. <div>
  24. {extras?.includes('dataset toggle') && (
  25. <ToolbarDataset dataset={dataset} setDataset={setDataset} />
  26. )}
  27. <ToolbarResults resultMode={resultMode} setResultMode={setResultMode} />
  28. <ToolbarVisualize visualize={visualize} setVisualize={setVisualize} />
  29. <ToolbarSortBy fields={sampleFields} sorts={sorts} setSorts={setSorts} />
  30. <ToolbarLimitTo />
  31. <ToolbarGroupBy disabled />
  32. </div>
  33. );
  34. }