changedTransactions.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. import {Fragment, useCallback, useState} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {Location} from 'history';
  4. import type {Client} from 'sentry/api';
  5. import Feature from 'sentry/components/acl/feature';
  6. import {Button} from 'sentry/components/button';
  7. import {HeaderTitleLegend} from 'sentry/components/charts/styles';
  8. import Count from 'sentry/components/count';
  9. import DropdownLink from 'sentry/components/dropdownLink';
  10. import Duration from 'sentry/components/duration';
  11. import EmptyStateWarning from 'sentry/components/emptyStateWarning';
  12. import {RadioLineItem} from 'sentry/components/forms/controls/radioGroup';
  13. import IdBadge from 'sentry/components/idBadge';
  14. import Link from 'sentry/components/links/link';
  15. import LoadingIndicator from 'sentry/components/loadingIndicator';
  16. import MenuItem from 'sentry/components/menuItem';
  17. import type {CursorHandler} from 'sentry/components/pagination';
  18. import Pagination from 'sentry/components/pagination';
  19. import Panel from 'sentry/components/panels/panel';
  20. import QuestionTooltip from 'sentry/components/questionTooltip';
  21. import Radio from 'sentry/components/radio';
  22. import {Tooltip} from 'sentry/components/tooltip';
  23. import {IconArrow, IconEllipsis} from 'sentry/icons';
  24. import {t} from 'sentry/locale';
  25. import {space} from 'sentry/styles/space';
  26. import type {AvatarProject, Organization, Project} from 'sentry/types';
  27. import {trackAnalytics} from 'sentry/utils/analytics';
  28. import {browserHistory} from 'sentry/utils/browserHistory';
  29. import getDuration from 'sentry/utils/duration/getDuration';
  30. import {formatPercentage} from 'sentry/utils/number/formatPercentage';
  31. import {useMetricsCardinalityContext} from 'sentry/utils/performance/contexts/metricsCardinality';
  32. import TrendsDiscoverQuery from 'sentry/utils/performance/trends/trendsDiscoverQuery';
  33. import {decodeScalar} from 'sentry/utils/queryString';
  34. import {MutableSearch} from 'sentry/utils/tokenizeSearch';
  35. import useApi from 'sentry/utils/useApi';
  36. import withOrganization from 'sentry/utils/withOrganization';
  37. import withProjects from 'sentry/utils/withProjects';
  38. import {
  39. DisplayModes,
  40. transactionSummaryRouteWithQuery,
  41. } from 'sentry/views/performance/transactionSummary/utils';
  42. import {PerformanceChangeExplorer} from 'sentry/views/performance/trends/changeExplorer';
  43. import getSelectedQueryKey from 'sentry/views/performance/trends/utils/getSelectedQueryKey';
  44. import {getSelectedTransaction} from 'sentry/views/performance/utils/getSelectedTransaction';
  45. import Chart from './chart';
  46. import type {
  47. NormalizedTrendsTransaction,
  48. TrendFunctionField,
  49. TrendParameter,
  50. TrendParameterColumn,
  51. TrendsStats,
  52. TrendView,
  53. } from './types';
  54. import {TrendChangeType} from './types';
  55. import {
  56. getCurrentTrendFunction,
  57. getCurrentTrendParameter,
  58. getTrendProjectId,
  59. modifyTrendView,
  60. normalizeTrends,
  61. transformDeltaSpread,
  62. transformValueDelta,
  63. trendCursorNames,
  64. trendToColor,
  65. } from './utils';
  66. type Props = {
  67. location: Location;
  68. organization: Organization;
  69. projects: Project[];
  70. setError: (msg: string | undefined) => void;
  71. trendChangeType: TrendChangeType;
  72. trendView: TrendView;
  73. previousTrendColumn?: TrendParameterColumn;
  74. previousTrendFunction?: TrendFunctionField;
  75. withBreakpoint?: boolean;
  76. };
  77. type TrendsCursorQuery = {
  78. improvedCursor?: string;
  79. regressionCursor?: string;
  80. };
  81. const makeTrendsCursorHandler =
  82. (trendChangeType: TrendChangeType): CursorHandler =>
  83. (cursor, path, query) => {
  84. const cursorQuery = {} as TrendsCursorQuery;
  85. if (trendChangeType === TrendChangeType.IMPROVED) {
  86. cursorQuery.improvedCursor = cursor;
  87. } else if (trendChangeType === TrendChangeType.REGRESSION) {
  88. cursorQuery.regressionCursor = cursor;
  89. }
  90. const selectedQueryKey = getSelectedQueryKey(trendChangeType);
  91. delete query[selectedQueryKey];
  92. browserHistory.push({
  93. pathname: path,
  94. query: {...query, ...cursorQuery},
  95. });
  96. };
  97. function getChartTitle(trendChangeType: TrendChangeType): string {
  98. switch (trendChangeType) {
  99. case TrendChangeType.IMPROVED:
  100. return t('Most Improved Transactions');
  101. case TrendChangeType.REGRESSION:
  102. return t('Most Regressed Transactions');
  103. default:
  104. throw new Error('No trend type passed');
  105. }
  106. }
  107. function handleChangeSelected(
  108. location: Location,
  109. organization: Organization,
  110. trendChangeType: TrendChangeType
  111. ) {
  112. return function updateSelected(transaction?: NormalizedTrendsTransaction) {
  113. const selectedQueryKey = getSelectedQueryKey(trendChangeType);
  114. const query = {
  115. ...location.query,
  116. };
  117. if (!transaction) {
  118. delete query[selectedQueryKey];
  119. } else {
  120. query[selectedQueryKey] = transaction
  121. ? `${transaction.transaction}-${transaction.project}`
  122. : undefined;
  123. }
  124. browserHistory.push({
  125. pathname: location.pathname,
  126. query,
  127. });
  128. trackAnalytics('performance_views.trends.widget_interaction', {
  129. organization,
  130. widget_type: trendChangeType,
  131. });
  132. };
  133. }
  134. enum FilterSymbols {
  135. GREATER_THAN_EQUALS = '>=',
  136. LESS_THAN_EQUALS = '<=',
  137. }
  138. function handleFilterTransaction(location: Location, transaction: string) {
  139. const queryString = decodeScalar(location.query.query);
  140. const conditions = new MutableSearch(queryString ?? '');
  141. conditions.addFilterValues('!transaction', [transaction]);
  142. const query = conditions.formatString();
  143. browserHistory.push({
  144. pathname: location.pathname,
  145. query: {
  146. ...location.query,
  147. query: String(query).trim(),
  148. },
  149. });
  150. }
  151. function handleFilterDuration(
  152. location: Location,
  153. organization: Organization,
  154. value: number,
  155. symbol: FilterSymbols,
  156. trendChangeType: TrendChangeType,
  157. projects: Project[],
  158. projectIds: Readonly<number[]>
  159. ) {
  160. const durationTag = getCurrentTrendParameter(location, projects, projectIds).column;
  161. const queryString = decodeScalar(location.query.query);
  162. const conditions = new MutableSearch(queryString ?? '');
  163. const existingValues = conditions.getFilterValues(durationTag);
  164. const alternateSymbol = symbol === FilterSymbols.GREATER_THAN_EQUALS ? '>' : '<';
  165. if (existingValues) {
  166. existingValues.forEach(existingValue => {
  167. if (existingValue.startsWith(symbol) || existingValue.startsWith(alternateSymbol)) {
  168. conditions.removeFilterValue(durationTag, existingValue);
  169. }
  170. });
  171. }
  172. conditions.addFilterValues(durationTag, [`${symbol}${value}`]);
  173. const query = conditions.formatString();
  174. browserHistory.push({
  175. pathname: location.pathname,
  176. query: {
  177. ...location.query,
  178. query: String(query).trim(),
  179. },
  180. });
  181. trackAnalytics('performance_views.trends.change_duration', {
  182. organization,
  183. widget_type: getChartTitle(trendChangeType),
  184. value: `${symbol}${value}`,
  185. });
  186. }
  187. function ChangedTransactions(props: Props) {
  188. const {
  189. location,
  190. trendChangeType,
  191. previousTrendFunction,
  192. previousTrendColumn,
  193. organization,
  194. projects,
  195. setError,
  196. withBreakpoint,
  197. } = props;
  198. const api = useApi();
  199. const {isLoading: isCardinalityCheckLoading, outcome} = useMetricsCardinalityContext();
  200. const canUseMetricsTrends = withBreakpoint && !outcome?.forceTransactionsOnly;
  201. const trendView = props.trendView.clone();
  202. const chartTitle = getChartTitle(trendChangeType);
  203. modifyTrendView(trendView, location, trendChangeType, projects, canUseMetricsTrends);
  204. const onCursor = makeTrendsCursorHandler(trendChangeType);
  205. const cursor = decodeScalar(location.query[trendCursorNames[trendChangeType]]);
  206. const paginationAnalyticsEvent = (direction: string) => {
  207. trackAnalytics('performance_views.trends.widget_pagination', {
  208. organization,
  209. direction,
  210. widget_type: getChartTitle(trendChangeType),
  211. });
  212. };
  213. return (
  214. <TrendsDiscoverQuery
  215. eventView={trendView}
  216. orgSlug={organization.slug}
  217. location={location}
  218. trendChangeType={trendChangeType}
  219. cursor={cursor}
  220. limit={5}
  221. setError={error => setError(error?.message)}
  222. withBreakpoint={canUseMetricsTrends}
  223. >
  224. {({isLoading, trendsData, pageLinks}) => {
  225. const trendFunction = getCurrentTrendFunction(location);
  226. const trendParameter = getCurrentTrendParameter(
  227. location,
  228. projects,
  229. trendView.project
  230. );
  231. const events = normalizeTrends(trendsData?.events?.data || []);
  232. const selectedTransaction = getSelectedTransaction(
  233. location,
  234. trendChangeType,
  235. events
  236. );
  237. const statsData = trendsData?.stats || {};
  238. const transactionsList = events?.slice ? events.slice(0, 5) : [];
  239. const currentTrendFunction =
  240. isLoading && previousTrendFunction
  241. ? previousTrendFunction
  242. : trendFunction.field;
  243. const currentTrendColumn =
  244. isLoading && previousTrendColumn ? previousTrendColumn : trendParameter.column;
  245. const titleTooltipContent = t(
  246. 'This compares the baseline (%s) of the past with the present.',
  247. trendFunction.legendLabel
  248. );
  249. return (
  250. <TransactionsListContainer data-test-id="changed-transactions">
  251. <TrendsTransactionPanel>
  252. <StyledHeaderTitleLegend>
  253. {chartTitle}
  254. <QuestionTooltip size="sm" position="top" title={titleTooltipContent} />
  255. </StyledHeaderTitleLegend>
  256. {isLoading || isCardinalityCheckLoading ? (
  257. <LoadingIndicator
  258. style={{
  259. margin: '237px auto',
  260. }}
  261. />
  262. ) : (
  263. <Fragment>
  264. {transactionsList.length ? (
  265. <Fragment>
  266. <ChartContainer>
  267. <Chart
  268. statsData={statsData}
  269. query={trendView.query}
  270. project={trendView.project}
  271. environment={trendView.environment}
  272. start={trendView.start}
  273. end={trendView.end}
  274. statsPeriod={trendView.statsPeriod}
  275. transaction={selectedTransaction}
  276. isLoading={isLoading}
  277. {...props}
  278. />
  279. </ChartContainer>
  280. {transactionsList.map((transaction, index) => (
  281. <TrendsListItem
  282. api={api}
  283. currentTrendFunction={currentTrendFunction}
  284. currentTrendColumn={currentTrendColumn}
  285. trendView={trendView}
  286. organization={organization}
  287. transaction={transaction}
  288. key={transaction.transaction}
  289. index={index}
  290. trendChangeType={trendChangeType}
  291. transactions={transactionsList}
  292. location={location}
  293. projects={projects}
  294. statsData={statsData}
  295. handleSelectTransaction={handleChangeSelected(
  296. location,
  297. organization,
  298. trendChangeType
  299. )}
  300. isLoading={isLoading}
  301. trendParameter={trendParameter}
  302. />
  303. ))}
  304. </Fragment>
  305. ) : (
  306. <StyledEmptyStateWarning small>
  307. {t('No results')}
  308. </StyledEmptyStateWarning>
  309. )}
  310. </Fragment>
  311. )}
  312. </TrendsTransactionPanel>
  313. <Pagination
  314. pageLinks={pageLinks}
  315. onCursor={onCursor}
  316. paginationAnalyticsEvent={paginationAnalyticsEvent}
  317. />
  318. </TransactionsListContainer>
  319. );
  320. }}
  321. </TrendsDiscoverQuery>
  322. );
  323. }
  324. type TrendsListItemProps = {
  325. api: Client;
  326. currentTrendColumn: string;
  327. currentTrendFunction: string;
  328. handleSelectTransaction: (transaction: NormalizedTrendsTransaction) => void;
  329. index: number;
  330. isLoading: boolean;
  331. location: Location;
  332. organization: Organization;
  333. projects: Project[];
  334. statsData: TrendsStats;
  335. transaction: NormalizedTrendsTransaction;
  336. transactions: NormalizedTrendsTransaction[];
  337. trendChangeType: TrendChangeType;
  338. trendParameter: TrendParameter;
  339. trendView: TrendView;
  340. };
  341. function TrendsListItem(props: TrendsListItemProps) {
  342. const {
  343. transaction,
  344. transactions,
  345. trendChangeType,
  346. currentTrendFunction,
  347. currentTrendColumn,
  348. index,
  349. location,
  350. organization,
  351. projects,
  352. handleSelectTransaction,
  353. trendView,
  354. statsData,
  355. isLoading,
  356. trendParameter,
  357. } = props;
  358. const color = trendToColor[trendChangeType].default;
  359. const [openedTransaction, setOpenedTransaction] = useState<null | string>(null);
  360. const selectedTransaction = getSelectedTransaction(
  361. location,
  362. trendChangeType,
  363. transactions
  364. );
  365. const isSelected = selectedTransaction === transaction;
  366. const project = projects.find(
  367. ({slug}) => slug === transaction.project
  368. ) as AvatarProject;
  369. const currentPeriodValue = transaction.aggregate_range_2;
  370. const previousPeriodValue = transaction.aggregate_range_1;
  371. const absolutePercentChange = formatPercentage(
  372. Math.abs(transaction.trend_percentage - 1),
  373. 0
  374. );
  375. const previousDuration = getDuration(
  376. previousPeriodValue / 1000,
  377. previousPeriodValue < 1000 && previousPeriodValue > 10 ? 0 : 2
  378. );
  379. const currentDuration = getDuration(
  380. currentPeriodValue / 1000,
  381. currentPeriodValue < 1000 && currentPeriodValue > 10 ? 0 : 2
  382. );
  383. const percentChangeExplanation = t(
  384. 'Over this period, the %s for %s has %s %s from %s to %s',
  385. currentTrendFunction,
  386. currentTrendColumn,
  387. trendChangeType === TrendChangeType.IMPROVED ? t('decreased') : t('increased'),
  388. absolutePercentChange,
  389. previousDuration,
  390. currentDuration
  391. );
  392. const longestPeriodValue =
  393. trendChangeType === TrendChangeType.IMPROVED
  394. ? previousPeriodValue
  395. : currentPeriodValue;
  396. const longestDuration =
  397. trendChangeType === TrendChangeType.IMPROVED ? previousDuration : currentDuration;
  398. return (
  399. <Fragment>
  400. <ListItemContainer data-test-id={'trends-list-item-' + trendChangeType}>
  401. <ItemRadioContainer color={color}>
  402. {transaction.count_range_1 && transaction.count_range_2 ? (
  403. <Tooltip
  404. title={
  405. <TooltipContent>
  406. <span>{t('Total Events')}</span>
  407. <span>
  408. <Count value={transaction.count_range_1} />
  409. <StyledIconArrow direction="right" size="xs" />
  410. <Count value={transaction.count_range_2} />
  411. </span>
  412. </TooltipContent>
  413. }
  414. >
  415. <RadioLineItem index={index} role="radio">
  416. <Radio
  417. checked={isSelected}
  418. onChange={() => handleSelectTransaction(transaction)}
  419. />
  420. </RadioLineItem>
  421. </Tooltip>
  422. ) : (
  423. <RadioLineItem index={index} role="radio">
  424. <Radio
  425. checked={isSelected}
  426. onChange={() => handleSelectTransaction(transaction)}
  427. />
  428. </RadioLineItem>
  429. )}
  430. </ItemRadioContainer>
  431. <TransactionSummaryLink {...props} onItemClicked={setOpenedTransaction} />
  432. <ItemTransactionPercentage>
  433. <Tooltip title={percentChangeExplanation}>
  434. <Fragment>
  435. {trendChangeType === TrendChangeType.REGRESSION ? '+' : ''}
  436. {formatPercentage(transaction.trend_percentage - 1, 0)}
  437. </Fragment>
  438. </Tooltip>
  439. </ItemTransactionPercentage>
  440. <DropdownLink
  441. caret={false}
  442. anchorRight
  443. title={
  444. <StyledButton
  445. size="xs"
  446. icon={<IconEllipsis data-test-id="trends-item-action" />}
  447. aria-label={t('Actions')}
  448. />
  449. }
  450. >
  451. {!organization.features.includes('performance-new-trends') && (
  452. <Fragment>
  453. <MenuItem
  454. onClick={() =>
  455. handleFilterDuration(
  456. location,
  457. organization,
  458. longestPeriodValue,
  459. FilterSymbols.LESS_THAN_EQUALS,
  460. trendChangeType,
  461. projects,
  462. trendView.project
  463. )
  464. }
  465. >
  466. <MenuAction>{t('Show \u2264 %s', longestDuration)}</MenuAction>
  467. </MenuItem>
  468. <MenuItem
  469. onClick={() =>
  470. handleFilterDuration(
  471. location,
  472. organization,
  473. longestPeriodValue,
  474. FilterSymbols.GREATER_THAN_EQUALS,
  475. trendChangeType,
  476. projects,
  477. trendView.project
  478. )
  479. }
  480. >
  481. <MenuAction>{t('Show \u2265 %s', longestDuration)}</MenuAction>
  482. </MenuItem>
  483. </Fragment>
  484. )}
  485. <MenuItem
  486. onClick={() => handleFilterTransaction(location, transaction.transaction)}
  487. >
  488. <MenuAction>{t('Hide from list')}</MenuAction>
  489. </MenuItem>
  490. </DropdownLink>
  491. <ItemTransactionDurationChange>
  492. {project && (
  493. <Tooltip title={transaction.project}>
  494. <IdBadge avatarSize={16} project={project} hideName />
  495. </Tooltip>
  496. )}
  497. <CompareDurations {...props} />
  498. </ItemTransactionDurationChange>
  499. <ItemTransactionStatus color={color}>
  500. <ValueDelta {...props} />
  501. </ItemTransactionStatus>
  502. </ListItemContainer>
  503. <Feature features="performance-change-explorer">
  504. <PerformanceChangeExplorer
  505. collapsed={openedTransaction === null}
  506. onClose={() => setOpenedTransaction(null)}
  507. transaction={transaction}
  508. trendChangeType={trendChangeType}
  509. trendFunction={currentTrendFunction}
  510. trendView={trendView}
  511. statsData={statsData}
  512. isLoading={isLoading}
  513. organization={organization}
  514. projects={projects}
  515. trendParameter={trendParameter}
  516. location={location}
  517. />
  518. </Feature>
  519. </Fragment>
  520. );
  521. }
  522. export function CompareDurations({
  523. transaction,
  524. }: {
  525. transaction: TrendsListItemProps['transaction'];
  526. }) {
  527. const {fromSeconds, toSeconds, showDigits} = transformDeltaSpread(
  528. transaction.aggregate_range_1,
  529. transaction.aggregate_range_2
  530. );
  531. return (
  532. <DurationChange>
  533. <Duration seconds={fromSeconds} fixedDigits={showDigits ? 1 : 0} abbreviation />
  534. <StyledIconArrow direction="right" size="xs" />
  535. <Duration seconds={toSeconds} fixedDigits={showDigits ? 1 : 0} abbreviation />
  536. </DurationChange>
  537. );
  538. }
  539. function ValueDelta({transaction, trendChangeType}: TrendsListItemProps) {
  540. const {seconds, fixedDigits, changeLabel} = transformValueDelta(
  541. transaction.trend_difference,
  542. trendChangeType
  543. );
  544. return (
  545. <span>
  546. <Duration seconds={seconds} fixedDigits={fixedDigits} abbreviation /> {changeLabel}
  547. </span>
  548. );
  549. }
  550. type TransactionSummaryLinkProps = TrendsListItemProps & {
  551. onItemClicked: React.Dispatch<React.SetStateAction<null | string>>;
  552. };
  553. function TransactionSummaryLink(props: TransactionSummaryLinkProps) {
  554. const {
  555. organization,
  556. trendView: eventView,
  557. transaction,
  558. projects,
  559. location,
  560. currentTrendFunction,
  561. onItemClicked: onTransactionSelection,
  562. } = props;
  563. const summaryView = eventView.clone();
  564. const projectID = getTrendProjectId(transaction, projects);
  565. const target = transactionSummaryRouteWithQuery({
  566. orgSlug: organization.slug,
  567. transaction: String(transaction.transaction),
  568. query: summaryView.generateQueryStringObject(),
  569. projectID,
  570. display: DisplayModes.TREND,
  571. trendFunction: currentTrendFunction,
  572. additionalQuery: {
  573. trendParameter: location.query.trendParameter?.toString(),
  574. },
  575. });
  576. const handleClick = useCallback(() => {
  577. onTransactionSelection(transaction.transaction);
  578. trackAnalytics('performance_views.performance_change_explorer.open', {
  579. organization,
  580. transaction: transaction.transaction,
  581. });
  582. }, [onTransactionSelection, transaction.transaction, organization]);
  583. if (organization.features.includes('performance-change-explorer')) {
  584. return (
  585. <ItemTransactionName
  586. to=""
  587. data-test-id="item-transaction-name"
  588. onClick={handleClick}
  589. >
  590. {transaction.transaction}
  591. </ItemTransactionName>
  592. );
  593. }
  594. return (
  595. <ItemTransactionName to={target} data-test-id="item-transaction-name">
  596. {transaction.transaction}
  597. </ItemTransactionName>
  598. );
  599. }
  600. const TransactionsListContainer = styled('div')`
  601. display: flex;
  602. flex-direction: column;
  603. `;
  604. const TrendsTransactionPanel = styled(Panel)`
  605. margin: 0;
  606. flex-grow: 1;
  607. `;
  608. const ChartContainer = styled('div')`
  609. padding: ${space(3)};
  610. `;
  611. const StyledHeaderTitleLegend = styled(HeaderTitleLegend)`
  612. border-radius: ${p => p.theme.borderRadius};
  613. margin: ${space(2)} ${space(3)};
  614. `;
  615. const StyledButton = styled(Button)`
  616. vertical-align: middle;
  617. `;
  618. const MenuAction = styled('div')<{['data-test-id']?: string}>`
  619. white-space: nowrap;
  620. color: ${p => p.theme.textColor};
  621. `;
  622. MenuAction.defaultProps = {
  623. 'data-test-id': 'menu-action',
  624. };
  625. const StyledEmptyStateWarning = styled(EmptyStateWarning)`
  626. min-height: 300px;
  627. justify-content: center;
  628. `;
  629. const ListItemContainer = styled('div')`
  630. display: grid;
  631. grid-template-columns: 24px auto 100px 30px;
  632. grid-template-rows: repeat(2, auto);
  633. grid-column-gap: ${space(1)};
  634. border-top: 1px solid ${p => p.theme.border};
  635. padding: ${space(1)} ${space(2)};
  636. `;
  637. const ItemRadioContainer = styled('div')`
  638. grid-row: 1/3;
  639. input {
  640. cursor: pointer;
  641. }
  642. input:checked::after {
  643. background-color: ${p => p.color};
  644. }
  645. `;
  646. const ItemTransactionName = styled(Link)`
  647. font-size: ${p => p.theme.fontSizeMedium};
  648. margin-right: ${space(1)};
  649. ${p => p.theme.overflowEllipsis};
  650. `;
  651. const ItemTransactionDurationChange = styled('div')`
  652. display: flex;
  653. align-items: center;
  654. font-size: ${p => p.theme.fontSizeSmall};
  655. `;
  656. const DurationChange = styled('span')`
  657. color: ${p => p.theme.gray300};
  658. margin: 0 ${space(1)};
  659. `;
  660. const ItemTransactionPercentage = styled('div')`
  661. text-align: right;
  662. font-size: ${p => p.theme.fontSizeMedium};
  663. `;
  664. const ItemTransactionStatus = styled('div')`
  665. color: ${p => p.color};
  666. text-align: right;
  667. font-size: ${p => p.theme.fontSizeSmall};
  668. `;
  669. const TooltipContent = styled('div')`
  670. display: flex;
  671. flex-direction: column;
  672. align-items: center;
  673. `;
  674. const StyledIconArrow = styled(IconArrow)`
  675. margin: 0 ${space(1)};
  676. `;
  677. export default withProjects(withOrganization(ChangedTransactions));