123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820 |
- import {browserHistory} from 'react-router';
- import styled from '@emotion/styled';
- import {Location} from 'history';
- import partial from 'lodash/partial';
- import Count from 'sentry/components/count';
- import Duration from 'sentry/components/duration';
- import FileSize from 'sentry/components/fileSize';
- import ProjectBadge from 'sentry/components/idBadge/projectBadge';
- import UserBadge from 'sentry/components/idBadge/userBadge';
- import ExternalLink from 'sentry/components/links/externalLink';
- import {RowRectangle} from 'sentry/components/performance/waterfall/rowBar';
- import {pickBarColor, toPercent} from 'sentry/components/performance/waterfall/utils';
- import Tooltip from 'sentry/components/tooltip';
- import UserMisery from 'sentry/components/userMisery';
- import Version from 'sentry/components/version';
- import {t} from 'sentry/locale';
- import {AvatarProject, Organization, Project} from 'sentry/types';
- import {defined, isUrl} from 'sentry/utils';
- import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
- import EventView, {EventData, MetaType} from 'sentry/utils/discover/eventView';
- import {
- AGGREGATIONS,
- getAggregateAlias,
- getSpanOperationName,
- isEquation,
- isRelativeSpanOperationBreakdownField,
- SPAN_OP_BREAKDOWN_FIELDS,
- SPAN_OP_RELATIVE_BREAKDOWN_FIELD,
- } from 'sentry/utils/discover/fields';
- import {getShortEventId} from 'sentry/utils/events';
- import {formatFloat, formatPercentage} from 'sentry/utils/formatters';
- import getDynamicText from 'sentry/utils/getDynamicText';
- import Projects from 'sentry/utils/projects';
- import {
- filterToLocationQuery,
- SpanOperationBreakdownFilter,
- stringToFilter,
- } from 'sentry/views/performance/transactionSummary/filter';
- import ArrayValue from './arrayValue';
- import {
- BarContainer,
- Container,
- FieldDateTime,
- FieldShortId,
- FlexContainer,
- NumberContainer,
- OverflowLink,
- UserIcon,
- VersionContainer,
- } from './styles';
- import TeamKeyTransactionField from './teamKeyTransactionField';
- /**
- * Types, functions and definitions for rendering fields in discover results.
- */
- export type RenderFunctionBaggage = {
- location: Location;
- organization: Organization;
- eventView?: EventView;
- unit?: string;
- };
- type FieldFormatterRenderFunction = (
- field: string,
- data: EventData,
- baggage?: RenderFunctionBaggage
- ) => React.ReactNode;
- type FieldFormatterRenderFunctionPartial = (
- data: EventData,
- baggage: RenderFunctionBaggage
- ) => React.ReactNode;
- type FieldFormatter = {
- isSortable: boolean;
- renderFunc: FieldFormatterRenderFunction;
- };
- type FieldFormatters = {
- array: FieldFormatter;
- boolean: FieldFormatter;
- date: FieldFormatter;
- duration: FieldFormatter;
- integer: FieldFormatter;
- number: FieldFormatter;
- percentage: FieldFormatter;
- size: FieldFormatter;
- string: FieldFormatter;
- };
- export type FieldTypes = keyof FieldFormatters;
- const EmptyValueContainer = styled('span')`
- color: ${p => p.theme.gray300};
- `;
- const emptyValue = <EmptyValueContainer>{t('(no value)')}</EmptyValueContainer>;
- const emptyStringValue = <EmptyValueContainer>{t('(empty string)')}</EmptyValueContainer>;
- export function nullableValue(value: string | null): string | React.ReactElement {
- switch (value) {
- case null:
- return emptyValue;
- case '':
- return emptyStringValue;
- default:
- return value;
- }
- }
- export const SIZE_UNITS = {
- bit: 1 / 8,
- byte: 1,
- kibibyte: 1024,
- mebibyte: 1024 ** 2,
- gibibyte: 1024 ** 3,
- tebibyte: 1024 ** 4,
- pebibyte: 1024 ** 5,
- exbibyte: 1024 ** 6,
- kilobyte: 1000,
- megabyte: 1000 ** 2,
- gigabyte: 1000 ** 3,
- terabyte: 1000 ** 4,
- petabyte: 1000 ** 5,
- exabyte: 1000 ** 6,
- };
- export const ABYTE_UNITS = [
- 'kilobyte',
- 'megabyte',
- 'gigabyte',
- 'terabyte',
- 'petabyte',
- 'exabyte',
- ];
- export const DURATION_UNITS = {
- nanosecond: 1 / 1000 ** 2,
- microsecond: 1 / 1000,
- millisecond: 1,
- second: 1000,
- minute: 1000 * 60,
- hour: 1000 * 60 * 60,
- day: 1000 * 60 * 60 * 24,
- week: 1000 * 60 * 60 * 24 * 7,
- };
- export const PERCENTAGE_UNITS = ['ratio', 'percent'];
- /**
- * A mapping of field types to their rendering function.
- * This mapping is used when a field is not defined in SPECIAL_FIELDS
- * and the field is not being coerced to a link.
- *
- * This mapping should match the output sentry.utils.snuba:get_json_type
- */
- export const FIELD_FORMATTERS: FieldFormatters = {
- boolean: {
- isSortable: true,
- renderFunc: (field, data) => {
- const value = data[field] ? t('true') : t('false');
- return <Container>{value}</Container>;
- },
- },
- date: {
- isSortable: true,
- renderFunc: (field, data) => (
- <Container>
- {data[field]
- ? getDynamicText({
- value: <FieldDateTime date={data[field]} year seconds timeZone />,
- fixed: 'timestamp',
- })
- : emptyValue}
- </Container>
- ),
- },
- duration: {
- isSortable: true,
- renderFunc: (field, data, baggage) => {
- const {unit} = baggage ?? {};
- return (
- <NumberContainer>
- {typeof data[field] === 'number' ? (
- <Duration
- seconds={(data[field] * ((unit && DURATION_UNITS[unit]) ?? 1)) / 1000}
- fixedDigits={2}
- abbreviation
- />
- ) : (
- emptyValue
- )}
- </NumberContainer>
- );
- },
- },
- integer: {
- isSortable: true,
- renderFunc: (field, data) => (
- <NumberContainer>
- {typeof data[field] === 'number' ? <Count value={data[field]} /> : emptyValue}
- </NumberContainer>
- ),
- },
- number: {
- isSortable: true,
- renderFunc: (field, data) => (
- <NumberContainer>
- {typeof data[field] === 'number' ? formatFloat(data[field], 4) : emptyValue}
- </NumberContainer>
- ),
- },
- percentage: {
- isSortable: true,
- renderFunc: (field, data) => (
- <NumberContainer>
- {typeof data[field] === 'number' ? formatPercentage(data[field]) : emptyValue}
- </NumberContainer>
- ),
- },
- size: {
- isSortable: true,
- renderFunc: (field, data, baggage) => {
- const {unit} = baggage ?? {};
- return (
- <NumberContainer>
- {unit && SIZE_UNITS[unit] && typeof data[field] === 'number' ? (
- <FileSize
- bytes={data[field] * SIZE_UNITS[unit]}
- base={ABYTE_UNITS.includes(unit) ? 10 : 2}
- />
- ) : (
- emptyValue
- )}
- </NumberContainer>
- );
- },
- },
- string: {
- isSortable: true,
- renderFunc: (field, data) => {
- // Some fields have long arrays in them, only show the tail of the data.
- const value = Array.isArray(data[field])
- ? data[field].slice(-1)
- : defined(data[field])
- ? data[field]
- : emptyValue;
- if (isUrl(value)) {
- return (
- <Container>
- <ExternalLink href={value} data-test-id="group-tag-url">
- {value}
- </ExternalLink>
- </Container>
- );
- }
- return <Container>{nullableValue(value)}</Container>;
- },
- },
- array: {
- isSortable: true,
- renderFunc: (field, data) => {
- const value = Array.isArray(data[field]) ? data[field] : [data[field]];
- return <ArrayValue value={value} />;
- },
- },
- };
- type SpecialFieldRenderFunc = (
- data: EventData,
- baggage: RenderFunctionBaggage
- ) => React.ReactNode;
- type SpecialField = {
- renderFunc: SpecialFieldRenderFunc;
- sortField: string | null;
- };
- type SpecialFields = {
- 'count_unique(user)': SpecialField;
- 'error.handled': SpecialField;
- id: SpecialField;
- issue: SpecialField;
- 'issue.id': SpecialField;
- project: SpecialField;
- release: SpecialField;
- team_key_transaction: SpecialField;
- 'timestamp.to_day': SpecialField;
- 'timestamp.to_hour': SpecialField;
- trace: SpecialField;
- 'trend_percentage()': SpecialField;
- user: SpecialField;
- 'user.display': SpecialField;
- };
- /**
- * "Special fields" either do not map 1:1 to an single column in the event database,
- * or they require custom UI formatting that can't be handled by the datatype formatters.
- */
- const SPECIAL_FIELDS: SpecialFields = {
- id: {
- sortField: 'id',
- renderFunc: data => {
- const id: string | unknown = data?.id;
- if (typeof id !== 'string') {
- return null;
- }
- return <Container>{getShortEventId(id)}</Container>;
- },
- },
- trace: {
- sortField: 'trace',
- renderFunc: data => {
- const id: string | unknown = data?.trace;
- if (typeof id !== 'string') {
- return null;
- }
- return <Container>{getShortEventId(id)}</Container>;
- },
- },
- 'issue.id': {
- sortField: 'issue.id',
- renderFunc: (data, {organization}) => {
- const target = {
- pathname: `/organizations/${organization.slug}/issues/${data['issue.id']}/`,
- };
- return (
- <Container>
- <OverflowLink to={target} aria-label={data['issue.id']}>
- {data['issue.id']}
- </OverflowLink>
- </Container>
- );
- },
- },
- issue: {
- sortField: null,
- renderFunc: (data, {organization}) => {
- const issueID = data['issue.id'];
- if (!issueID) {
- return (
- <Container>
- <FieldShortId shortId={`${data.issue}`} />
- </Container>
- );
- }
- const target = {
- pathname: `/organizations/${organization.slug}/issues/${issueID}/`,
- };
- return (
- <Container>
- <OverflowLink to={target} aria-label={issueID}>
- <FieldShortId shortId={`${data.issue}`} />
- </OverflowLink>
- </Container>
- );
- },
- },
- project: {
- sortField: 'project',
- renderFunc: (data, {organization}) => {
- let slugs: string[] | undefined = undefined;
- let projectIds: number[] | undefined = undefined;
- if (typeof data.project === 'number') {
- projectIds = [data.project];
- } else {
- slugs = [data.project];
- }
- return (
- <Container>
- <Projects orgId={organization.slug} slugs={slugs} projectIds={projectIds}>
- {({projects}) => {
- let project: Project | AvatarProject | undefined;
- if (typeof data.project === 'number') {
- project = projects.find(p => p.id === data.project.toString());
- } else {
- project = projects.find(p => p.slug === data.project);
- }
- return (
- <ProjectBadge
- project={project ? project : {slug: data.project}}
- avatarSize={16}
- />
- );
- }}
- </Projects>
- </Container>
- );
- },
- },
- user: {
- sortField: 'user',
- renderFunc: data => {
- if (data.user) {
- const [key, value] = data.user.split(':');
- const userObj = {
- id: '',
- name: '',
- email: '',
- username: '',
- ip_address: '',
- };
- userObj[key] = value;
- const badge = <UserBadge user={userObj} hideEmail avatarSize={16} />;
- return <Container>{badge}</Container>;
- }
- return <Container>{emptyValue}</Container>;
- },
- },
- 'user.display': {
- sortField: 'user.display',
- renderFunc: data => {
- if (data['user.display']) {
- const userObj = {
- id: '',
- name: data['user.display'],
- email: '',
- username: '',
- ip_address: '',
- };
- const badge = <UserBadge user={userObj} hideEmail avatarSize={16} />;
- return <Container>{badge}</Container>;
- }
- return <Container>{emptyValue}</Container>;
- },
- },
- 'count_unique(user)': {
- sortField: 'count_unique(user)',
- renderFunc: data => {
- const count = data.count_unique_user ?? data['count_unique(user)'];
- if (typeof count === 'number') {
- return (
- <FlexContainer>
- <NumberContainer>
- <Count value={count} />
- </NumberContainer>
- <UserIcon size="20" />
- </FlexContainer>
- );
- }
- return <Container>{emptyValue}</Container>;
- },
- },
- release: {
- sortField: 'release',
- renderFunc: data =>
- data.release ? (
- <VersionContainer>
- <Version version={data.release} anchor={false} tooltipRawVersion truncate />
- </VersionContainer>
- ) : (
- <Container>{emptyValue}</Container>
- ),
- },
- 'error.handled': {
- sortField: 'error.handled',
- renderFunc: data => {
- const values = data['error.handled'];
- // Transactions will have null, and default events have no handled attributes.
- if (values === null || values?.length === 0) {
- return <Container>{emptyValue}</Container>;
- }
- const value = Array.isArray(values) ? values : [values];
- return (
- <Container>
- {value.every(v => [1, null].includes(v)) ? 'true' : 'false'}
- </Container>
- );
- },
- },
- team_key_transaction: {
- sortField: null,
- renderFunc: (data, {organization}) => (
- <Container>
- <TeamKeyTransactionField
- isKeyTransaction={(data.team_key_transaction ?? 0) !== 0}
- organization={organization}
- projectSlug={data.project}
- transactionName={data.transaction}
- />
- </Container>
- ),
- },
- 'trend_percentage()': {
- sortField: 'trend_percentage()',
- renderFunc: data => (
- <NumberContainer>
- {typeof data.trend_percentage === 'number'
- ? formatPercentage(data.trend_percentage - 1)
- : emptyValue}
- </NumberContainer>
- ),
- },
- 'timestamp.to_hour': {
- sortField: 'timestamp.to_hour',
- renderFunc: data => (
- <Container>
- {getDynamicText({
- value: <FieldDateTime date={data['timestamp.to_hour']} year timeZone />,
- fixed: 'timestamp.to_hour',
- })}
- </Container>
- ),
- },
- 'timestamp.to_day': {
- sortField: 'timestamp.to_day',
- renderFunc: data => (
- <Container>
- {getDynamicText({
- value: <FieldDateTime date={data['timestamp.to_day']} dateOnly year utc />,
- fixed: 'timestamp.to_day',
- })}
- </Container>
- ),
- },
- };
- type SpecialFunctionFieldRenderer = (
- fieldName: string
- ) => (data: EventData, baggage: RenderFunctionBaggage) => React.ReactNode;
- type SpecialFunctions = {
- user_misery: SpecialFunctionFieldRenderer;
- };
- /**
- * "Special functions" are functions whose values either do not map 1:1 to a single column,
- * or they require custom UI formatting that can't be handled by the datatype formatters.
- */
- const SPECIAL_FUNCTIONS: SpecialFunctions = {
- user_misery: fieldName => data => {
- const userMiseryField = fieldName;
- if (!(userMiseryField in data)) {
- return <NumberContainer>{emptyValue}</NumberContainer>;
- }
- const userMisery = data[userMiseryField];
- if (userMisery === null || isNaN(userMisery)) {
- return <NumberContainer>{emptyValue}</NumberContainer>;
- }
- const projectThresholdConfig = 'project_threshold_config';
- let countMiserableUserField: string = '';
- let miseryLimit: number | undefined = parseInt(
- userMiseryField.split('(').pop()?.slice(0, -1) || '',
- 10
- );
- if (isNaN(miseryLimit)) {
- countMiserableUserField = 'count_miserable(user)';
- if (projectThresholdConfig in data) {
- miseryLimit = data[projectThresholdConfig][1];
- } else {
- miseryLimit = undefined;
- }
- } else {
- countMiserableUserField = `count_miserable(user,${miseryLimit})`;
- }
- const uniqueUsers = data['count_unique(user)'];
- let miserableUsers: number | undefined;
- if (countMiserableUserField in data) {
- const countMiserableMiseryLimit = parseInt(
- userMiseryField.split('(').pop()?.slice(0, -1) || '',
- 10
- );
- miserableUsers =
- countMiserableMiseryLimit === miseryLimit ||
- (isNaN(countMiserableMiseryLimit) && projectThresholdConfig)
- ? data[countMiserableUserField]
- : undefined;
- }
- return (
- <BarContainer>
- <UserMisery
- bars={10}
- barHeight={20}
- miseryLimit={miseryLimit}
- totalUsers={uniqueUsers}
- userMisery={userMisery}
- miserableUsers={miserableUsers}
- />
- </BarContainer>
- );
- },
- };
- /**
- * Get the sort field name for a given field if it is special or fallback
- * to the generic type formatter.
- */
- export function getSortField(
- field: string,
- tableMeta: MetaType | undefined
- ): string | null {
- if (SPECIAL_FIELDS.hasOwnProperty(field)) {
- return SPECIAL_FIELDS[field as keyof typeof SPECIAL_FIELDS].sortField;
- }
- if (!tableMeta) {
- return field;
- }
- if (isEquation(field)) {
- return field;
- }
- for (const alias in AGGREGATIONS) {
- if (field.startsWith(alias)) {
- return AGGREGATIONS[alias].isSortable ? field : null;
- }
- }
- const fieldType = tableMeta[field];
- if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
- return FIELD_FORMATTERS[fieldType as keyof typeof FIELD_FORMATTERS].isSortable
- ? field
- : null;
- }
- return null;
- }
- const isDurationValue = (data: EventData, field: string): boolean => {
- return field in data && typeof data[field] === 'number';
- };
- const spanOperationRelativeBreakdownRenderer = (
- data: EventData,
- {location, organization, eventView}: RenderFunctionBaggage
- ): React.ReactNode => {
- const sumOfSpanTime = SPAN_OP_BREAKDOWN_FIELDS.reduce(
- (prev, curr) => (isDurationValue(data, curr) ? prev + data[curr] : prev),
- 0
- );
- const cumulativeSpanOpBreakdown = Math.max(sumOfSpanTime, data['transaction.duration']);
- if (
- SPAN_OP_BREAKDOWN_FIELDS.every(field => !isDurationValue(data, field)) ||
- cumulativeSpanOpBreakdown === 0
- ) {
- return FIELD_FORMATTERS.duration.renderFunc(SPAN_OP_RELATIVE_BREAKDOWN_FIELD, data);
- }
- let otherPercentage = 1;
- let orderedSpanOpsBreakdownFields;
- const sortingOnField = eventView?.sorts?.[0]?.field;
- if (sortingOnField && (SPAN_OP_BREAKDOWN_FIELDS as string[]).includes(sortingOnField)) {
- orderedSpanOpsBreakdownFields = [
- sortingOnField,
- ...SPAN_OP_BREAKDOWN_FIELDS.filter(op => op !== sortingOnField),
- ];
- } else {
- orderedSpanOpsBreakdownFields = SPAN_OP_BREAKDOWN_FIELDS;
- }
- return (
- <RelativeOpsBreakdown>
- {orderedSpanOpsBreakdownFields.map(field => {
- if (!isDurationValue(data, field)) {
- return null;
- }
- const operationName = getSpanOperationName(field) ?? 'op';
- const spanOpDuration: number = data[field];
- const widthPercentage = spanOpDuration / cumulativeSpanOpBreakdown;
- otherPercentage = otherPercentage - widthPercentage;
- if (widthPercentage === 0) {
- return null;
- }
- return (
- <div key={operationName} style={{width: toPercent(widthPercentage || 0)}}>
- <Tooltip
- title={
- <div>
- <div>{operationName}</div>
- <div>
- <Duration
- seconds={spanOpDuration / 1000}
- fixedDigits={2}
- abbreviation
- />
- </div>
- </div>
- }
- containerDisplayMode="block"
- >
- <RectangleRelativeOpsBreakdown
- spanBarHatch={false}
- style={{
- backgroundColor: pickBarColor(operationName),
- cursor: 'pointer',
- }}
- onClick={event => {
- event.stopPropagation();
- const filter = stringToFilter(operationName);
- if (filter === SpanOperationBreakdownFilter.None) {
- return;
- }
- trackAdvancedAnalyticsEvent(
- 'performance_views.relative_breakdown.selection',
- {
- action: filter,
- organization,
- }
- );
- browserHistory.push({
- pathname: location.pathname,
- query: {
- ...location.query,
- ...filterToLocationQuery(filter),
- },
- });
- }}
- />
- </Tooltip>
- </div>
- );
- })}
- <div key="other" style={{width: toPercent(otherPercentage || 0)}}>
- <Tooltip title={<div>{t('Other')}</div>} containerDisplayMode="block">
- <OtherRelativeOpsBreakdown spanBarHatch={false} />
- </Tooltip>
- </div>
- </RelativeOpsBreakdown>
- );
- };
- const RelativeOpsBreakdown = styled('div')`
- position: relative;
- display: flex;
- `;
- const RectangleRelativeOpsBreakdown = styled(RowRectangle)`
- position: relative;
- width: 100%;
- `;
- const OtherRelativeOpsBreakdown = styled(RectangleRelativeOpsBreakdown)`
- background-color: ${p => p.theme.gray100};
- `;
- /**
- * Get the field renderer for the named field and metadata
- *
- * @param {String} field name
- * @param {object} metadata mapping.
- * @param {boolean} isAlias convert the name with getAggregateAlias
- * @returns {Function}
- */
- export function getFieldRenderer(
- field: string,
- meta: MetaType,
- isAlias: boolean = true
- ): FieldFormatterRenderFunctionPartial {
- if (SPECIAL_FIELDS.hasOwnProperty(field)) {
- return SPECIAL_FIELDS[field].renderFunc;
- }
- if (isRelativeSpanOperationBreakdownField(field)) {
- return spanOperationRelativeBreakdownRenderer;
- }
- const fieldName = isAlias ? getAggregateAlias(field) : field;
- const fieldType = meta[fieldName];
- for (const alias in SPECIAL_FUNCTIONS) {
- if (fieldName.startsWith(alias)) {
- return SPECIAL_FUNCTIONS[alias](fieldName);
- }
- }
- if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
- return partial(FIELD_FORMATTERS[fieldType].renderFunc, fieldName);
- }
- return partial(FIELD_FORMATTERS.string.renderFunc, fieldName);
- }
- type FieldTypeFormatterRenderFunctionPartial = (
- data: EventData,
- baggage?: RenderFunctionBaggage
- ) => React.ReactNode;
- /**
- * Get the field renderer for the named field only based on its type from the given
- * metadata.
- *
- * @param {String} field name
- * @param {object} metadata mapping.
- * @param {boolean} isAlias convert the name with getAggregateAlias
- * @returns {Function}
- */
- export function getFieldFormatter(
- field: string,
- meta: MetaType,
- isAlias: boolean = true
- ): FieldTypeFormatterRenderFunctionPartial {
- const fieldName = isAlias ? getAggregateAlias(field) : field;
- const fieldType = meta[fieldName];
- if (FIELD_FORMATTERS.hasOwnProperty(fieldType)) {
- return partial(FIELD_FORMATTERS[fieldType].renderFunc, fieldName);
- }
- return partial(FIELD_FORMATTERS.string.renderFunc, fieldName);
- }
|