index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  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. type Extras = 'dataset toggle';
  12. interface ExploreToolbarProps {
  13. extras?: Extras[];
  14. }
  15. export function ExploreToolbar({extras}: ExploreToolbarProps) {
  16. const [dataset, setDataset] = useDataset();
  17. const [resultMode, setResultMode] = useResultMode();
  18. const [sampleFields] = useSampleFields();
  19. const [sorts, setSorts] = useSorts({fields: sampleFields});
  20. return (
  21. <div>
  22. {extras?.includes('dataset toggle') && (
  23. <ToolbarDataset dataset={dataset} setDataset={setDataset} />
  24. )}
  25. <ToolbarResults resultMode={resultMode} setResultMode={setResultMode} />
  26. <ToolbarVisualize />
  27. <ToolbarSortBy fields={sampleFields} sorts={sorts} setSorts={setSorts} />
  28. <ToolbarLimitTo />
  29. <ToolbarGroupBy disabled />
  30. </div>
  31. );
  32. }