noData.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import {useRef} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import {Button} from 'sentry/components/button';
  4. import useFeedbackWidget from 'sentry/components/feedback/widget/useFeedbackWidget';
  5. import {IconGroup} from 'sentry/icons';
  6. import {t, tct} from 'sentry/locale';
  7. import {TraceDrawerComponents} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/styles';
  8. import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails';
  9. import {
  10. makeTraceNodeBarColor,
  11. type NoDataNode,
  12. } from 'sentry/views/performance/newTraceDetails/traceTree';
  13. import {Row} from 'sentry/views/performance/traceDetails/styles';
  14. export function NoDataDetails(props: TraceTreeNodeDetailsProps<NoDataNode>) {
  15. const theme = useTheme();
  16. return (
  17. <TraceDrawerComponents.DetailContainer>
  18. <TraceDrawerComponents.HeaderContainer>
  19. <TraceDrawerComponents.IconTitleWrapper>
  20. <TraceDrawerComponents.IconBorder
  21. backgroundColor={makeTraceNodeBarColor(theme, props.node)}
  22. >
  23. <IconGroup />
  24. </TraceDrawerComponents.IconBorder>
  25. <div style={{fontWeight: 'bold'}}>{t('Empty')}</div>
  26. </TraceDrawerComponents.IconTitleWrapper>
  27. <TraceDrawerComponents.Actions>
  28. <Button size="xs" onClick={_e => props.scrollToNode(props.node)}>
  29. {t('Show in view')}
  30. </Button>
  31. </TraceDrawerComponents.Actions>
  32. </TraceDrawerComponents.HeaderContainer>
  33. <TraceDrawerComponents.Table className="table key-value">
  34. <tbody>
  35. <Row title={t('Data quality')}>
  36. {tct(
  37. 'The cause of missing data could be misconfiguration or lack of instrumentation. Send us [feedback] if you are having trouble figuring this out.',
  38. {feedback: <InlineFeedbackLink />}
  39. )}
  40. </Row>
  41. </tbody>
  42. </TraceDrawerComponents.Table>
  43. </TraceDrawerComponents.DetailContainer>
  44. );
  45. }
  46. function InlineFeedbackLink() {
  47. const linkref = useRef<HTMLAnchorElement>(null);
  48. const feedback = useFeedbackWidget({buttonRef: linkref});
  49. return feedback ? (
  50. <a href="#" ref={linkref}>
  51. {t('feedback')}
  52. </a>
  53. ) : (
  54. <a href="mailto:support@sentry.io?subject=Trace%20does%20not%20contain%20data">
  55. {t('feedback')}
  56. </a>
  57. );
  58. }