noData.tsx 2.2 KB

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