resourceSidebar.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import omit from 'lodash/omit';
  2. import {PlatformIcon} from 'platformicons';
  3. import FileSize from 'sentry/components/fileSize';
  4. import useRouter from 'sentry/utils/useRouter';
  5. import {BrowserStarfishFields} from 'sentry/views/performance/browser/resources/utils/useResourceFilters';
  6. import DetailPanel from 'sentry/views/starfish/components/detailPanel';
  7. import {Block, BlockContainer} from 'sentry/views/starfish/views/spanSummaryPage/block';
  8. type Props = {
  9. description?: string;
  10. groupId?: string;
  11. };
  12. export function ResourceSidebar(props: Props) {
  13. const router = useRouter();
  14. const key = props.groupId;
  15. const description = props.description || props.groupId;
  16. return (
  17. <DetailPanel
  18. detailKey={key}
  19. onClose={() => {
  20. router.replace({
  21. pathname: router.location.pathname,
  22. query: omit(router.location.query, [BrowserStarfishFields.DESCRIPTION]),
  23. });
  24. }}
  25. >
  26. <PlatformIcon platform="javascript" />
  27. <h3>{description}</h3>
  28. <ResourceInfo />
  29. <div>Span samples, charts for duration overtime and size overtime</div>
  30. </DetailPanel>
  31. );
  32. }
  33. function ResourceInfo() {
  34. return (
  35. <BlockContainer>
  36. <Block title="Avg Duration" alignment="left">
  37. 20.00ms
  38. </Block>
  39. <Block title="Resource Size" alignment="left">
  40. <FileSize bytes={200} />
  41. </Block>
  42. </BlockContainer>
  43. );
  44. }