content.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. import {Fragment, useCallback, useMemo, useState} from 'react';
  2. import {useTheme} from '@emotion/react';
  3. import styled from '@emotion/styled';
  4. import debounce from 'lodash/debounce';
  5. import omit from 'lodash/omit';
  6. import moment from 'moment-timezone';
  7. import {Alert} from 'sentry/components/alert';
  8. import {Button} from 'sentry/components/button';
  9. import Count from 'sentry/components/count';
  10. import EmptyStateWarning, {EmptyStreamWrapper} from 'sentry/components/emptyStateWarning';
  11. import * as Layout from 'sentry/components/layouts/thirds';
  12. import ExternalLink from 'sentry/components/links/externalLink';
  13. import LoadingIndicator from 'sentry/components/loadingIndicator';
  14. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  15. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  16. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  17. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  18. import Panel from 'sentry/components/panels/panel';
  19. import PanelHeader from 'sentry/components/panels/panelHeader';
  20. import PanelItem from 'sentry/components/panels/panelItem';
  21. import PerformanceDuration from 'sentry/components/performanceDuration';
  22. import {IconChevron} from 'sentry/icons/iconChevron';
  23. import {IconClose} from 'sentry/icons/iconClose';
  24. import {IconWarning} from 'sentry/icons/iconWarning';
  25. import {t, tct} from 'sentry/locale';
  26. import {space} from 'sentry/styles/space';
  27. import type {MetricAggregation, MRI} from 'sentry/types/metrics';
  28. import type {Organization} from 'sentry/types/organization';
  29. import {defined} from 'sentry/utils';
  30. import {trackAnalytics} from 'sentry/utils/analytics';
  31. import {browserHistory} from 'sentry/utils/browserHistory';
  32. import {getUtcDateString} from 'sentry/utils/dates';
  33. import {getFormattedMQL} from 'sentry/utils/metrics';
  34. import {decodeInteger, decodeList} from 'sentry/utils/queryString';
  35. import {useLocation} from 'sentry/utils/useLocation';
  36. import useOrganization from 'sentry/utils/useOrganization';
  37. import usePageFilters from 'sentry/utils/usePageFilters';
  38. import useProjects from 'sentry/utils/useProjects';
  39. import * as ModuleLayout from 'sentry/views/insights/common/components/moduleLayout';
  40. import {usePageParams} from './hooks/usePageParams';
  41. import type {TraceResult} from './hooks/useTraces';
  42. import {useTraces} from './hooks/useTraces';
  43. import type {SpanResult} from './hooks/useTraceSpans';
  44. import {useTraceSpans} from './hooks/useTraceSpans';
  45. import {type Field, FIELDS, SORTS} from './data';
  46. import {
  47. Description,
  48. ProjectBadgeWrapper,
  49. ProjectsRenderer,
  50. SpanBreakdownSliceRenderer,
  51. SpanDescriptionRenderer,
  52. SpanIdRenderer,
  53. SpanTimeRenderer,
  54. TraceBreakdownContainer,
  55. TraceBreakdownRenderer,
  56. TraceIdRenderer,
  57. TraceIssuesRenderer,
  58. } from './fieldRenderers';
  59. import {TracesChart} from './tracesChart';
  60. import {TracesSearchBar} from './tracesSearchBar';
  61. import {
  62. areQueriesEmpty,
  63. getSecondaryNameFromSpan,
  64. getStylingSliceName,
  65. normalizeTraces,
  66. } from './utils';
  67. const DEFAULT_PER_PAGE = 50;
  68. const SPAN_PROPS_DOCS_URL =
  69. 'https://docs.sentry.io/concepts/search/searchable-properties/spans/';
  70. const ONE_MINUTE = 60 * 1000; // in milliseconds
  71. export function Content() {
  72. const location = useLocation();
  73. const limit = useMemo(() => {
  74. return decodeInteger(location.query.perPage, DEFAULT_PER_PAGE);
  75. }, [location.query.perPage]);
  76. const {queries, metricsMax, metricsMin, metricsOp, metricsQuery, mri} =
  77. usePageParams(location);
  78. const hasMetric = metricsOp && mri;
  79. const removeMetric = useCallback(() => {
  80. browserHistory.push({
  81. ...location,
  82. query: omit(location.query, [
  83. 'mri',
  84. 'metricsOp',
  85. 'metricsQuery',
  86. 'metricsMax',
  87. 'metricsMin',
  88. ]),
  89. });
  90. }, [location]);
  91. const handleSearch = useCallback(
  92. (searchIndex: number, searchQuery: string) => {
  93. const newQueries = [...queries];
  94. if (newQueries.length === 0) {
  95. // In the odd case someone wants to add search bars before any query has been made, we add both the default one shown and a new one.
  96. newQueries[0] = '';
  97. }
  98. newQueries[searchIndex] = searchQuery;
  99. browserHistory.push({
  100. ...location,
  101. query: {
  102. ...location.query,
  103. cursor: undefined,
  104. query: typeof searchQuery === 'string' ? newQueries : queries,
  105. },
  106. });
  107. },
  108. [location, queries]
  109. );
  110. const handleClearSearch = useCallback(
  111. (searchIndex: number) => {
  112. const newQueries = [...queries];
  113. if (typeof newQueries[searchIndex] !== undefined) {
  114. delete newQueries[searchIndex];
  115. browserHistory.push({
  116. ...location,
  117. query: {
  118. ...location.query,
  119. cursor: undefined,
  120. query: newQueries,
  121. },
  122. });
  123. return true;
  124. }
  125. return false;
  126. },
  127. [location, queries]
  128. );
  129. const tracesQuery = useTraces({
  130. limit,
  131. query: queries,
  132. mri: hasMetric ? mri : undefined,
  133. metricsMax: hasMetric ? metricsMax : undefined,
  134. metricsMin: hasMetric ? metricsMin : undefined,
  135. metricsOp: hasMetric ? metricsOp : undefined,
  136. metricsQuery: hasMetric ? metricsQuery : undefined,
  137. });
  138. const isLoading = tracesQuery.isFetching;
  139. const isError = !isLoading && tracesQuery.isError;
  140. const isEmpty = !isLoading && !isError && (tracesQuery?.data?.data?.length ?? 0) === 0;
  141. const rawData = !isLoading && !isError ? tracesQuery?.data?.data : undefined;
  142. const data = normalizeTraces(rawData);
  143. return (
  144. <LayoutMain fullWidth>
  145. <PageFilterBar condensed>
  146. <ProjectPageFilter />
  147. <EnvironmentPageFilter />
  148. <DatePageFilter defaultPeriod="2h" />
  149. </PageFilterBar>
  150. {hasMetric && (
  151. <StyledAlert
  152. type="info"
  153. showIcon
  154. trailingItems={<StyledCloseButton onClick={removeMetric} />}
  155. >
  156. {tct('The metric query [metricQuery] is filtering the results below.', {
  157. metricQuery: (
  158. <strong>
  159. {getFormattedMQL({
  160. mri: mri as MRI,
  161. aggregation: metricsOp as MetricAggregation,
  162. query: metricsQuery,
  163. })}
  164. </strong>
  165. ),
  166. })}
  167. </StyledAlert>
  168. )}
  169. {isError && typeof tracesQuery.error?.responseJSON?.detail === 'string' ? (
  170. <StyledAlert type="error" showIcon>
  171. {tracesQuery.error?.responseJSON?.detail}
  172. </StyledAlert>
  173. ) : null}
  174. <TracesSearchBar
  175. queries={queries}
  176. handleSearch={handleSearch}
  177. handleClearSearch={handleClearSearch}
  178. />
  179. <ModuleLayout.Full>
  180. <TracesChart />
  181. </ModuleLayout.Full>
  182. <StyledPanel>
  183. <TracePanelContent>
  184. <StyledPanelHeader align="left" lightText>
  185. {t('Trace ID')}
  186. </StyledPanelHeader>
  187. <StyledPanelHeader align="left" lightText>
  188. {t('Trace Root')}
  189. </StyledPanelHeader>
  190. <StyledPanelHeader align="right" lightText>
  191. {areQueriesEmpty(queries) ? t('Total Spans') : t('Matching Spans')}
  192. </StyledPanelHeader>
  193. <StyledPanelHeader align="left" lightText>
  194. {t('Timeline')}
  195. </StyledPanelHeader>
  196. <StyledPanelHeader align="right" lightText>
  197. {t('Duration')}
  198. </StyledPanelHeader>
  199. <StyledPanelHeader align="right" lightText>
  200. {t('Timestamp')}
  201. </StyledPanelHeader>
  202. <StyledPanelHeader align="right" lightText>
  203. {t('Issues')}
  204. </StyledPanelHeader>
  205. {isLoading && (
  206. <StyledPanelItem span={7} overflow>
  207. <LoadingIndicator />
  208. </StyledPanelItem>
  209. )}
  210. {isError && ( // TODO: need an error state
  211. <StyledPanelItem span={7} overflow>
  212. <EmptyStreamWrapper>
  213. <IconWarning color="gray300" size="lg" />
  214. </EmptyStreamWrapper>
  215. </StyledPanelItem>
  216. )}
  217. {isEmpty && (
  218. <StyledPanelItem span={7} overflow>
  219. <EmptyStateWarning withIcon>
  220. <EmptyStateText size="fontSizeExtraLarge">
  221. {t('No trace results found')}
  222. </EmptyStateText>
  223. <EmptyStateText size="fontSizeMedium">
  224. {tct('Try adjusting your filters or refer to [docSearchProps].', {
  225. docSearchProps: (
  226. <ExternalLink href={SPAN_PROPS_DOCS_URL}>
  227. {t('docs for search properties')}
  228. </ExternalLink>
  229. ),
  230. })}
  231. </EmptyStateText>
  232. </EmptyStateWarning>
  233. </StyledPanelItem>
  234. )}
  235. {data?.map((trace, i) => (
  236. <TraceRow key={trace.trace} trace={trace} defaultExpanded={i === 0} />
  237. ))}
  238. </TracePanelContent>
  239. </StyledPanel>
  240. </LayoutMain>
  241. );
  242. }
  243. function TraceRow({defaultExpanded, trace}: {defaultExpanded; trace: TraceResult}) {
  244. const {selection} = usePageFilters();
  245. const {projects} = useProjects();
  246. const [expanded, setExpanded] = useState<boolean>(defaultExpanded);
  247. const [highlightedSliceName, _setHighlightedSliceName] = useState('');
  248. const location = useLocation();
  249. const organization = useOrganization();
  250. const queries = useMemo(() => {
  251. return decodeList(location.query.query);
  252. }, [location.query.query]);
  253. const setHighlightedSliceName = useMemo(
  254. () =>
  255. debounce(sliceName => _setHighlightedSliceName(sliceName), 100, {
  256. leading: true,
  257. }),
  258. [_setHighlightedSliceName]
  259. );
  260. const onClickExpand = useCallback(() => setExpanded(e => !e), [setExpanded]);
  261. const selectedProjects = useMemo(() => {
  262. const selectedProjectIds = new Set(
  263. selection.projects.map(project => project.toString())
  264. );
  265. return new Set(
  266. projects
  267. .filter(project => selectedProjectIds.has(project.id))
  268. .map(project => project.slug)
  269. );
  270. }, [projects, selection.projects]);
  271. const traceProjects = useMemo(() => {
  272. const seenProjects: Set<string> = new Set();
  273. const leadingProjects: string[] = [];
  274. const trailingProjects: string[] = [];
  275. for (let i = 0; i < trace.breakdowns.length; i++) {
  276. const project = trace.breakdowns[i].project;
  277. if (!defined(project) || seenProjects.has(project)) {
  278. continue;
  279. }
  280. seenProjects.add(project);
  281. // Priotize projects that are selected in the page filters
  282. if (selectedProjects.has(project)) {
  283. leadingProjects.push(project);
  284. } else {
  285. trailingProjects.push(project);
  286. }
  287. }
  288. return [...leadingProjects, ...trailingProjects];
  289. }, [selectedProjects, trace]);
  290. return (
  291. <Fragment>
  292. <StyledPanelItem align="center" center onClick={onClickExpand}>
  293. <Button
  294. icon={<IconChevron size="xs" direction={expanded ? 'down' : 'right'} />}
  295. aria-label={t('Toggle trace details')}
  296. aria-expanded={expanded}
  297. size="zero"
  298. borderless
  299. onClick={() =>
  300. trackAnalytics('trace_explorer.toggle_trace_details', {
  301. organization,
  302. expanded,
  303. })
  304. }
  305. />
  306. <TraceIdRenderer
  307. traceId={trace.trace}
  308. timestamp={trace.end}
  309. onClick={() =>
  310. trackAnalytics('trace_explorer.open_trace', {
  311. organization,
  312. })
  313. }
  314. location={location}
  315. />
  316. </StyledPanelItem>
  317. <StyledPanelItem align="left" overflow>
  318. <Description>
  319. <ProjectBadgeWrapper>
  320. <ProjectsRenderer
  321. projectSlugs={
  322. traceProjects.length > 0
  323. ? traceProjects
  324. : trace.project
  325. ? [trace.project]
  326. : []
  327. }
  328. />
  329. </ProjectBadgeWrapper>
  330. {trace.name ? (
  331. <WrappingText>{trace.name}</WrappingText>
  332. ) : (
  333. <EmptyValueContainer>{t('Missing Trace Root')}</EmptyValueContainer>
  334. )}
  335. </Description>
  336. </StyledPanelItem>
  337. <StyledPanelItem align="right">
  338. {areQueriesEmpty(queries) ? (
  339. <Count value={trace.numSpans} />
  340. ) : (
  341. tct('[numerator][space]of[space][denominator]', {
  342. numerator: <Count value={trace.matchingSpans} />,
  343. denominator: <Count value={trace.numSpans} />,
  344. space: <Fragment>&nbsp;</Fragment>,
  345. })
  346. )}
  347. </StyledPanelItem>
  348. <BreakdownPanelItem
  349. align="right"
  350. highlightedSliceName={highlightedSliceName}
  351. onMouseLeave={() => setHighlightedSliceName('')}
  352. >
  353. <TraceBreakdownRenderer
  354. trace={trace}
  355. setHighlightedSliceName={setHighlightedSliceName}
  356. />
  357. </BreakdownPanelItem>
  358. <StyledPanelItem align="right">
  359. <PerformanceDuration milliseconds={trace.duration} abbreviation />
  360. </StyledPanelItem>
  361. <StyledPanelItem align="right">
  362. <SpanTimeRenderer timestamp={trace.end} tooltipShowSeconds />
  363. </StyledPanelItem>
  364. <StyledPanelItem align="right">
  365. <TraceIssuesRenderer
  366. trace={trace}
  367. onClick={() =>
  368. trackAnalytics('trace_explorer.open_in_issues', {
  369. organization,
  370. })
  371. }
  372. />
  373. </StyledPanelItem>
  374. {expanded && (
  375. <SpanTable trace={trace} setHighlightedSliceName={setHighlightedSliceName} />
  376. )}
  377. </Fragment>
  378. );
  379. }
  380. function SpanTable({
  381. trace,
  382. setHighlightedSliceName,
  383. }: {
  384. setHighlightedSliceName: (sliceName: string) => void;
  385. trace: TraceResult;
  386. }) {
  387. const location = useLocation();
  388. const organization = useOrganization();
  389. const {queries, metricsMax, metricsMin, metricsOp, metricsQuery, mri} =
  390. usePageParams(location);
  391. const hasMetric = metricsOp && mri;
  392. const spansQuery = useTraceSpans({
  393. trace,
  394. fields: [
  395. ...FIELDS,
  396. ...SORTS.map(field =>
  397. field.startsWith('-') ? (field.substring(1) as Field) : (field as Field)
  398. ),
  399. ],
  400. datetime: {
  401. // give a 1 minute buffer on each side so that start != end
  402. start: getUtcDateString(moment(trace.start - ONE_MINUTE)),
  403. end: getUtcDateString(moment(trace.end + ONE_MINUTE)),
  404. period: null,
  405. utc: true,
  406. },
  407. limit: 10,
  408. query: queries,
  409. sort: SORTS,
  410. mri: hasMetric ? mri : undefined,
  411. metricsMax: hasMetric ? metricsMax : undefined,
  412. metricsMin: hasMetric ? metricsMin : undefined,
  413. metricsOp: hasMetric ? metricsOp : undefined,
  414. metricsQuery: hasMetric ? metricsQuery : undefined,
  415. });
  416. const isLoading = spansQuery.isFetching;
  417. const isError = !isLoading && spansQuery.isError;
  418. const hasData = !isLoading && !isError && (spansQuery?.data?.data?.length ?? 0) > 0;
  419. const spans = spansQuery.data?.data ?? [];
  420. return (
  421. <SpanTablePanelItem span={7} overflow>
  422. <StyledPanel>
  423. <SpanPanelContent>
  424. <StyledPanelHeader align="left" lightText>
  425. {t('Span ID')}
  426. </StyledPanelHeader>
  427. <StyledPanelHeader align="left" lightText>
  428. {t('Span Description')}
  429. </StyledPanelHeader>
  430. <StyledPanelHeader align="right" lightText />
  431. <StyledPanelHeader align="right" lightText>
  432. {t('Span Duration')}
  433. </StyledPanelHeader>
  434. <StyledPanelHeader align="right" lightText>
  435. {t('Timestamp')}
  436. </StyledPanelHeader>
  437. {isLoading && (
  438. <StyledPanelItem span={5} overflow>
  439. <LoadingIndicator />
  440. </StyledPanelItem>
  441. )}
  442. {isError && ( // TODO: need an error state
  443. <StyledPanelItem span={5} overflow>
  444. <EmptyStreamWrapper>
  445. <IconWarning color="gray300" size="lg" />
  446. </EmptyStreamWrapper>
  447. </StyledPanelItem>
  448. )}
  449. {spans.map(span => (
  450. <SpanRow
  451. organization={organization}
  452. key={span.id}
  453. span={span}
  454. trace={trace}
  455. setHighlightedSliceName={setHighlightedSliceName}
  456. />
  457. ))}
  458. {hasData && spans.length < trace.matchingSpans && (
  459. <MoreMatchingSpans span={5}>
  460. {tct('[more][space]more [matching]spans can be found in the trace.', {
  461. more: <Count value={trace.matchingSpans - spans.length} />,
  462. space: <Fragment>&nbsp;</Fragment>,
  463. matching: areQueriesEmpty(queries) ? '' : 'matching ',
  464. })}
  465. </MoreMatchingSpans>
  466. )}
  467. </SpanPanelContent>
  468. </StyledPanel>
  469. </SpanTablePanelItem>
  470. );
  471. }
  472. function SpanRow({
  473. organization,
  474. span,
  475. trace,
  476. setHighlightedSliceName,
  477. }: {
  478. organization: Organization;
  479. setHighlightedSliceName: (sliceName: string) => void;
  480. span: SpanResult<Field>;
  481. trace: TraceResult;
  482. }) {
  483. const theme = useTheme();
  484. return (
  485. <Fragment>
  486. <StyledSpanPanelItem align="right">
  487. <SpanIdRenderer
  488. projectSlug={span.project}
  489. transactionId={span['transaction.id']}
  490. spanId={span.id}
  491. traceId={trace.trace}
  492. timestamp={span.timestamp}
  493. onClick={() =>
  494. trackAnalytics('trace_explorer.open_trace_span', {
  495. organization,
  496. })
  497. }
  498. />
  499. </StyledSpanPanelItem>
  500. <StyledSpanPanelItem align="left" overflow>
  501. <SpanDescriptionRenderer span={span} />
  502. </StyledSpanPanelItem>
  503. <StyledSpanPanelItem align="right" onMouseLeave={() => setHighlightedSliceName('')}>
  504. <TraceBreakdownContainer>
  505. <SpanBreakdownSliceRenderer
  506. sliceName={span.project}
  507. sliceSecondaryName={getSecondaryNameFromSpan(span)}
  508. sliceStart={Math.ceil(span['precise.start_ts'] * 1000)}
  509. sliceEnd={Math.floor(span['precise.finish_ts'] * 1000)}
  510. trace={trace}
  511. theme={theme}
  512. onMouseEnter={() =>
  513. setHighlightedSliceName(
  514. getStylingSliceName(span.project, getSecondaryNameFromSpan(span)) ?? ''
  515. )
  516. }
  517. />
  518. </TraceBreakdownContainer>
  519. </StyledSpanPanelItem>
  520. <StyledSpanPanelItem align="right">
  521. <PerformanceDuration milliseconds={span['span.duration']} abbreviation />
  522. </StyledSpanPanelItem>
  523. <StyledSpanPanelItem align="right">
  524. <SpanTimeRenderer
  525. timestamp={span['precise.finish_ts'] * 1000}
  526. tooltipShowSeconds
  527. />
  528. </StyledSpanPanelItem>
  529. </Fragment>
  530. );
  531. }
  532. const LayoutMain = styled(Layout.Main)`
  533. display: flex;
  534. flex-direction: column;
  535. gap: ${space(2)};
  536. `;
  537. const StyledPanel = styled(Panel)`
  538. margin-bottom: 0px;
  539. `;
  540. const TracePanelContent = styled('div')`
  541. width: 100%;
  542. display: grid;
  543. grid-template-columns: 116px auto repeat(2, min-content) 85px 112px 66px;
  544. `;
  545. const SpanPanelContent = styled('div')`
  546. width: 100%;
  547. display: grid;
  548. grid-template-columns: 100px auto repeat(1, min-content) 160px 85px;
  549. `;
  550. const StyledPanelHeader = styled(PanelHeader)<{align: 'left' | 'right'}>`
  551. white-space: nowrap;
  552. justify-content: ${p => (p.align === 'left' ? 'flex-start' : 'flex-end')};
  553. `;
  554. const EmptyStateText = styled('div')<{size: 'fontSizeExtraLarge' | 'fontSizeMedium'}>`
  555. color: ${p => p.theme.gray300};
  556. font-size: ${p => p.theme[p.size]};
  557. padding-bottom: ${space(1)};
  558. `;
  559. const StyledPanelItem = styled(PanelItem)<{
  560. align?: 'left' | 'center' | 'right';
  561. overflow?: boolean;
  562. span?: number;
  563. }>`
  564. align-items: center;
  565. padding: ${space(1)} ${space(2)};
  566. ${p => (p.align === 'left' ? 'justify-content: flex-start;' : null)}
  567. ${p => (p.align === 'right' ? 'justify-content: flex-end;' : null)}
  568. ${p => (p.overflow ? p.theme.overflowEllipsis : null)};
  569. ${p =>
  570. p.align === 'center'
  571. ? `
  572. justify-content: space-around;`
  573. : p.align === 'left' || p.align === 'right'
  574. ? `text-align: ${p.align};`
  575. : undefined}
  576. ${p => p.span && `grid-column: auto / span ${p.span};`}
  577. white-space: nowrap;
  578. `;
  579. const MoreMatchingSpans = styled(StyledPanelItem)`
  580. color: ${p => p.theme.gray300};
  581. `;
  582. const WrappingText = styled('div')`
  583. width: 100%;
  584. ${p => p.theme.overflowEllipsis};
  585. `;
  586. const StyledSpanPanelItem = styled(StyledPanelItem)`
  587. &:nth-child(10n + 1),
  588. &:nth-child(10n + 2),
  589. &:nth-child(10n + 3),
  590. &:nth-child(10n + 4),
  591. &:nth-child(10n + 5) {
  592. background-color: ${p => p.theme.backgroundSecondary};
  593. }
  594. `;
  595. const SpanTablePanelItem = styled(StyledPanelItem)`
  596. background-color: ${p => p.theme.gray100};
  597. `;
  598. const BreakdownPanelItem = styled(StyledPanelItem)<{highlightedSliceName: string}>`
  599. ${p =>
  600. p.highlightedSliceName
  601. ? `--highlightedSlice-${p.highlightedSliceName}-opacity: 1.0;
  602. --highlightedSlice-${p.highlightedSliceName}-saturate: saturate(1.0) contrast(1.0);
  603. --highlightedSlice-${p.highlightedSliceName}-transform: translateY(0px);
  604. `
  605. : null}
  606. ${p =>
  607. p.highlightedSliceName
  608. ? `
  609. --defaultSlice-opacity: 1.0;
  610. --defaultSlice-saturate: saturate(0.7) contrast(0.9) brightness(1.2);
  611. --defaultSlice-transform: translateY(0px);
  612. `
  613. : `
  614. --defaultSlice-opacity: 1.0;
  615. --defaultSlice-saturate: saturate(1.0) contrast(1.0);
  616. --defaultSlice-transform: translateY(0px);
  617. `}
  618. `;
  619. const EmptyValueContainer = styled('span')`
  620. color: ${p => p.theme.gray300};
  621. `;
  622. const StyledAlert = styled(Alert)`
  623. margin-bottom: 0;
  624. `;
  625. const StyledCloseButton = styled(IconClose)`
  626. cursor: pointer;
  627. `;