fieldRenderers.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. import * as React from 'react';
  2. import {browserHistory} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import {Location} from 'history';
  5. import partial from 'lodash/partial';
  6. import Count from 'app/components/count';
  7. import Duration from 'app/components/duration';
  8. import ProjectBadge from 'app/components/idBadge/projectBadge';
  9. import UserBadge from 'app/components/idBadge/userBadge';
  10. import {RowRectangle} from 'app/components/performance/waterfall/rowBar';
  11. import {pickBarColour, toPercent} from 'app/components/performance/waterfall/utils';
  12. import Tooltip from 'app/components/tooltip';
  13. import UserMisery from 'app/components/userMisery';
  14. import Version from 'app/components/version';
  15. import {t} from 'app/locale';
  16. import {Organization} from 'app/types';
  17. import {defined} from 'app/utils';
  18. import {trackAnalyticsEvent} from 'app/utils/analytics';
  19. import EventView, {EventData, MetaType} from 'app/utils/discover/eventView';
  20. import {
  21. AGGREGATIONS,
  22. getAggregateAlias,
  23. getSpanOperationName,
  24. isEquation,
  25. isRelativeSpanOperationBreakdownField,
  26. SPAN_OP_BREAKDOWN_FIELDS,
  27. SPAN_OP_RELATIVE_BREAKDOWN_FIELD,
  28. } from 'app/utils/discover/fields';
  29. import {getShortEventId} from 'app/utils/events';
  30. import {formatFloat, formatPercentage} from 'app/utils/formatters';
  31. import getDynamicText from 'app/utils/getDynamicText';
  32. import Projects from 'app/utils/projects';
  33. import {
  34. filterToLocationQuery,
  35. SpanOperationBreakdownFilter,
  36. stringToFilter,
  37. } from 'app/views/performance/transactionSummary/filter';
  38. import ArrayValue from './arrayValue';
  39. import KeyTransactionField from './keyTransactionField';
  40. import {
  41. BarContainer,
  42. Container,
  43. FlexContainer,
  44. NumberContainer,
  45. OverflowLink,
  46. StyledDateTime,
  47. StyledShortId,
  48. UserIcon,
  49. VersionContainer,
  50. } from './styles';
  51. import TeamKeyTransactionField from './teamKeyTransactionField';
  52. /**
  53. * Types, functions and definitions for rendering fields in discover results.
  54. */
  55. type RenderFunctionBaggage = {
  56. organization: Organization;
  57. location: Location;
  58. eventView?: EventView;
  59. };
  60. type FieldFormatterRenderFunction = (field: string, data: EventData) => React.ReactNode;
  61. type FieldFormatterRenderFunctionPartial = (
  62. data: EventData,
  63. baggage: RenderFunctionBaggage
  64. ) => React.ReactNode;
  65. type FieldFormatter = {
  66. isSortable: boolean;
  67. renderFunc: FieldFormatterRenderFunction;
  68. };
  69. type FieldFormatters = {
  70. boolean: FieldFormatter;
  71. date: FieldFormatter;
  72. duration: FieldFormatter;
  73. integer: FieldFormatter;
  74. number: FieldFormatter;
  75. percentage: FieldFormatter;
  76. string: FieldFormatter;
  77. array: FieldFormatter;
  78. };
  79. export type FieldTypes = keyof FieldFormatters;
  80. const EmptyValueContainer = styled('span')`
  81. color: ${p => p.theme.gray300};
  82. `;
  83. const emptyValue = <EmptyValueContainer>{t('n/a')}</EmptyValueContainer>;
  84. /**
  85. * A mapping of field types to their rendering function.
  86. * This mapping is used when a field is not defined in SPECIAL_FIELDS
  87. * and the field is not being coerced to a link.
  88. *
  89. * This mapping should match the output sentry.utils.snuba:get_json_type
  90. */
  91. const FIELD_FORMATTERS: FieldFormatters = {
  92. boolean: {
  93. isSortable: true,
  94. renderFunc: (field, data) => {
  95. const value = data[field] ? t('true') : t('false');
  96. return <Container>{value}</Container>;
  97. },
  98. },
  99. date: {
  100. isSortable: true,
  101. renderFunc: (field, data) => (
  102. <Container>
  103. {data[field]
  104. ? getDynamicText({
  105. value: <StyledDateTime date={data[field]} />,
  106. fixed: 'timestamp',
  107. })
  108. : emptyValue}
  109. </Container>
  110. ),
  111. },
  112. duration: {
  113. isSortable: true,
  114. renderFunc: (field, data) => (
  115. <NumberContainer>
  116. {typeof data[field] === 'number' ? (
  117. <Duration seconds={data[field] / 1000} fixedDigits={2} abbreviation />
  118. ) : (
  119. emptyValue
  120. )}
  121. </NumberContainer>
  122. ),
  123. },
  124. integer: {
  125. isSortable: true,
  126. renderFunc: (field, data) => (
  127. <NumberContainer>
  128. {typeof data[field] === 'number' ? <Count value={data[field]} /> : emptyValue}
  129. </NumberContainer>
  130. ),
  131. },
  132. number: {
  133. isSortable: true,
  134. renderFunc: (field, data) => (
  135. <NumberContainer>
  136. {typeof data[field] === 'number' ? formatFloat(data[field], 4) : emptyValue}
  137. </NumberContainer>
  138. ),
  139. },
  140. percentage: {
  141. isSortable: true,
  142. renderFunc: (field, data) => (
  143. <NumberContainer>
  144. {typeof data[field] === 'number' ? formatPercentage(data[field]) : emptyValue}
  145. </NumberContainer>
  146. ),
  147. },
  148. string: {
  149. isSortable: true,
  150. renderFunc: (field, data) => {
  151. // Some fields have long arrays in them, only show the tail of the data.
  152. const value = Array.isArray(data[field])
  153. ? data[field].slice(-1)
  154. : defined(data[field])
  155. ? data[field]
  156. : emptyValue;
  157. return <Container>{value}</Container>;
  158. },
  159. },
  160. array: {
  161. isSortable: true,
  162. renderFunc: (field, data) => {
  163. const value = Array.isArray(data[field]) ? data[field] : [data[field]];
  164. return <ArrayValue value={value} />;
  165. },
  166. },
  167. };
  168. type SpecialFieldRenderFunc = (
  169. data: EventData,
  170. baggage: RenderFunctionBaggage
  171. ) => React.ReactNode;
  172. type SpecialField = {
  173. sortField: string | null;
  174. renderFunc: SpecialFieldRenderFunc;
  175. };
  176. type SpecialFields = {
  177. id: SpecialField;
  178. trace: SpecialField;
  179. project: SpecialField;
  180. user: SpecialField;
  181. 'user.display': SpecialField;
  182. 'count_unique(user)': SpecialField;
  183. 'issue.id': SpecialField;
  184. 'error.handled': SpecialField;
  185. issue: SpecialField;
  186. release: SpecialField;
  187. key_transaction: SpecialField;
  188. team_key_transaction: SpecialField;
  189. 'trend_percentage()': SpecialField;
  190. 'timestamp.to_hour': SpecialField;
  191. 'timestamp.to_day': SpecialField;
  192. };
  193. /**
  194. * "Special fields" either do not map 1:1 to an single column in the event database,
  195. * or they require custom UI formatting that can't be handled by the datatype formatters.
  196. */
  197. const SPECIAL_FIELDS: SpecialFields = {
  198. id: {
  199. sortField: 'id',
  200. renderFunc: data => {
  201. const id: string | unknown = data?.id;
  202. if (typeof id !== 'string') {
  203. return null;
  204. }
  205. return <Container>{getShortEventId(id)}</Container>;
  206. },
  207. },
  208. trace: {
  209. sortField: 'trace',
  210. renderFunc: data => {
  211. const id: string | unknown = data?.trace;
  212. if (typeof id !== 'string') {
  213. return null;
  214. }
  215. return <Container>{getShortEventId(id)}</Container>;
  216. },
  217. },
  218. 'issue.id': {
  219. sortField: 'issue.id',
  220. renderFunc: (data, {organization}) => {
  221. const target = {
  222. pathname: `/organizations/${organization.slug}/issues/${data['issue.id']}/`,
  223. };
  224. return (
  225. <Container>
  226. <OverflowLink to={target} aria-label={data['issue.id']}>
  227. {data['issue.id']}
  228. </OverflowLink>
  229. </Container>
  230. );
  231. },
  232. },
  233. issue: {
  234. sortField: null,
  235. renderFunc: (data, {organization}) => {
  236. const issueID = data['issue.id'];
  237. if (!issueID) {
  238. return (
  239. <Container>
  240. <StyledShortId shortId={`${data.issue}`} />
  241. </Container>
  242. );
  243. }
  244. const target = {
  245. pathname: `/organizations/${organization.slug}/issues/${issueID}/`,
  246. };
  247. return (
  248. <Container>
  249. <OverflowLink to={target} aria-label={issueID}>
  250. <StyledShortId shortId={`${data.issue}`} />
  251. </OverflowLink>
  252. </Container>
  253. );
  254. },
  255. },
  256. project: {
  257. sortField: 'project',
  258. renderFunc: (data, {organization}) => {
  259. return (
  260. <Container>
  261. <Projects orgId={organization.slug} slugs={[data.project]}>
  262. {({projects}) => {
  263. const project = projects.find(p => p.slug === data.project);
  264. return (
  265. <ProjectBadge
  266. project={project ? project : {slug: data.project}}
  267. avatarSize={16}
  268. />
  269. );
  270. }}
  271. </Projects>
  272. </Container>
  273. );
  274. },
  275. },
  276. user: {
  277. sortField: 'user',
  278. renderFunc: data => {
  279. if (data.user) {
  280. const [key, value] = data.user.split(':');
  281. const userObj = {
  282. id: '',
  283. name: '',
  284. email: '',
  285. username: '',
  286. ip_address: '',
  287. };
  288. userObj[key] = value;
  289. const badge = <UserBadge user={userObj} hideEmail avatarSize={16} />;
  290. return <Container>{badge}</Container>;
  291. }
  292. return <Container>{emptyValue}</Container>;
  293. },
  294. },
  295. 'user.display': {
  296. sortField: 'user.display',
  297. renderFunc: data => {
  298. if (data['user.display']) {
  299. const userObj = {
  300. id: '',
  301. name: data['user.display'],
  302. email: '',
  303. username: '',
  304. ip_address: '',
  305. };
  306. const badge = <UserBadge user={userObj} hideEmail avatarSize={16} />;
  307. return <Container>{badge}</Container>;
  308. }
  309. return <Container>{emptyValue}</Container>;
  310. },
  311. },
  312. 'count_unique(user)': {
  313. sortField: 'count_unique(user)',
  314. renderFunc: data => {
  315. const count = data.count_unique_user;
  316. if (typeof count === 'number') {
  317. return (
  318. <FlexContainer>
  319. <NumberContainer>
  320. <Count value={count} />
  321. </NumberContainer>
  322. <UserIcon size="20" />
  323. </FlexContainer>
  324. );
  325. }
  326. return <Container>{emptyValue}</Container>;
  327. },
  328. },
  329. release: {
  330. sortField: 'release',
  331. renderFunc: data =>
  332. data.release ? (
  333. <VersionContainer>
  334. <Version version={data.release} anchor={false} tooltipRawVersion truncate />
  335. </VersionContainer>
  336. ) : (
  337. <Container>{emptyValue}</Container>
  338. ),
  339. },
  340. 'error.handled': {
  341. sortField: 'error.handled',
  342. renderFunc: data => {
  343. const values = data['error.handled'];
  344. // Transactions will have null, and default events have no handled attributes.
  345. if (values === null || values?.length === 0) {
  346. return <Container>{emptyValue}</Container>;
  347. }
  348. const value = Array.isArray(values) ? values.slice(-1)[0] : values;
  349. return <Container>{[1, null].includes(value) ? 'true' : 'false'}</Container>;
  350. },
  351. },
  352. key_transaction: {
  353. sortField: null,
  354. renderFunc: (data, {organization}) => (
  355. <Container>
  356. <KeyTransactionField
  357. isKeyTransaction={(data.key_transaction ?? 0) !== 0}
  358. organization={organization}
  359. projectSlug={data.project}
  360. transactionName={data.transaction}
  361. />
  362. </Container>
  363. ),
  364. },
  365. team_key_transaction: {
  366. sortField: null,
  367. renderFunc: (data, {organization}) => (
  368. <Container>
  369. <TeamKeyTransactionField
  370. isKeyTransaction={(data.team_key_transaction ?? 0) !== 0}
  371. organization={organization}
  372. projectSlug={data.project}
  373. transactionName={data.transaction}
  374. />
  375. </Container>
  376. ),
  377. },
  378. 'trend_percentage()': {
  379. sortField: 'trend_percentage()',
  380. renderFunc: data => (
  381. <NumberContainer>
  382. {typeof data.trend_percentage === 'number'
  383. ? formatPercentage(data.trend_percentage - 1)
  384. : emptyValue}
  385. </NumberContainer>
  386. ),
  387. },
  388. 'timestamp.to_hour': {
  389. sortField: 'timestamp.to_hour',
  390. renderFunc: data => (
  391. <Container>
  392. {getDynamicText({
  393. value: <StyledDateTime date={data['timestamp.to_hour']} format="lll z" />,
  394. fixed: 'timestamp.to_hour',
  395. })}
  396. </Container>
  397. ),
  398. },
  399. 'timestamp.to_day': {
  400. sortField: 'timestamp.to_day',
  401. renderFunc: data => (
  402. <Container>
  403. {getDynamicText({
  404. value: <StyledDateTime date={data['timestamp.to_day']} format="MMM D, YYYY" />,
  405. fixed: 'timestamp.to_day',
  406. })}
  407. </Container>
  408. ),
  409. },
  410. };
  411. type SpecialFunctionFieldRenderer = (
  412. fieldName: string
  413. ) => (data: EventData, baggage: RenderFunctionBaggage) => React.ReactNode;
  414. type SpecialFunctions = {
  415. user_misery: SpecialFunctionFieldRenderer;
  416. };
  417. /**
  418. * "Special functions" are functions whose values either do not map 1:1 to a single column,
  419. * or they require custom UI formatting that can't be handled by the datatype formatters.
  420. */
  421. const SPECIAL_FUNCTIONS: SpecialFunctions = {
  422. user_misery: fieldName => data => {
  423. const userMiseryField = fieldName;
  424. if (!(userMiseryField in data)) {
  425. return <NumberContainer>{emptyValue}</NumberContainer>;
  426. }
  427. const userMisery = data[userMiseryField];
  428. if (userMisery === null || isNaN(userMisery)) {
  429. return <NumberContainer>{emptyValue}</NumberContainer>;
  430. }
  431. const projectThresholdConfig = 'project_threshold_config';
  432. let countMiserableUserField: string = '';
  433. let miseryLimit: number | undefined = parseInt(
  434. userMiseryField.split('_').pop() || '',
  435. 10
  436. );
  437. if (isNaN(miseryLimit)) {
  438. countMiserableUserField = 'count_miserable_user';
  439. if (projectThresholdConfig in data) {
  440. miseryLimit = data[projectThresholdConfig][1];
  441. } else {
  442. miseryLimit = undefined;
  443. }
  444. } else {
  445. countMiserableUserField = `count_miserable_user_${miseryLimit}`;
  446. }
  447. const uniqueUsers = data.count_unique_user;
  448. let miserableUsers: number | undefined;
  449. if (countMiserableUserField in data) {
  450. const countMiserableMiseryLimit = parseInt(
  451. countMiserableUserField.split('_').pop() || '',
  452. 10
  453. );
  454. miserableUsers =
  455. countMiserableMiseryLimit === miseryLimit ||
  456. (isNaN(countMiserableMiseryLimit) && projectThresholdConfig)
  457. ? data[countMiserableUserField]
  458. : undefined;
  459. }
  460. return (
  461. <BarContainer>
  462. <UserMisery
  463. bars={10}
  464. barHeight={20}
  465. miseryLimit={miseryLimit}
  466. totalUsers={uniqueUsers}
  467. userMisery={userMisery}
  468. miserableUsers={miserableUsers}
  469. />
  470. </BarContainer>
  471. );
  472. },
  473. };
  474. /**
  475. * Get the sort field name for a given field if it is special or fallback
  476. * to the generic type formatter.
  477. */
  478. export function getSortField(
  479. field: string,
  480. tableMeta: MetaType | undefined
  481. ): string | null {
  482. if (SPECIAL_FIELDS.hasOwnProperty(field)) {
  483. return SPECIAL_FIELDS[field as keyof typeof SPECIAL_FIELDS].sortField;
  484. }
  485. if (!tableMeta) {
  486. return field;
  487. }
  488. if (isEquation(field)) {
  489. return field;
  490. }
  491. for (const alias in AGGREGATIONS) {
  492. if (field.startsWith(alias)) {
  493. return AGGREGATIONS[alias].isSortable ? field : null;
  494. }
  495. }
  496. const fieldType = tableMeta[field];
  497. if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
  498. return FIELD_FORMATTERS[fieldType as keyof typeof FIELD_FORMATTERS].isSortable
  499. ? field
  500. : null;
  501. }
  502. return null;
  503. }
  504. const isDurationValue = (data: EventData, field: string): boolean => {
  505. return field in data && typeof data[field] === 'number';
  506. };
  507. const spanOperationRelativeBreakdownRenderer = (
  508. data: EventData,
  509. {location, organization, eventView}: RenderFunctionBaggage
  510. ): React.ReactNode => {
  511. const sumOfSpanTime = SPAN_OP_BREAKDOWN_FIELDS.reduce(
  512. (prev, curr) => (isDurationValue(data, curr) ? prev + data[curr] : prev),
  513. 0
  514. );
  515. const cumulativeSpanOpBreakdown = Math.max(sumOfSpanTime, data['transaction.duration']);
  516. if (
  517. !isDurationValue(data, 'spans.total.time') ||
  518. SPAN_OP_BREAKDOWN_FIELDS.every(field => !isDurationValue(data, field)) ||
  519. cumulativeSpanOpBreakdown === 0
  520. ) {
  521. return FIELD_FORMATTERS.duration.renderFunc(SPAN_OP_RELATIVE_BREAKDOWN_FIELD, data);
  522. }
  523. let otherPercentage = 1;
  524. let orderedSpanOpsBreakdownFields;
  525. const sortingOnField = eventView?.sorts?.[0]?.field;
  526. if (sortingOnField && SPAN_OP_BREAKDOWN_FIELDS.includes(sortingOnField)) {
  527. orderedSpanOpsBreakdownFields = [
  528. sortingOnField,
  529. ...SPAN_OP_BREAKDOWN_FIELDS.filter(op => op !== sortingOnField),
  530. ];
  531. } else {
  532. orderedSpanOpsBreakdownFields = SPAN_OP_BREAKDOWN_FIELDS;
  533. }
  534. return (
  535. <RelativeOpsBreakdown>
  536. {orderedSpanOpsBreakdownFields.map(field => {
  537. if (!isDurationValue(data, field)) {
  538. return null;
  539. }
  540. const operationName = getSpanOperationName(field) ?? 'op';
  541. const spanOpDuration: number = data[field];
  542. const widthPercentage = spanOpDuration / cumulativeSpanOpBreakdown;
  543. otherPercentage = otherPercentage - widthPercentage;
  544. if (widthPercentage === 0) {
  545. return null;
  546. }
  547. return (
  548. <div key={operationName} style={{width: toPercent(widthPercentage || 0)}}>
  549. <Tooltip
  550. title={
  551. <div>
  552. <div>{operationName}</div>
  553. <div>
  554. <Duration
  555. seconds={spanOpDuration / 1000}
  556. fixedDigits={2}
  557. abbreviation
  558. />
  559. </div>
  560. </div>
  561. }
  562. containerDisplayMode="block"
  563. >
  564. <RectangleRelativeOpsBreakdown
  565. spanBarHatch={false}
  566. style={{
  567. backgroundColor: pickBarColour(operationName),
  568. cursor: 'pointer',
  569. }}
  570. onClick={event => {
  571. event.stopPropagation();
  572. const filter = stringToFilter(operationName);
  573. if (filter === SpanOperationBreakdownFilter.None) {
  574. return;
  575. }
  576. trackAnalyticsEvent({
  577. eventName: 'Performance Views: Select Relative Breakdown',
  578. eventKey: 'performance_views.relative_breakdown.selection',
  579. organization_id: parseInt(organization.id, 10),
  580. action: filter as string,
  581. });
  582. browserHistory.push({
  583. pathname: location.pathname,
  584. query: {
  585. ...location.query,
  586. ...filterToLocationQuery(filter),
  587. },
  588. });
  589. }}
  590. />
  591. </Tooltip>
  592. </div>
  593. );
  594. })}
  595. <div key="other" style={{width: toPercent(otherPercentage || 0)}}>
  596. <Tooltip title={<div>{t('Other')}</div>} containerDisplayMode="block">
  597. <OtherRelativeOpsBreakdown spanBarHatch={false} />
  598. </Tooltip>
  599. </div>
  600. </RelativeOpsBreakdown>
  601. );
  602. };
  603. const RelativeOpsBreakdown = styled('div')`
  604. position: relative;
  605. display: flex;
  606. `;
  607. const RectangleRelativeOpsBreakdown = styled(RowRectangle)`
  608. position: relative;
  609. width: 100%;
  610. `;
  611. const OtherRelativeOpsBreakdown = styled(RectangleRelativeOpsBreakdown)`
  612. background-color: ${p => p.theme.gray100};
  613. `;
  614. /**
  615. * Get the field renderer for the named field and metadata
  616. *
  617. * @param {String} field name
  618. * @param {object} metadata mapping.
  619. * @returns {Function}
  620. */
  621. export function getFieldRenderer(
  622. field: string,
  623. meta: MetaType
  624. ): FieldFormatterRenderFunctionPartial {
  625. if (SPECIAL_FIELDS.hasOwnProperty(field)) {
  626. return SPECIAL_FIELDS[field].renderFunc;
  627. }
  628. if (isRelativeSpanOperationBreakdownField(field)) {
  629. return spanOperationRelativeBreakdownRenderer;
  630. }
  631. const fieldName = getAggregateAlias(field);
  632. const fieldType = meta[fieldName];
  633. for (const alias in SPECIAL_FUNCTIONS) {
  634. if (fieldName.startsWith(alias)) {
  635. return SPECIAL_FUNCTIONS[alias](fieldName);
  636. }
  637. }
  638. if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
  639. return partial(FIELD_FORMATTERS[fieldType].renderFunc, fieldName);
  640. }
  641. return partial(FIELD_FORMATTERS.string.renderFunc, fieldName);
  642. }
  643. type FieldTypeFormatterRenderFunctionPartial = (data: EventData) => React.ReactNode;
  644. /**
  645. * Get the field renderer for the named field only based on its type from the given
  646. * metadata.
  647. *
  648. * @param {String} field name
  649. * @param {object} metadata mapping.
  650. * @returns {Function}
  651. */
  652. export function getFieldFormatter(
  653. field: string,
  654. meta: MetaType
  655. ): FieldTypeFormatterRenderFunctionPartial {
  656. const fieldName = getAggregateAlias(field);
  657. const fieldType = meta[fieldName];
  658. if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
  659. return partial(FIELD_FORMATTERS[fieldType].renderFunc, fieldName);
  660. }
  661. return partial(FIELD_FORMATTERS.string.renderFunc, fieldName);
  662. }